barney74_au
Hi, 
 
I am attempting to use OpenPLC on a Raspberry Pi 4B to work as a interposing relay of sorts between two Modbus Slave devices. Specifically I am trying to control a specific holding register on a Modbus TCP slave based on the status of another holding register on a Modbus RTU (RS485) slave.
 
Is it possible to simultaneously communicate with a Modbus TCP slave and a Modbus RTU slave using OpenPLC given that I will need to connect to the RS485 using the GPIO pins on the Raspberry Pi? I have read on this forum elsewhere that access to the GPIO pins was restricted by the hardware driver when using Modbus TCP so that GPIO was not available but I may have misinterpreted this. 
 
Further to this, if I wanted to add additional IO to the Raspberry Pi using the GPIO pins, what limitations will there be if simultaneously using the Modbus Slave IO as mentioned above. 
 
I hope this makes sense but please feel free to ask for further clarification if my explanation is not clear enough. 
 
Thanks in advance for any advice provided, 
 
Marcel 
Reply 1 0
thiagoralves
Yes, you can communicate with both slaves at the same time. Perhaps the easiest approach would be to use a usb to 485 adapter, so you don’t have to use GPIO pins. If you want to use the GPIO pins, you will have to disable the Raspberry Pi hardware layer (use blank instead) on the OpenPLC hardware tab to free up the Rx/Tx pins for the serial communication. Another option is to edit the source code of the raspberry pi hardware layer at /webserver/core/hardware_layers/ to omit pins 8 and 10
 
As for Modbus TCP it does not interfere at all with GPIO as it uses only the network ports (or WiFi).
Reply 2 0
barney74_au
Thank-you for your prompt reply. I had not considered using a USB to RS485 converter so thank-you. 
 
I will need to use GPIO pins for local IO so the alternative is modifying the hardware layer as you also suggested. 
 
At least I have options now so thanks again... 
Reply 1 0
Reply