Closed hallard closed 6 years ago
I think that should be possible.
In case you need this in a Modbus RTU server you could extend umodbus.server.serial.RTUServer and override serve_once() with an implementation that toggles a GPIO pin.
For a Modbus RTU client you could reimplement send_message() yourself and add the GPIO handling.
Thanks for your quick answer, I'll check that needed
Hi There, On some RS485 hardware, sometimes, the DE/RE pins are tied together to a GPIO pin. In this case we need to drive the GPIO pin in the driver when sending/receiving.
Plenty of example here: https://github.com/madleech/Auto485 https://github.com/swarkn/MAX485 https://github.com/andresarmento/modbus-arduino
Sample Code of libraries are really simple, they check if we defined pin for RE/DE, and if so, setup the pin to High before each write on serial. After write, we flush serial, then wait protocol delay (t35 or t15 depending on speed) and then set back pin to Low.
Do you think it's do able simply in your library ?
Simple driver example works like that
Thanks