CRC error, rc = modbus_read_registers returns -1 .. etc ..

53 views
Skip to first unread message

Astrid Lindstedt

unread,
Mar 21, 2022, 9:40:22 AM3/21/22
to libmodbus
Dear libmodbus community, 

I am trying to configure a libmodbus rtu with rts: 

Screenshot from 2022-03-21 14-37-48.png

These are the printouts of the terminal: 


Opening /dev/verdin-uart1 at 19200 bauds (E, 8, 1)
Bytes flushed (0)
[3C][03][00][00][00][01][80][E7]
Sending request using RTS signal
Waiting for a confirmation...
<00><3C><03><00><00>
ERROR CRC received 0x0 != CRC calculated 0x20C1
 Value of rc = modbus_read_registers  -1
something failed: Invalid CRC
reg[0]=4 (0x4)
reg[1]=0 (0x0)
reg[2]=0 (0x0)
reg[3]=0 (0x0)
reg[4]=2016 (0x7E0)
reg[5]=52334 (0xCC6E)
reg[6]=43690 (0xAAAA)
reg[7]=0 (0x0)

When I measure the RX signal:

rx.png

Hence, 0x02 is the number of bits and  <00><3C> is the ones I am interested in and D590 is the CRC, not 0x20C1. Why do I get rc = modbus_read_registers  -1, how could I access the <00><3C> values that are printed in the terminal? 


Thanks for your support, 
Reply all
Reply to author
Forward
0 new messages