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

RTS signals are misaligned to Modbus COM port packets when using the RaspberryPi

  • raydodo

    raydodo - 2022-08-24


    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 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


    and also /boot/config.txt


    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


  • raydodo

    raydodo - 2022-09-05

    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


Log in to post a comment.