Closed fredrik-jansson-se closed 7 months ago
I have tried client.socket.setRTS(True)
before the read_holding_registers
call, but no difference.
You need to find out how pyserial sets that flag and then modify the corresponding call to pymodbus.
We use pyserial so we do not call the device directly, hence the socket is a pyserial object.
Ok, thanks, I'll see what I can come up with!
Closing as this is not really pymodbus bug. If you find a missing parameter, feel free to reopen or even better make a pull request.
Thank you. I got it to work, I'll add the code below as reference in case someone else has this issue.
Not sure if this could be integrated into pymodbus in a good way.
client=ModbusSerialClient(port = "dev/ttymxc2", baudate = 9600)
ser = serial.rs485.RS485(port='/dev/ttymxc2', baudrate=9600)
ser.rs485_mode = serial.rs485.RS485Settings(rts_level_for_tx=False, rts_level_for_rx=True, delay_before_tx=0.001)
client.socket = ser
I'm trying to replicate this call:
I believe the
-F
flag (RS-485 mode (/RTS on (0) when sending)
) is what I can't figure out how to enable in pymodbus.The code:
And I get this output:
Similar to what I get if I skip the
-F
flag to mbpollAny idea on how to set RTS during send?