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

Using Raspicomm

2014-04-28
2014-08-07
  • eschwellinger

    eschwellinger - 2014-04-28

    Hi,
    if someone want to use raspicomm:

    Which feature are available with raspicomm
    â—¾Joystick
    â—¾RS-485
    â—¾RS-232
    â—¾Output (LEDs)
    â—¾HWClock

    http://amescon.com/products/getting-started.aspx

    additional some modifications are needed:

    in /etc/rc.local add

    sudo ln -s /dev/ttyAMA0 /dev/ttySS0
    sudo ln -s /dev/ttyRPC0 /dev/ttySS1

    sudo nano /etc/rc.local

    #!/bin/sh -e
    #
    # rc.local
    #
    # This script is executed at the end of each multiuser runlevel.
    # Make sure that the script will "exit 0" on success or any other
    # value on error.
    #
    # In order to enable or disable this script just change the execution
    # bits.
    #
    # By default this script does nothing.

    # Print the IP address
    _IP=$(hostname -I) || true
    if [ "$_IP" ]; then
    printf "My IP address is %s\n" "$_IP"
    fi

    sudo ln -s /dev/ttyAMA0 /dev/ttySS0sudo ln -s /dev/ttyRPC0 /dev/ttySS1
    exit 0

    Additional in CODESYSControl.cfg /etc/
    you need to add:

    [SysCom]Linux.Devicefile=/dev/ttySS
    RTC and Input and Outputs are working with attached example.
    (Which is the standard GPIO Example project)
    Com1 is in that case RS232 Port
    Com2 is the RS485 port

    This was not a test with a real slave device (missing a real slave to do that) but the green signs on the device tree
    indicate that it will work with both ports.
    Additional there is a bug that baudrates below 4800 are not possible at the moment, this should be fixed in one of the next versions.

    BR
    Edwin

    IMG: Raspicomm.jpg

    RASPICOMM.project [289.95 KiB]

     
  • switcher - 2014-04-29

    Thank you Edwin.

    This is great!
    Should we execute Raspicomm setup-script on the Raspberry first?

    Best regards,
    Zdenko.

     
  • switcher - 2014-05-06

    Hi,

    I made a Raspicomm installation on Raspberry.

    I tested modbus RTU communication on RS-485 (port2) with real slave.
    Unfortunately, it don't work ok.
    I am reading 1 holding register (MB function 3) on address 0.
    Modbus_Slave_COM_Port is going to the fault all the time. And I don't receive the value on raspberry back from the slave.
    I connected RS485 bus to another PC with bus monitor programm. I have established, that master sends the request right and slave answers ok. But obviously master don't receive this answer right.
    Here is the print screen from the monitor program on RS485 bus. Red line is the master request and blue is slave answer:

    Any idea?

    Best regards,
    Zdenko.

    IMG: Bild

     
  • eschwellinger

    eschwellinger - 2014-05-06

    Hi Zdenko,
    need more details, what if you add the slave instance to the watch window?
    Need this variables states (expand the slave instance and give me a screenshot)

    BR
    Edwin

    IMG: Watch.jpg

     
  • switcher - 2014-05-07

    Hi,

    Here are the requested Print screens:

    I made an auto-reset on Slave error, just like you suggest me in the other post.
    This two screens are switching in 0,5Hz frequency (error comes and reset is activated just after error).

    I hope you can see some details which can be helpful. If you need some more details please let me know.

    Thank you.
    Zdenko.

    IMG: Bild

    IMG: Bild

     
  • eschwellinger

    eschwellinger - 2014-05-07

    Hi,
    could you remove the "auto reset" from your application,
    I need the error (screenshots) which occure... when communication fails.

    BR
    Edwin

     
  • switcher - 2014-05-07

    Hi,

    Done. Here is the requested Prtsc:

    BR
    Zdenko.

    IMG: Bild

     
  • switcher - 2014-05-07

    Hi,

    I am also trying to use RTC on Raspicomm.
    It don't work with this library:

    How can I use it?

    BR
    Zdenko.

    IMG: Bild

     
  • eschwellinger

    eschwellinger - 2014-05-08

    Hi Zdenko,

    hm... please use the example from store ( http://store.codesys.com/date-and-tme.html ), and update the plc to Raspberry Pi.
    Then you get the follwoing result:

    BR
    Edwin

    IMG: Time.jpg

     
  • switcher - 2014-05-08

    Hi,

    thank you.
    I noticed that firstly, OSCAT libs have to be installed.

    I am receiving 2 errors with the date and time example:

    When I compile original sample, no errors are present. After I change Device to Raspberry, this errors scours.

    BR
    Zdenko.

    IMG: Bild

     
  • eschwellinger

    eschwellinger - 2014-05-08

    Hi Zdenko,

    as I stated already:
    this missing library "pain" will be solved to 3.5SP5 on July (load missing libraries on demand)
    for now please update to 3.5.4.30 CODESYS IDE and use my attached Projekt (install the new Version into the same Directory as always recommended - no need to
    uninstall your 3.5.4.20 version)

    ftp://Raspi:qPAQhcRt@ftp.3s-software.com

    BR
    Edwin

     
  • switcher - 2014-05-09

    Hi,

    Yes, it works .
    Thank you very much.

    Is there any solution available for RS-485 Modbus?

    BR
    Zdenko.

     
  • switcher - 2014-05-13

    Hi,

    there is another problem with RTC.
    At Raspberry boot, system clock is not updated with RTC, but opposite - RTC is updated with system clock. Any idea?

    BTW: RS-485 modbus is under investigation.

    Best regards.
    Zdenko.

     
  • eschwellinger

    eschwellinger - 2014-05-13

    Hi,

    guess this hass nothing to do with CODESYS,
    could we ask this the raspicomm forum?

    BR
    Edwin

     
  • switcher - 2014-05-23

    Hi,

    there was a problem with Raspicomm and is already solved.

    Please look at the Raspicomm forum for a solution.

    BR
    Zdenko.

     
  • switcher - 2014-08-07

    Hi,

    I have tested Raspocomm Modbus RS-485 communication with the new version of Raspicomm driver and Codesys 3.5.SP5. But the problem still exists. Writing to slave module is working, but reading don't. Is there any solution for this problem already known?

    Best regards,
    Zdenko.

     

Log in to post a comment.