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

How to connect serial devices ?

<< < 1 .. 4 5 6 (Page 6 of 6)
  • TPTSys

    TPTSys - 2021-03-20

    One problem I ran into was that once a port was opened, if i unplugged the arduino and plugged it back in, it might create a new device rather than reconnecting. Then codesys was out of sync with the device port number... to avoid this, need to close the port..

    • f-und-e

      f-und-e - 2021-03-22

      Oh that is interesting, thank you for that information. The weird thing is, that this problem still exists after loading a completely new program...

  • steve

    steve - 2022-01-25



    Last edit: steve 2022-02-02
    • steve

      steve - 2022-01-31



      Last edit: steve 2022-02-02
  • deppee

    deppee - 2022-03-26


    I'm following the example project from Edwin and I'm having an issue with the communication. I'm using a raspberry pi connected to a motor controller via USB Serial port ttyACM0. I'm trying to send a string of G-Code such as "G1 X10".

    I added the following to my CODESYSControl.cfg
    portnum := COM.SysCom.SYS_COMPORT1;

    I have verified the communication by sending the command in the terminal.

    Do I need to set up a ModbusCom device?

    I'm very new to Codesys, so any help is appreciated!


  • Reinier Geers

    Reinier Geers - 2022-04-19

    Hi, Anyone knows how to read a Smartmeter. I connected to my RS232 port but don't recieve any data. So maybe i have to use USB. When i look here i have to change Codesyscontrol.cfg. I tried to copy it back to my pc. But then is get File is not valid. But i see it in codesys

  • man2002

    man2002 - 2022-06-23

    Hi Edwin,

    I am having the same problem as Nosi described in an earlier post. I constantly get zeros in the read buffer when attempting to read from the COM port after making the changes below to the /etc/CODESYSControl_User.cfg file

    • [SysCom]
      Linux.Devicefile.1=/dev/ttyACM0 - this is communication port for the motorcontroller (Octopus Pro controller).

    I am able to successfully write from Codesys (V3.5 SP17 Patch 3) to the motor controller, but reading from MC is proving to be a challenge. I can read data from the COM port in Linux when I apply the commands below but not in Codesys.

    • stty -F /dev/ttyACM0 115200
    • stty -F /dev/ttyACM0 raw
    • cat /dev/ttyACM0

    Please help.


  • eschwellinger

    eschwellinger - 2022-06-24

    Is it a RS485 adapter - if so, keep in mind that CODESYS do not control the send direction -
    this must be supported by the hardware (your adapter).
    If you are using RS232 - no clue whats going wrong.

  • oleanderkiro

    oleanderkiro - 2023-01-20

    I want to control a model railway via usb (NEM451).
    So I wanted to use your program. I can connect the interface directly to 1 of the 4 usb-ports.
    If I try to search the USB-Port I receive:
    Bus 001 Device 004: ID 28a0:1185 USB OPTICAL MOUSE
    Bus 001 Device 005: ID 1c4f:0016 SiGma Micro USB Keyboard
    Bus 001 Device 006: ID 0424:7800 Microchip Technology, Inc. (formerly SMSC)
    Bus 001 Device 003: ID 0424:2514 Microchip Technology, Inc. (formerly SMSC) USB 2.0 Hub
    Bus 001 Device 002: ID 0424:2514 Microchip Technology, Inc. (formerly SMSC) USB 2.0 Hub
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    but not a tty-port ?

  • eschwellinger

    eschwellinger - 2023-01-21

    check with 'dmesg'

  • oleanderkiro

    oleanderkiro - 2023-01-24

    I receive a long list, what shell I receive ?
    With "lsusb" I receive: "Bus 001 Device 007: ID 0403:6001 Future Technology Devices International, Ltd FT232 Serial (UART) IC"
    I want to acces on this port. With lsusb -vs I receive :
    "idVendor 0x0403 Future Technology Devices International, Ltd
    idProduct 0x6001 FT232 Serial (UART) IC
    bcdDevice 6.00
    iManufacturer 1 FTDI
    iProduct 2 FT232R USB UART
    iSerial 3 AB0JV1PJ"
    How can I reach a success ?

  • eschwellinger

    eschwellinger - 2023-01-25

    dmesg | grep -i tty

  • oleanderkiro

    oleanderkiro - 2023-01-26

    I receive:"[ 0.000000] Kernel command line: coherent_pool=1M 8250.nr_uarts=1 snd_bcm2835 .enable_compat_alsa=0 snd_bcm2835.enable_hdmi=1 bcm2708_fb.fbwidth=800 bcm2708_f b.fbheight=600 bcm2708_fb.fbswap=1 vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x 40000000 console=ttyS0,115200 console=tty1 root=PARTUUID=eb299098-02 rootfstype =ext4 fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles
    [ 0.000475] printk: console [tty1] enabled
    [ 2.931350] 3f201000.serial: ttyAMA0 at MMIO 0x3f201000 (irq = 114, base_baud = 0) is a PL011 rev2
    [ 2.934089] printk: console [ttyS0] disabled
    [ 2.934217] 3f215040.serial: ttyS0 at MMIO 0x3f215040 (irq = 86, base_baud = 50000000) is a 16550
    [ 2.934482] printk: console [ttyS0] enabled
    [ 10.430930] systemd[1]: Created slice system-getty.slice.
    [ 10.434094] systemd[1]: Created slice system-serial\x2dgetty.slice."

    /dev $ ls tty*
    tty tty10 tty13 tty16 tty19 tty21 tty24 tty27 tty3 tty32 tty35 tty38 tty40 tty43 tty46 tty49 tty51 tty54 tty57 tty6 tty62 tty8 ttyprintk
    tty0 tty11 tty14 tty17 tty2 tty22 tty25 tty28 tty30 tty33 tty36 tty39 tty41 tty44 tty47 tty5 tty52 tty55 tty58 tty60 tty63 tty9 ttyS0
    tty1 tty12 tty15 tty18 tty20 tty23 tty26 tty29 tty31 tty34 tty37 tty4 tty42 tty45 tty48 tty50 tty53 tty56 tty59 tty61 tty7 ttyAMA0
    Is the interface ttyAMA0 ?

<< < 1 .. 4 5 6 (Page 6 of 6)

Log in to post a comment.