-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invalid CRC #744
Comments
Correct. Welcome to the wonderful world of modbus. "30000" just means "registers" and 20000 and 40000 just mean "input registers" and "coils" it's kinda like "modbus_opration(3000x)" will automatically do a read_registers(x) and "modbus_operation(4000x)" will automatically do a "read_holding_registers(x)" libmodbus doesn't support the 30000 style, just the "full" style. |
How can I solve this problem and read these datas as I expected on top?Btw tried to start with 40001. I already wrote a code snippet which is working with termios but here too, the datas are not resolvable.
output: |
You simply don't. libmodbus (much as many other tools) simply doens't use the 300xx / 400xx addressing. If you want to read 30013, you do a "read regs 13" if you want 40013, you do a "read holding regs 13" (or vice versa, I never remember which is holding and which is input) |
Thank you @karlp for your comments. |
libmodbus version
3.1.10
OS and/or distribution
Ubuntu 22.04.4 Jammy release
Environment
Raspberry Pi 4B Arc
Description
Hello, I'm trying to connect and get datas from specific registers that is on a slave connected to raspbery pi from /dev/ttyUSB0 port. Connecting and opening port are okay but here is the problem whenever I tried to read registers which is starting 30001 and up to 30004 it says invalid crc. But if I start with 0 I got these different datas from expected
Actual behavior if applicable
int rc=modbus_read_registers(ctx,30001,3,tab_reg);
Opening /dev/ttyUSB0 at 9600 bauds (O, 8, 1)
[21][03][75][30][00][04][59][6A]
Sending request using RTS signal
Waiting for a confirmation...
<21><00><00><00><00>
ERROR CRC received 0x0 != CRC calculated 0x21CA
Invalid CRC
int rc=modbus_read_registers(ctx,0,3,tab_reg);
Opening /dev/ttyUSB0 at 9600 bauds (O, 8, 1)
[21][03][00][00][00][03][02][AB]
Sending request using RTS signal
Waiting for a confirmation...
<21><03><06><00><00><00><00><00><21><78>
reg[0]=0 (0x0)
reg[1]=0 (0x0)
reg[2]=33 (0x21)
reg[3]=0 (0x0)
Expected behavior or suggestion
Steps to reproduce the behavior (commands or source code)
libmodbus output with debug mode enabled
<...>
The text was updated successfully, but these errors were encountered: