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

Problem with OPC/UA on Raspberry Pi

Leijonberg
2016-05-31
2016-10-17
  • Leijonberg - 2016-05-31

    Hi,

    I'm trying to connect UAExpert to the OPC/UA on my RPI, but I get an error message "Could not connect to server: BadCommunicationError".
    UAExpert Discovery service doesn't find the server either, so I have tried connecting by IP-address without luck.

    I have tried the project on Control Win, works like a charm.
    netstat says 'listening' on ports 4840 and 11740, so ports aren't blocked...

    Does anyone have any ideas what could be blocking the connection? Reinstall the runtime?

    Regards,
    Daniel

     
  • lgruz - 2016-06-03

    Hi,
    I have the same problem with Raspberry CoDeSys v3.5.8.10. Try to downgrade Raspberry CoDeSys to v3.5.7.10 for do it works.

     
  • petergrote - 2016-07-05

    Hi lgruz,

    How to I find the donwgrade version v3.5.7.10

    I am also having some problems, maybe not the same, since I can find a way to open port 4840, but this downgrade may help me.

    look forward to receive your reply.

    Peter Grote

     
  • eschwellinger

    eschwellinger - 2016-07-05

    Hi,
    downgrade does not solve it.
    The problem is if the runtime starts before you have an valid IP address which
    is usually the case the OPCUA Server does not reasign/change the address.
    This leads to problems on startup (runtime works OPCUA not)
    You could workaround this by a later start of the runtime (init Sleep with 20s)
    If you have a port problem you could configure the port in /etc/CODESYSControl.cfg (and even which nic you want to use for OPCUA)

    [CmpOPCUA]
    NetworkAdapter=eth0
    NetworkPort=4841

    BR
    Edwin

     
  • petergrote - 2016-07-06

    Hi Edwin
    Thank you your help, but look into the "CODESYSControl.cfg" file on my Rpi, I was not able to add, because this file is read only.

    I found that inside the Rpi Package there was a demo OPCUA project and open this and downloaded this the port 4840 was open, reason I can not find/see anywhere.

    I then open up my own little project with OPCUA and downloaded this and now I am able to telnet the port 4850 and along with this also able to browse and see value in my Kepware OPC UA Client.

    I am not able to find WHO and where to set the port number ex. 4840 and have also checked the "CODESYSControl.cfg" file and still no OPCUA inside this file.

    Can you please help me try to understand this or show me how to set the port number for the OPC UA..

    My demo project Work OK now on the 2h demo, since I do not have any license for the Rpi Control yet.

    Have a great and sunny day.

    Peter Grote

     
  • eschwellinger

    eschwellinger - 2016-07-07

    Hi Peter,
    You need to add this section to /etc/CODESYSControl.cfg

    sudo nano /etc/CODESYSControl.cfg

    BR
    Edwin

     
  • Anonymous - 2016-07-08

    Originally created by: OW_RPi

    Hi,

    I recently tested the OPC UA server with my RPi and struggled with the same problems mentioned above ("Could not connect to server: BadCommunicationError") but finally found a workaround.

    As Edwin explained, the OPC UA Server does not reasign/change the ip-address after the runtime start.
    So I just restarted codesyscontrol:

    sudo /etc/init.d/codesyscontrol stop
    sudo /etc/init.d/codesyscontrol start

    Afterwards I was able to connect uaExpert Client to RPi OPC UA Server.

    @Edwin: What did you mean by "init Sleep with 20s" and how to implement that?

    Best regards,
    Oleg

     
  • petergrote - 2016-07-08

    Hi Edwin,
    Thank you and I was able to edit and save the edits regarding to OPC UA.

    BR
    Peter Grote

    Edwin Schwellinger hat geschrieben:
    Hi Peter,
    You need to add this section to /etc/CODESYSControl.cfg
    sudo nano /etc/CODESYSControl.cfg
    BR
    Edwin

     
  • petergrote - 2016-07-11

    Hi Edwin,

    Can you also please help at the suggestion : What did you mean by "init Sleep with 20s" and how to implement that?

    OW_RPi hat geschrieben:
    Hi,
    I recently tested the OPC UA server with my RPi and struggled with the same problems mentioned above ("Could not connect to server: BadCommunicationError") but finally found a workaround.
    As Edwin explained, the OPC UA Server does not reasign/change the ip-address after the runtime start.
    So I just restarted codesyscontrol:
    sudo /etc/init.d/codesyscontrol stop
    sudo /etc/init.d/codesyscontrol start
    Afterwards I was able to connect uaExpert Client to RPi OPC UA Server.
    @Edwin: What did you mean by "init Sleep with 20s" and how to implement that?
    Best regards,
    Oleg

     
  • claudio - 2016-08-18

    petergrote hat geschrieben:
    Hi Edwin,
    Can you also please help at the suggestion : What did you mean by "init Sleep with 20s" and how to implement that?

    I added this 2 lines to /etc/rc.local before "exit 0" (edit with sudo nano /etc/rc.local )

    Sleep 10
    sudo /etc/init.d/codesyscontrol restart


    I hope this is useful

    Claudio

     
  • petergrote - 2016-08-31

    Hi Claudio
    Thank you for your suggestion and I have now tryed this, but sorry for me no luck.

    Can you please look to my attached rc.local file and tell what I am doing wrong or need to change

    Great help from you and for your information, if I run the "sudo /etc/init.d/codesyscontrol restart" from the termonal Windows on PRi the OPC UA Works

    BR
    Peter Grote

    claudio hat geschrieben:
    I added this 2 lines to /etc/rc.local before "exit 0" (edit with sudo nano /etc/rc.local )


    Sleep 10
    sudo /etc/init.d/codesyscontrol restart


    I hope this is useful
    Claudio

    rc.local.txt [468 Bytes]

     
  • eschwellinger

    eschwellinger - 2016-09-01

    Hi Peter,

    but one question:

    Does this example here work:

    "c:\Users\<yourwindowsusername>\CODESYS Control for Raspberry PI\3.5.9.10\Examples\OPCUA.project"</yourwindowsusername>

    If you try to browse the items with your OPCUA Client?

    BR
    Edwin

     
  • petergrote - 2016-09-02

    Hi Edwin,

    Sorry but the OPCUA project does not sole this issue, but by running from the Terminal window "sudo /etc/init.d/codesyscontrol restart" I am then able to browse the items from my OPC UA Client.

    I have attached my rc.local file so that you can look into this "Claudia suggestion"

    Look forward to receive your feedback.

    Have a great day

    BR Peter Grote

    Edwin Schwellinger hat geschrieben:
    Hi Peter,
    but one question:
    Does this example here work:
    "c:\Users\<yourwindowsusername>\CODESYS Control for Raspberry PI\3.5.9.10\Examples\OPCUA.project"
    If you try to browse the items with your OPCUA Client?
    BR
    Edwin</yourwindowsusername>

    rc.local.txt [508 Bytes]

     
  • ctgarvey - 2016-10-16

    Hi Folks,
    Ive tried all of these hacks pertaining to opcua, pi config files, and restart codesys engine etc, and Im not having reliable repeatable success. Have there been any further developments or guidelines re getting OPCUA server to work on Raspberry pi 1.3.0.0 with CoDeSys v3.5.9.2 runtime ? We use unified-automation OPCUA SDK internally in the office for other stuff, and are familiar with opcua. But troubleshooting it on codesys pi is difficult. Im trying to thrash out a major use case / proof of concept for abstract control system development for our biggest client, so any help much appreciated. I got it to work once, then couldnt repeat it. Is there anything obviously wrong with the symbol configuration below? Im getting the raspberry pi empty config on ua expert, but not any variables that are supposedly configured to be available via opcua.
    thanks
    Cormac

    IMG: TheViewFromUAExpert.png

    IMG: TheViewSymbolConfigurationt.png

     
  • eschwellinger

    eschwellinger - 2016-10-17

    hm..
    could you confirm that the miniproject from

    "c:\Users\<windowsusername>\CODESYS Control for Raspberry PI\3.5.9.X\Examples\OPCUA.project" </windowsusername>

    works with your configuration and changed /etc/init.d/codesyscontrol (added the sleep 10 in that file in the do_start section)

    BR
    Edwin

     

Log in to post a comment.