Unable to run TCP Slave Modbus example in v2.0

AndreaS73
Posts: 23
Joined: Tue Jan 16, 2024 8:16 am

Unable to run TCP Slave Modbus example in v2.0

Postby AndreaS73 » Mon Feb 10, 2025 9:39 am

When I've update my dependencies the ESP Modbus component was upgraded to v2.0.
I got errors in the code and looking at the source code I was able to fix them, but at run-time my modbus client did not work anymore (i.e. it does not process the incoming requests).

Hence I compiled the official example: https://github.com/espressif/esp-modbus ... _tcp_slave but it also this does not answer to the modbus requests.
It continues to print this:

Code: Select all

D (36640) mb_port.tcp.slave: loop:0x3fcb6710  mbs_on_timeout: fd: -1
D (36910) mb_driver: 0x3fcb6710, fd event get: 0x100:-1, |MB_EVENT_TIMEOUT
D (36910) event: running post loop:0x3fcb6710:256 with handler 0x4200d488 and context 0x3fcb8574 on loop 0x3fcb6adc
--- 0x4200d488: mbs_on_timeout at /home/andrea/myapp/managed_components/espressif__esp-modbus/modbus/mb_ports/tcp/port_tcp_slave.c:595
Compiling the example from the previous version 1.x it works again.
Was anyone able to run the example from version 2.0?

ahsrabrifat
Posts: 56
Joined: Sat Jan 18, 2025 2:31 pm

Re: Unable to run TCP Slave Modbus example in v2.0

Postby ahsrabrifat » Mon Feb 10, 2025 2:33 pm

If possible, try running the v2.0 example with an older ESP-IDF version. Sometimes, ESP-IDF updates introduce changes that affect component behavior.

AndreaS73
Posts: 23
Joined: Tue Jan 16, 2024 8:16 am

Re: Unable to run TCP Slave Modbus example in v2.0

Postby AndreaS73 » Mon Feb 10, 2025 9:07 pm

ahsrabrifat wrote:
Mon Feb 10, 2025 2:33 pm
If possible, try running the v2.0 example with an older ESP-IDF version. Sometimes, ESP-IDF updates introduce changes that affect component behavior.
I might give it a try but I need to use v5.4.
Anyway, both ESP-IDF and ESP Modbus come from espressif: it's odd their own code does not work.
Furthermore they recommend to not use v1.x anymore.

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

Re: Unable to run TCP Slave Modbus example in v2.0

Postby ESP_alisitsyn » Tue Feb 11, 2025 11:42 am

I got errors in the code and looking at the source code I was able to fix them, but at run-time my modbus client did not work anymore (i.e. it does not process the incoming requests).
The esp-modbus v2 latest is verified and tested and can work with the esp-idf starting from v5.0. There still many update MRs that are in the progress but it should work. The messages below do not describe your issue correctly. Please take a look to your code again, try to read documentation https://docs.espressif.com/projects/esp ... us-library and use examples https://github.com/espressif/esp-modbus ... n/examples.
If the issue still exists, please report it https://github.com/espressif/esp-modbus/labels/v2.0.1 with extended information.

Thank you for understanding.

AndreaS73
Posts: 23
Joined: Tue Jan 16, 2024 8:16 am

Re: Unable to run TCP Slave Modbus example in v2.0

Postby AndreaS73 » Tue Feb 11, 2025 11:47 am

I'm not sure to understand. I didn't change anything to the default example of v2.
Actually, I created an issue on github but it is not visibile (yet another flagged account issue...).

The messages I reported are the real ones I see in the output window of CSV using ESP Modbus 2.0.1~1 and ESP-IDF v5.4.

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

Re: Unable to run TCP Slave Modbus example in v2.0

Postby ESP_alisitsyn » Tue Feb 11, 2025 12:48 pm

AndreaS73 wrote:
Tue Feb 11, 2025 11:47 am
I'm not sure to understand. I didn't change anything to the default example of v2.
Actually, I created an issue on github but it is not visible (yet another flagged account issue...).

The messages I reported are the real ones I see in the output window of CSV using ESP Modbus 2.0.1~1 and ESP-IDF v5.4.
It continues to print this:
There is nothing wrong in the messages above. These are debug messages and mean that your slave is waiting for incoming events but they do not come. This can be due to incorrect configuration of the stack or network connection issues. Your slave just does not get the messages from master if any. You can change the debug verbosity to info to avoid them. Please try again to report issue here: `https://github.com/espressif/esp-modbus/issues`. and refer to the section https://docs.espressif.com/projects/esp ... on-options for master configuration.

Who is online

Users browsing this forum: Bing [Bot], plater and 81 guests