I'm working with MODBUS interface, based on a usb dongle which converts usb to RS485, then, in my board the rs485 half duplex is passed to max3362, as shownenter image description here.

The data is passed to NXP K64 controller. My problem is that at the end of the modbus package the CPU is sending there's sometime an extra byte which causes the receiver to show an error. For example: This is the data the controller should be sending to the host: 0B 03 02 0F FF 65 F5. The bold 65 F5 is the crc.

Instead, sometime, it sends: 0B 03 02 0F FF 65 F5 C0

So, apparently, there an extra byte C0, which causes an error at the host side. I've tried with various USB dongles, at some, it seems ok, at some, it seems there's an error. I do not know what is the cause of the error, is it the board, FW, or dongle? Any ideas? I'm really stuck here.

  • \$\begingroup\$ Is this a request or response? I don't know much about modbus, but feeding the data to some tools they want a request to be 8 bytes and a response to be 7 bytes long. \$\endgroup\$ – PlasmaHH Apr 24 '17 at 12:39
  • \$\begingroup\$ This is the response. Instead 7 byte long, I'm getting 8 bytes. \$\endgroup\$ – roy.me Apr 24 '17 at 13:10
  • \$\begingroup\$ Did you resolve your previous question: electronics.stackexchange.com/questions/296438/… \$\endgroup\$ – Andy aka Apr 24 '17 at 13:13
  • \$\begingroup\$ Yes, it was a problem of using an active probe... I've forgot to update. Just did. Sorry for late reply. \$\endgroup\$ – roy.me Apr 24 '17 at 13:28

Ok, I've found the answer. I'm using the libmodbus library. I've used the flush buffer function in that library and ot solved the problem.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.