Modbus TCP & RTU with Control for Linux SL

winki
2024-10-23
2024-10-24
  • winki - 2024-10-23

    Hello,
    Today I am able to test ma industrial computer in my test bench.
    I am able to do all the configuration throught my VPN, 100% remote.
    I can see the gateway & the Virtual PLC.

    Now I would like to do some Modbus TCP Client & Modbus RS485.
    But I am lost due to docker !
    When I go to modbus TCP it only gave me the docker network, but not my eth0 & eth01
    When I go to modbus rtu, how can I create the link between Com number & my /dev/ttyRS485

    Loic,

     
  • TimvH

    TimvH - 2024-10-23

    RS485 doesn't seem very logical to use in VPLC's in my opinion. I also don't know if this is supported....
    But for TCP/IP, I think you still need to configure the Nic settings. See the attached png. In my case enp6s0.
    When changing this setting, restart the VPLC.

    What is really nice, is that you don't have to configure the IP address setting in Linux. By setting the Nic to a certain IP address in the CODESYS instance configuration, this is automatically done for you.

    I only tested this with EtherCAT, but I guess this works the same for Modbus TCP/IP.

     
  • winki - 2024-10-23

    For small project, I would like to use my industrial computer as a PLC + Industrial Computer.
    Like that I can save the cost of one PLC.
    That why I am using Codesys on Linux.

    With the nic it is not working.
    I already set the IP adress with /etc/network/interfaces. Can it comes from there ?

    looking to "Control Linux SL" docuemntation it should work with rtu.

     

    Last edit: winki 2024-10-23
  • winki - 2024-10-23

    I made a mistake it is not end0 but eth0. But I have the same error.

     
  • TimvH

    TimvH - 2024-10-23

    It seems you have 2 network interfaces. Did you try eth1?
    Did you already configure the IP address for this interface in Linux? If yes, then maybe undo this.
    - or only set eth0 in the Nic configuration without anything else (so no IP address, because this is already set in Linux).

    For more information about the Nic settings, see (probably already read it?):
    https://content.helpme-codesys.com/en/CODESYS%20Control/_rtsl_obj_deploy_control_sl_configuration.html

    PS, if you only want to run CODESYS Control SL, you don't necessarily need the Virtual PLC variant. You could also install and run the CODESYS Control SL Runtime in the Host operating system. This way you should also be able to access the serial port and directly access all ethernet ports. Maybe this is easier?

     

    Last edit: TimvH 2024-10-23
  • winki - 2024-10-23

    Maybe I don't know.
    **Maybe if someone know it can help me. **
    I will try Constrol SL runtime in the Host.
    I will try to but only Nic without IP

     
  • winki - 2024-10-23

    I do not have error anymore using nic with eth0 value.
    But my network it still 172.17.0.3 like the first picture.

     
  • TimvH

    TimvH - 2024-10-24

    Most likely your IP address is set to 172.... because you use a VPN connection to your device. Probably best to use the other Ethernet interface for your modbus communication.

     
  • winki - 2024-10-24

    No, my vpn is 10.0.0.12.
    The docker interface is 172.17.0.1.

     
  • winki - 2024-10-24

    Your right, much easier with Linux control SL ARM.
    Everything is working.

     

Log in to post a comment.