Page 1 of 1

ESP-IDF Modbus Slave Implementation

Posted: Fri Aug 18, 2023 11:18 am
by kay_zala
Hey Everyone,

I am utilizing the modbus master example in esp-idf on esp32. The code is flashing perfectly and running as well. I want to simulate a slave on my PC using 3rd party Modbus slaves.

But I cannot figure out the structure that would work. Based on my understanding of the code, I tried making changes to the Coils, Inputs and Holding registers as well but have not been able to simulate it. i.e. my master times out.

P.S. Based on research online I have already increased the timeout, but it still does not work

Is there any documentation about the structure that should be used?

PPS I do not have another esp32 and neither do I want buy another one just for testing this.

TIA

Re: ESP-IDF Modbus Slave Implementation

Posted: Mon Aug 28, 2023 7:59 am
by ESP_alisitsyn
Hi @kay_zala,

You can use the Modbus Slave tool from here as an example: https://www.modbustools.com/modbus_slave.html

1. Setup your RS485 interface if you use ASCII or RTU mode.
https://github.com/espressif/esp-idf/tr ... echo_rs485
https://github.com/espressif/esp-idf/tr ... -required-
2. Install and setup the Modbus Slave software then open the Modbus Slave configuration files from `Modbus_slave_areas.zip`.
3. Start connection and start your Modbus master application. The master should be able to read and write Holding registers and read Coils, Input Registers.
4. Make sure your register areas in the master are configured appropriately.
https://docs.espressif.com/projects/esp ... ata-access