-
Notifications
You must be signed in to change notification settings - Fork 145
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
Checksum error in rtu mode #102
Comments
The expected response should be something like
Your response
Roundtrip time seems to be too short, should be milliseconds, not hundreds of microseconds. It seems to me that you are driving the DE signal of RS-485 incorrectly. |
Ok, thanks for the quick answer! I've changed the timout, but there seems to be no difference. |
|
It is probably out of the scope of this discussion. Please, try everything first with known good external USB/RS-485 converter and with known good modbus instrument. Learn something about RS-485 and how e.g. UART/RS-485 chips work may be also very beneficial. |
Just a thought....@MGGEL but I never specify baudrate, parity etc. and just use the bult-in defaults. You could try this to see if it helps:
|
You should first disable services using the E.g.
please search yourself. It is out of the scope of this library. |
i too got that error import minimalmodbus
import time
import serial
from time import sleep
instrument = minimalmodbus.Instrument('/dev/ttyS0',1)
instrument.debug = True
instrument.serial.timeout = 0.2
instrument.close_port_after_each_call = True
instrument.serial.bytesize = 8
instrument.serial.baudrate = 9600
#instrument.handle_local_echo=True
instrument.serial.stopbits = 1
instrument.serial.rtscts = True
instrument.serial.parity = serial.PARITY_NONE
instrument.mode = minimalmodbus.MODE_RTU
print(instrument)
while True:
try:
# modbus_data = instrument.read_registers(registeraddress=305, functioncode=3,number_of_registers=4 )
modbus_data = instrument.read_register(305,4)
print('mod',modbus_data)
except Exception as e:
print('her',e)
time.sleep(2)
|
khodepratik1 |
Hello again, l have the following system: raspberry pi zero 2W, Max485 and Huawei inverter. I try with minimalmodbus read a registers from inverter, but if I use the baudrate equal to 9600 and timeout equal to 1 the checksum error seems, but in Modbus Slave occurs but sometimes, Do you know why?. I appreciate your answer and help, if you need more information, I can provide. This occurs with Modbus Slave:
|
@TylerDurden997 can you provide additional info?
Why am I asking... Boards with automatic DE handling don't work in certain situations (swollow bits, artifical bytes) Boards with manual DE handling are tricky to handle correctly in linux from python. It must be done by software. We are using USB/RS485 in all our devices using linux now because of these problems. (USB chips have hardware TXDEN which is directly connected to the DE input of the RS485 transceiver. It is automatic, reliable and transparent to the software.) |
@j123b567 of course, this is the configuration in the PCB of MAX 485: |
Python is not good for precise timing. Do you have access to Osciloscope or logic analyzer so you can see real timing of request, PIN_CONTROL and response from your device? See also the documentation https://minimalmodbus.readthedocs.io/en/stable/serialcommunication.html |
I also got like similar error but i just try to read multiple registers from 0, 20 using
but got error:
but its only appear some time I just try to read registers every 1 seconds |
@Coder73-avi As mentioned several times, the problem is outside of the minimalmodbus library. If you have tried everything in the documentation and it still does not work, please describe your situation in detail.
|
Hi,
I've got an error when I try to select some bits or registers from a modbus slave.
The Response
Do you have any recomendations for analyzing the problem?
The text was updated successfully, but these errors were encountered: