Enable more than one COM port in raspberry for more modbus channels with USB

  • francoinf

    francoinf - 2019-10-09

    what I want to do in a project is to communicate with modbus devices through more than one channel, to be connected to the raspberry's USB ports. Some devices will connect them to the first channel, others to the second, others to the third, etc.
    I know the procedure to enable only one channel, writing the following code in the file "/ect/CODESYSControl.cfg":

    [SysCom]Linux.Devicefile = / dev / ttyUSBportnum: = COM.SysCom.SYS_COMPORT1;

    in this way, I enable the COM 1 port, via USB, to communicate with my modbus devices (and everything works correctly).

    If, on the other hand, you want to enable more than one COM port (for example the COM 1 and COM 2 ports simultaneously), what should I write in the CODESYSControl.cfg file?

    Thanks in advance

  • eschwellinger

    eschwellinger - 2019-10-09

    since 3.5SP15 it is possible that way:

    set this in /etc/CODESYSControl_User.cfg

    so Com1 is ttyS0 Com4 is ttyUSB0

    in versions <SP15 it was needed to set symlinks / or use UDEV to sort them into the same the device under Linux.


  • francoinf

    francoinf - 2019-10-10

    Hi Edwin,
    thanks for the reply. Only the COM1 port works if in the file /etc/CODESYSControl.cfg (and not in the file /etc/CODESYSControl_User.cfg) I write:

    portnum := COM.SysCom.SYS_COMPORT1;

    What I wrote (which does not work) is, in the file /etc/CODESYSControl_User.cfg the following code:


    with the aim of enabling the COM1 port in the USB1 port of the raspberry, and the COM2 port in the USB2 port of the raspberry (I suppose USB0 is the first USB port, USB1 the second, USB2 the third and USB3 the fourth of the raspberry).
    I tried to write the same code as above also in the file /etc/CODESYSControl.cfg and nothing.
    What can be the cause of the malfunction?

  • francoinf

    francoinf - 2019-10-10

    NOTE: I use CODESYS v3.5 SP15

  • esih

    esih - 2020-02-06

    Having the same issue as OP ... Any ideas?

  • esih

    esih - 2020-02-07

    Nevermind, i found a solution in another topic l viewtopic.php?f=23&t=6247&start=30 l


Log in to post a comment.