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

Raspberry Pi B+ modbus RTU

Rahied
2014-12-09
2015-04-27
  • Rahied - 2014-12-09

    I would like Modbus RTU communication with raspberry pi B + . Only it does not work . I do not know what I do wrong can someone my help . The messages on the forum , I have also been applied to my application just no result.
    I hope you can help me further . I have a USB converter rs485 to me raspberry raspberry connected it recognized me too.
    The comport comport stands as one .

    IMG: help.png

     
  • eschwellinger

    eschwellinger - 2014-12-10

    Hi,

    would recommend to check if serial communication works (you need to add your device to /etc/CODESYSCOntrol.cfg etc) see the following thread here:

    l viewtopic.php?f=21&t=5699#p10247 l

    after that switch to modbus and check if this works with modbus.

    BR
    Edwin

     
  • Rahied - 2014-12-10

    Hello Edwin,

    A have don this already. But no result.
    I don't no what to do.

     
  • Rahied - 2014-12-10

    Hallo,

    Het probleem is dat mijn Modbus Master de Raspberry pi B+ niet wil runnen. In de status heb ik een Bus failure. De topics op de forum welke betrekking hebben met modbus en seriaal heb ik al gelezen en geprobeerd maar geen resultaat

     
  • Rahied - 2014-12-10

    Hello,

    The problem is that my Modbus Master the Raspberry Pi B does not want to run. In the state I have a bus failure. The topics on the forum which concern I have read with Modbus and serialy and tried but no result.

     
  • Rahied - 2014-12-10

    here same setting of my raspberry

    IMG: help 1.png

     
  • Rahied - 2014-12-10

    settings CODESYSControl.cfg

    IMG: help 2.png

     
  • Lambda - 2014-12-10

    Hi,
    don't write ttyUSB0 only write ttyUSB then it should work.

    Gesendet von iPhone mit Tapatalk

     
  • Rahied - 2014-12-11

    Hello,

    I now have the modbus mater in running. But the Modbus slave now give the message Bus Failure. What could be this.

     
  • Torsten Wagner - 2015-04-13

    Hy there,

    I have the same Problem with my Modbus RTU Slave.
    I get teh stat BUS Error but i dont know why.

    could anyon help me ?

    Gretings

     
  • eschwellinger

    eschwellinger - 2015-04-15

    Hi,

    depending on which adapter you are using,
    could you check Serial com example from store and crossover serial connection if this works?

    BR
    Edwin

     
  • Ledrunner - 2015-04-16

    Hello everyone. I have a problem. I have USB - 485 converter with cp21xx (I see them in sudo dmesg). I can to send packets from raspberry to another computer. Is it possible to try to make a raspberry master using a standard CODESYS bus configurator. Will it work? Now I have bus failure.
    1. Raspi B+
    2. Codesys 3.5 SP6
    3. Raspberry control 2.1
    4. USB-485 cp21xx Silicon Labs

    PS: I add in sudo nano /etc/CODESYSControl.cfg

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

     
  • Ledrunner - 2015-04-16

    Solved, was space in string Linux.Devicefile=/dev/ttyUSB. Master now is run.
    But I have other problem. Everything is work (slave device responded), registers is wrote and read. But the Modbus slave now give the message Bus Failure. What could be this?

     
  • Torsten Wagner - 2015-04-27

    Hi Edwin,

    Ive Checkt my Serial Comunication with the Raspberry and it works. Ive used the Serial Projekt out of these Forum.

    Write Works and Read also.
    But in my other brojekt the Modbus doesnt work I get an working Master but the Slave has an Error.
    What could that be.

    BR
    Torsten

     
  • eschwellinger

    eschwellinger - 2015-04-27

    Hi,

    could you give a screenshot of the non working project of the device tree when you are online?
    Please add the Slavename of the modbus slave to the watchwindow.
    You should see the error there.

    BR
    Edwin

     
  • Torsten Wagner - 2015-04-27

    Hy,
    here is the
    Screenshot

    BG
    Torsten

    IMG: Pic.JPG

     
  • eschwellinger

    eschwellinger - 2015-04-27

    Hi Thorsten,

    RESPONSE_TIMOUT means:
    Either the answer from the slave occure to late or the answer does not come to the iec code...some how
    Could you check by a sniffing tool if the response is on the serial line?
    Another check might be:
    Using Control Win for a quicktest (if your pc have a Serial Interface or a usb-to-serial interface)

    BR
    Edwin

     
  • Torsten Wagner - 2015-04-27

    Hi Edwin

    I tried it with an Control Win
    but there is no Comunication on the Port

    also not at the start of the application.

    BR
    Torsten

     
  • Torsten Wagner - 2015-04-27

    Hi ,

    I tried with an other Terminal and now i get the Error

    "ILLEGAL_FUNCTION"

    On the Modbus Slave

    BR
    Torsten

     
  • eschwellinger

    eschwellinger - 2015-04-27

    Hi,

    this sounds for me like your connected slave does not support the configured function codes.

    BR
    Edwin

     
  • Torsten Wagner - 2015-04-27

    HY Edwin,

    I found`ve my mistake.
    I thougt there was an Bus error but the Bus was still working i just used the wrong parameters.

    thanks for your help

    Greetings
    Torsten

     

Log in to post a comment.