0

I am using freemodbus library for the stm32 modbus TCP client example. But I want to learn how to protech modbus tcp message on the line.

For example Master wants to read 5th holding register from slave, its value 100 but something happenened on the physical line slave send 105 value to Master. This data sends wrong.

How to tell if this message was sent and received correctly. I know there is no CRC-Checksum field in the Modbus frame but is there any way to add it to verify?

1 Answer 1

0

I know there is no CRC-Checksum field in the Modbus frame but is there any way to add it to verify?

No, there is no way to add such a field. But Modbus TCP already has a 16 bit CRC and since Modbus TCP sits on on top of TCP it implicitly uses this checksum too.

3
  • Thank you for your reply, So After 3-way hand shaking, when I send "10" to Master from slave, but physical line corrupted data and somehow became "15" at the line. Is TCP detect this ? How does this process work?
    – hobik
    Feb 25, 2021 at 6:57
  • @hobik: Checksum is added by the sender system and checked by the receiver system. If checksum fails the packet is discarded and due to how TCP works it will be resubmitted. The whole process is transparent to the application. For the technical details see en.wikipedia.org/wiki/… Feb 25, 2021 at 7:30
  • Thank you for your help
    – hobik
    Feb 25, 2021 at 7:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .