I am connecting my slave via TCP/IP, everything looks fine by using the Wireshark software I can validate that the CRC checksum always valid “good”, but I am wondering how I can corrupt the CRC checksum so I can see like checksum “Invalid”. Any suggestion how can I get this done maybe python code or any other way if possible.
Thank you all Tariq
First off, be aware that Modbus TCP does not include any CRC, the error control is handled via the appropriate layer of the TCP protocol itself. See for instance this post: Can you keep a CRC in a Modbus TCP message?
If you want to play with Modbus RTU CRC errors you can take a look at MinimalModbus (Python) and its unit tests MiniMalModbus Unit Tests
If you prefer something easier you might want to take a look at ModbusPoll, where you can define a slave and simulate CRC errors (only for Modbus RTU, I think). There is a 30 day trial version.
As far as I know what you want to do is not possible out of the box with the other libraries I use: pymodbus and libmodbus but it should not be too difficult to write something similar to the MinimalModbus unit test yourself.