I'm trying to use pymodbus with the UART on the RPi 4B with a half duplex RS485 chip that needs nRE/DE input to correctly drive/receive over half duplex comms. I have been trying to set RS485 mode into the serial port opened and found this existing issue where someone else had the same problem
This is confounded by a bug on the RPi/with pyserial that causes the UART to be pernickity about how it is configured.
I'd like to change the RS485 mode on the serial port created by pymodbus, but instead it seems I need to swap the whole serial port out.
It seems that it would be sensible for pymodbus to open an RS485 serial port, rather than a plain RS232 UART.
BONUS would be to allow users to configure the RS485 port directly through PyModbus.
Code and Logs
I have tried to configure RS485 settings on the serial port after connection like this:
Versions
Pymodbus Specific
Description
I'm trying to use pymodbus with the UART on the RPi 4B with a half duplex RS485 chip that needs nRE/DE input to correctly drive/receive over half duplex comms. I have been trying to set RS485 mode into the serial port opened and found this existing issue where someone else had the same problem
This is confounded by a bug on the RPi/with pyserial that causes the UART to be pernickity about how it is configured.
I'd like to change the RS485 mode on the serial port created by pymodbus, but instead it seems I need to swap the whole serial port out.
It seems that it would be sensible for pymodbus to open an RS485 serial port, rather than a plain RS232 UART.
BONUS would be to allow users to configure the RS485 port directly through PyModbus.
Code and Logs
I have tried to configure RS485 settings on the serial port after connection like this:
But I hit the bug mentioned above (https://github.com/raspberrypi/linux/issues/6189)
Proposed change. https://github.com/pymodbus-dev/pymodbus/blob/dev/pymodbus/transport/serialtransport.py#L23 Before:
After: