FreeModbus TCP + LWIP + FreeRTOS issue

Just wondering if anyone has successfully implemented an embedded Modbus server using FreeModbus TCP + LWIP + FreeRTOS?
I am able to establish a TCP/IP connection (over port 502) to the embedded FreeModbus TCP server stack however I run into a perplexing crash
when I try to process a simple get slave ID command to the server from a Windows Modbus client test app.
The Modbus command appears well formed when viewed via Wireshark.
The target processor is an STM32F429 on a test Nucleo dev board.

Thanks
 
Modbus/TCP doesn't have a slave ID. Only serial line Modbus has a slave ID. There is a Unit ID field in Modbus/TCP, but this is not quite the same and is typically only used by Modbus routers when routing the packet to a Modbus RTU or Modbus ASCII serial line.

What Modbus command are you sending exactly? Is it Function Code 17 (0x11) Report Server ID (which is for Serial Line only)?

Do other commands succeed, such as Function Code 03 (0x03) Read Holding Registers?
 
Thanks for the reply.
Being new to Modbus, I did not realize that the slave ID is ambiguous in Modbus TCP.
However, I see the same problem if I issue any command such as Read Holding Registers (0x03).

Thanks
 
Well, for what it's worth, it seems you're not the first to have a problem like this:
https://community.st.com/s/question/0D50X0000AhO13O/freertos-lwip-freemodbus-tcp-hanging

As suggested in that forum, are you able to debug the issue to determine what leads up to the crash and what exactly the crash even is (i.e. processor exception, etc.)?

There are many people and companies using LWIP and FreeRTOS from personal projects to commercial products. It's unlikely either of those are the cause of your issue. It's much more likely to be a bug in the code you've written or assumptions you've made. Any additional details and information you can provide would help in assisting you.
 
Top