Multiple USB devices different COMPORTs

pdoubleu
2019-04-05
2019-04-10
  • pdoubleu - 2019-04-05

    Hi everyone,

    Unfortunately I havent found anything regarding my question using the search function.

    Here is my question:

    I want to connect 4 serial devices to the 4 USB ports on Raspi. All 4 devices are exactely the same (Roboclaw motor controller).
    Using udev rules I am able to give all of them reproducable names, even if I disconnect and reconnect them, so thats all fine.

    To use the serial USB in codesys I know that I need to add the following lines to CODESYSControl_User.cfg:

    [SysCom]
    Linux.Devicefile=/dev/ttyUSB
    portnum:=COM.SysCom.SYS_COMPORT1

    After this I am able to control the devices vial the CAA serial library.

    My question is now if there is a way to assign each Motorcontroller to a specific comport, so that I can decide which motorcontroller to "speak" without sending every command to each motor?

    Thank for any help!

     
  • eschwellinger

    eschwellinger - 2019-04-06

    Hi,

    hm if you have added ttyUSB in the config file you could access
    the serial com's in CODESYS
    Com1,Com2,Com3... that is the way it works.
    Maybe I do no really understand it, please explain .

    BR
    Edwin

     
  • tsimpson - 2019-04-07

    Also take a look at the reply I gave yesterday to how to "connect serial devices" thread. I encountered the same thing and think I found and documented a solution yesterday.

    Cheers,
    Todd

    Note: to moderator: Maybe, seeing this, the reply I wrote would be better put here.

     
  • Moderator3S

    Moderator3S - 2019-04-08

    Hi Todd,
    thank you for sharing this:
    l viewtopic.php?f=21&t=5699&start=90#p24170 l

    We will add this to the Raspberry PI Application section too. ( Just as information how to do it)
    Moderator

     
  • pdoubleu - 2019-04-10

    Thanks, that totally answers my question and works also!

     

Log in to post a comment.