Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched.
Close
Hopefully this is the correct place to post this technical question - if not, please move it!
I am using a RaspberryPi 3 B v1.2 with Codesys V3.5 SP17 Patch 3+ (32 bit) and Raspberry Pi package 4.5.0.0. I have Modbus set up as shown in the attached image "Modbus tree.png". The COM is set up as port 1, 115200, NONE, 8, 2. Protocol is RTU. The slave is connected at address 7 and is set to read 16 holding registers every 100ms. We are using the Pi with Modbus to control 3 types of devices in sequence; two are UARTs, the third is RS485. The RS485 device needs the RTS signal to operate. I have tested that the device is working correctly on receives. I am using PL011 UART by setting /etc/CODESYSControl.cfg
This puts the RTS signal on GPIO17 (pin 11) and CTS on GPIO16 (pin 36).
The problem is that the RTS signal is completely out of synchronisation with the data. See "RTS misaligned.png". The red trace shows RTS going high and low around 500ms out of sync from the data. The pulse width of the RTS signal is correct for the length of data.
Does anyone have any idea why this is happening and how it can be corrected please?
Reviewing this on the Raspberry PI forums, I can see that others have successfully activated the RTS and CTS using raspberry pi model 3B, and not had the misalignment issue. This makes me think it is something to do with the Codesys implementation. Does anyone have any ideas?
Thanks in advance
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi
Hopefully this is the correct place to post this technical question - if not, please move it!
I am using a RaspberryPi 3 B v1.2 with Codesys V3.5 SP17 Patch 3+ (32 bit) and Raspberry Pi package 4.5.0.0. I have Modbus set up as shown in the attached image "Modbus tree.png". The COM is set up as port 1, 115200, NONE, 8, 2. Protocol is RTU. The slave is connected at address 7 and is set to read 16 holding registers every 100ms. We are using the Pi with Modbus to control 3 types of devices in sequence; two are UARTs, the third is RS485. The RS485 device needs the RTS signal to operate. I have tested that the device is working correctly on receives. I am using PL011 UART by setting /etc/CODESYSControl.cfg
[SysCom]
Linux.Devicefile=/dev/ttyUSB
and also /boot/config.txt
[all]
enable_uart=1
dtoverlay=disable-bt
dtoverlay=uart-ctsrts
The overlay for the CTS RTS is from https://github.com/HiassofT/AtariSIO/tree/master/contrib/rpi (much thanks to Hiass)
This puts the RTS signal on GPIO17 (pin 11) and CTS on GPIO16 (pin 36).
The problem is that the RTS signal is completely out of synchronisation with the data. See "RTS misaligned.png". The red trace shows RTS going high and low around 500ms out of sync from the data. The pulse width of the RTS signal is correct for the length of data.
Does anyone have any idea why this is happening and how it can be corrected please?
Thanks and regards
Ray
Reviewing this on the Raspberry PI forums, I can see that others have successfully activated the RTS and CTS using raspberry pi model 3B, and not had the misalignment issue. This makes me think it is something to do with the Codesys implementation. Does anyone have any ideas?
Thanks in advance