Modbus TCP Server

WVESP32
Posts: 2
Joined: Thu Feb 07, 2019 9:45 am

Modbus TCP Server

Postby WVESP32 » Fri Feb 08, 2019 10:04 am

Hi everybody,
i'm new in Espressif forum.
My order was: "ESP32: include a Modbus TCP server application over Etehrnet and WiFi"

My Platform for Arduino "ESP32-EVB" is: PlatFormIO ( newest: Home 2.0.0 ), and VisualStudioCode
platform.io:
[env:xxxxxxx]
platform = espressif32
board = esp32-evb
framework = arduino
board_build.partitions = default.csv
...

What i'm doing (after reading some examples) inside PlatFormIO:
1. append the new library "ArduinoModbus"
... compiling: he said missing "ArduinoRS485" ...
2. so i append the new library "ArduinoRS485"

3. i'm appending "lib_ldf_mode = deep+" in my platform.io, because installed libs are in:
"...\.platformio\lib\ArduinoModbus_ID5816"
"...\.platformio\lib\ArduinoRS485_ID5814"

My source modification is only 2 includes:

TEST1:
#include <ArduinoRS485.h> // ArduinoModbus depends on the ArduinoRS485 library
#include <ArduinoModbus.h>

the compiler said:
....
D:\orcad\spb_data\.platformio\lib\ArduinoRS485_ID5814\src\RS485.cpp: In member function 'virtual void RS485Class::begin(long unsigned int)':
D:\orcad\spb_data\.platformio\lib\ArduinoRS485_ID5814\src\RS485.cpp:33:29: warning: large integer implicitly truncated to unsigned type [-Woverflow]
begin(baudrate, SERIAL_8N1);
^
D:\orcad\spb_data\.platformio\lib\ArduinoRS485_ID5814\src\RS485.cpp: At global scope:
D:\orcad\spb_data\.platformio\lib\ArduinoRS485_ID5814\src\RS485.cpp:169:18: error: 'SERIAL_PORT_HARDWARE' was not declared in this scope
RS485Class RS485(SERIAL_PORT_HARDWARE, RS485_DEFAULT_TX_PIN, RS845_DEFAULT_DE_PIN, RS845_DEFAULT_RE_PIN);
^
In file included from D:\orcad\spb_data\.platformio\lib\ArduinoRS485_ID5814\src\RS485.cpp:20:0:
D:\orcad\spb_data\.platformio\lib\ArduinoRS485_ID5814\src\RS485.h:35:30: error: 'A6' was not declared in this scope
#define RS845_DEFAULT_DE_PIN A6
^
D:\orcad\spb_data\.platformio\lib\ArduinoRS485_ID5814\src\RS485.cpp:169:62: note: in expansion of macro 'RS845_DEFAULT_DE_PIN'
RS485Class RS485(SERIAL_PORT_HARDWARE, RS485_DEFAULT_TX_PIN, RS845_DEFAULT_DE_PIN, RS845_DEFAULT_RE_PIN);
^
D:\orcad\spb_data\.platformio\lib\ArduinoRS485_ID5814\src\RS485.h:36:30: error: 'A5' was not declared in this scope
#define RS845_DEFAULT_RE_PIN A5
^
D:\orcad\spb_data\.platformio\lib\ArduinoRS485_ID5814\src\RS485.cpp:169:84: note: in expansion of macro 'RS845_DEFAULT_RE_PIN'
RS485Class RS485(SERIAL_PORT_HARDWARE, RS485_DEFAULT_TX_PIN, RS845_DEFAULT_DE_PIN, RS845_DEFAULT_RE_PIN);
^
Searching google for 'SERIAL_PORT_HARDWARE', found a: #define SERIAL_PORT_HARDWARE Serial1
but that makes no sense !!


TEST2:
i install the example: "5902/esp32ModbusTCP"
and again, only including the 3 #include files out of the example in my "Modbus_KE.cpp header":
#include <Arduino.h>
#include <WiFi.h>
#include <ModbusTCP.h>
=> error "ModbusTCP.h" not found ( and really it is NOT on my PC ! )


Everytime i'm installing another lib inside platformio ( PIO Home -> libraries )
i will get different errors.
I think there are some libs missmatched in the deep ?

Is there any way to solve this ???
Please help


By the way:
I need a ModbusServer example that uses also Ethernet and WiFi on a ESP32-EVB board ( or hardware: ESP32-WROOM-32 ).
It reads inside ESP32 board 10 Hz CAN-values and transmit it over Modbus-protocol Ethernet and/or Wifi to an external PC.


Greetings Wolfgang

Who is online

Users browsing this forum: No registered users and 96 guests