Modbus RTU (serial port) does not work with new kernel version

suibaf
2016-08-07
2024-04-05
  • suibaf - 2016-08-07

    Hi,

    I have 2 raspberry Pi 2. On the first there si raspbian 4.1.19 - V7 + #858 and the last Codesis runtime 3.5.9.10. All work fine also communication with Modbus RTU with ttyAMA0.

    The second Raspberry Pi 2 has 4.4.13 -V7+ #888 kernel, last Codesys runtime 3.5.9.10. Same CODESYSControl.cfg file, same app. The Modbus RTU communication start, the slave answer and then stop to work. For test I tryed also a python library: minimalmodbus: same behavior. The communication start and then stop.

    Second your opinion, what is the problem with seriali port in the last Raspbian kernel? Is there addition configuration for serial port?
    BR
    Fabio

     
  • eschwellinger

    eschwellinger - 2016-08-08

    Hi,
    you need to check if the devices are available under /dev/ttyAMA0
    if you see them there, I could not really imagine what elso should fail then.
    Are you using udev ?
    If yes you Need to check: /etc/udev/rules.d/serial-symlinks.rules

    BR
    Edwin

     
  • eschwellinger

    eschwellinger - 2016-08-08

    Hi,
    yes sounds like this is your problem

    could you check how the OS register your device Login by ssh and type:

    dmesg | grep -i tty

    and as i understand you could give /dev/serial0 a try

    BR
    Edwin

     
  • suibaf - 2016-08-08

    Hi Edwin,

    I solved:

    http://raspberrypi.stackexchange.com/qu ... -on-my-pi3

    in particolar:

    Zitat:
    You may also need to disable the serial console. The easiest way to do this is via raspi-config under Advanced Options -> Enable/Disable shell and kernel messages on the serial connection.
    If you don't have raspi-config, it doesn't work, and/or you want to double check, first look in /boot/cmdline.txt. If you see:
    console=/dev/ttyS0,115200
    Or:
    console=/dev/serial0,115200
    Or anything involving console= that isn't console=tty1, remove it. Make sure not to accidentally add a line break to that file, it should remain all one line with spaces between the options, but no spaces around any =.
    The other aspect is the login started by the init system. On Raspbian jessie, check:
    ls /etc/systemd/system/getty.target.wants
    If you see that serial device node (ttyS0) mentioned, disable this service:
    systemctl disable e serial-getty@ttyS0.service e
    You will have to reboot for these things to take effect.

    I don't know what I done, but it work!

     

Log in to post a comment.