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

Problem with MODBUS RTU Serial Port

  • ltrinta - 2022-04-06

    Hello there

    I have a problem with Modbus RTU usage. My hardware is a custom board raspberry pi cm4 based and serial works with generic python code but with codesys the SerialPort at Modbus_COM stays "Not running".

    I configured /etc/CODESYSControl.cfg and /etc/CODESYSControl_User.cfg with:

    [SysCom]Linux.Devicefile=/dev/ttyS or [SysCom]Linux.Devicefile=/dev/ttyAMA
    I added the portnum := COM.SysCom.SYS_COMPORT1; line too.

    but neither of them works.

    The config of Modbus_COM is:

    [-img src=Modbus Config.PNG width=50%: missing =-]

    At tree:

    [-img src=Modbus Tree.PNG width=50%: missing =-]

    The status:

    [-img src=Modbus Status.PNG width=50%: missing =-]

    Can anyone help me? Is urgent.


  • eschwellinger

    eschwellinger - 2022-04-07

    green curcle at comport indicates that comopen works - so check wiring/baudrate to the slave
    you could even add 'Modbus_Master_com_Port'to the watchlist ( the name of the instance in the device tree) to get more diagnostic info

    • ltrinta - 2022-04-07

      hello there

      thank you for your reply.

      I checked it. With simple python code I can communicate normally. But with Codesys no. I found it strange because despite green circle the SerialPort Status are "not running" like not was open. So I think it might be related with some configuration of serial on Codesys files but I make all of I found to make and not works.

      do you have any more ideas?


      • ltrinta - 2022-04-07

        Hello there.

        I fixed the problem removing all SysCom configuration at /etc/CODESYSControl.cfg and removing the "portnum := COM.SysCom.SYS_COMPORT1;" at /etc/CODESYSControl_User.cfg remaining just "[SysCom]Linux.Devicefile=/dev/ttyS" at /etc/CODESYSControl_User.cfg

        Thank you for your help.


        • bossjosh21 - 2023-02-27

          Hello sir I have the same problem with codesys how do you manage to troubleshoot the problem. And what is that Syscom configuration are you saying. Hopefully you see my message. Im using Revolution Pi RevPi Connects.

  • eschwellinger

    eschwellinger - 2023-02-28

    Example for doing this ( I assume you have connected a USB serial device for this example)



    Last edit: eschwellinger 2023-02-28

Log in to post a comment.