ArduinoModbusSlave icon indicating copy to clipboard operation
ArduinoModbusSlave copied to clipboard

Is it possible to use in ESP32 Platform.

Open coderkan opened this issue 5 years ago • 14 comments

Hi there,

I wonder that can I use this library on ESP32 module? Have you ever tried that?

Regards. Erkan

coderkan avatar Aug 28 '20 07:08 coderkan

Hi, thanks for the question/

I don't know, if you make it work comment here. Matve this repo is better starting point: https://github.com/yaacov/ArduinoModbusSlaveTCP

yaacov avatar Aug 30 '20 08:08 yaacov

Hi @yaacov ,

I tried to use in ESP32 kit but I have no success at this point. I focused on Serial RTU. I will try again later. If It would work, I will comment you.

Regards. Erkan

coderkan avatar Sep 08 '20 18:09 coderkan

Ler me know if someone have sucsess with this. im also srugling to get the RTU slave to Work on my ESP32

Bach-Danielsson avatar Sep 24 '20 19:09 Bach-Danielsson

Hi @Bach-Danielsson

I have not success to run this code in ESP32.

I have found a library on github. But I have come across problems to use this library. Please let me know if you find a good solution for rtu slave for esp32.

Regards. Erkan

coderkan avatar Sep 26 '20 16:09 coderkan

Hi,

I've tested the RTU-RS485 Client and with a few tweaks the code works like a charm with the ESP32dev Kit. I make a Pull Request after complete testing. (need a few days...)

Martin

device111 avatar Sep 13 '21 12:09 device111

esp32能用,但是0x03每次最多只能读50个,0x0f每次最多只能写50个

qq547176052 avatar Apr 12 '22 15:04 qq547176052

This is limited by Modbus protocol.

On Tue, 12 Apr 2022, 23:26 547176052, @.***> wrote:

esp32能用,但是0x03每次最多只能读50个,0x0f每次最多只能写50个

— Reply to this email directly, view it on GitHub https://github.com/yaacov/ArduinoModbusSlave/issues/65#issuecomment-1096874773, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABAFJN42DWD5WON7OQAURB3VEWI33ANCNFSM4QN2MQLA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

yoonghm avatar Apr 13 '22 00:04 yoonghm

that is not completely right. The Modbus protocol has a frame width of 256 bytes. (253 bytes for user data). We are currently only using 128 bytes here, according to the specifications of the ESP32 core. You can try changing the RX/TX buffer size.

In ModbusSlave.h change:

#if defined (ESP32) || defined (ESP8266) #define SERIAL_BUFFER_SIZE 256 #endif

and in your Setup Routine and BEVORE the Serial init:

SERIAL_PORT.setRxBufferSize(SERIAL_BUFFER_SIZE); SERIAL_PORT.setTxBufferSize(SERIAL_BUFFER_SIZE);

// Set the serial port and slave to the given baudrate. SERIAL_PORT.begin(SERIAL_BAUDRATE); slave.begin(SERIAL_BAUDRATE);

I don't know if that works with the Arduino 1.6 ESP Core, but it should work with the 2.02.

good luck...

device111 avatar Apr 13 '22 07:04 device111

#if defined (ESP32) || defined (ESP8266) #define SERIAL_BUFFER_SIZE 1024 #endif

我改到1024还是只能写 55 个

qq547176052 avatar Apr 17 '22 15:04 qq547176052

No Problem to read 125 Words of an 03 Register:

grafik

so your Master is not support more Register?

device111 avatar Apr 18 '22 06:04 device111

No Problem to read 125 Words of an 03 Register:

grafik

so your Master is not support more Register?

Can you tell me what software this is, thank you

dtboy1995 avatar Jul 03 '22 11:07 dtboy1995

grafik

device111 avatar Jul 04 '22 05:07 device111

grafik

thanks

dtboy1995 avatar Jul 04 '22 05:07 dtboy1995