ESP-IDF Modbus Slave Implementation

kay_zala
Posts: 1
Joined: Fri Aug 18, 2023 11:11 am

ESP-IDF Modbus Slave Implementation

Postby kay_zala » Fri Aug 18, 2023 11:18 am

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

ESP_alisitsyn
Posts: 211
Joined: Fri Feb 01, 2019 4:02 pm
Contact:

Re: ESP-IDF Modbus Slave Implementation

Postby ESP_alisitsyn » Mon Aug 28, 2023 7:59 am

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
Attachments
Modbus_slave_areas.zip
Modbus slave configuration files in archive
(3.85 KiB) Downloaded 396 times
modbus_slave.png.png
Slave Options
modbus_slave.png.png (80.53 KiB) Viewed 850 times
Last edited by ESP_alisitsyn on Mon Aug 28, 2023 8:07 am, edited 2 times in total.

Who is online

Users browsing this forum: amiral and 82 guests