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

PIGEON RB300 Raspberry CM CAN bus failure

GiorgioT
2018-03-10
2019-03-03
  • GiorgioT - 2018-03-10

    Hi,

    We have been working for almost 2 years with Beagleboneblack in industrial environments for motion control with great results.
    We are going to use other boards along with the BBB ones for our projects.

    We are now developing new projects with the Pigeon RB300 board (Raspberry Computer Module) but we stumbled on the CAN Bus Failure.

    The can0 interface is working properly since i can send/receive frames on the bus through the cansend/candump commands.
    The Codesys Log reports this error: 'cannot execute ./rts_set_baud.sh - can0 will not work' (see attached pictures).
    I followed the steps in this old post : https://forum.codesys.com/viewtopic.php?f=21&t=5611&start=30
    I created and saved this file in /root, / and /home/pi but codesys seems not finding it. The file has all permissions (+rwx for all users).
    Even if i set the baud by hand through

    sudo ip link set can0 up type can bitrate 125000
    sudo ifconfig can0 up
    

    I always get can bus failure.

    Thank you.

    IMG: Screenshot (430).png

     
  • kristech - 2018-03-12

    Modify the CODESYS configuration file /etc/CODESYScontrol_User.cfg:

    [SysCom]
    ;Linux.Devicefile=/dev/ttyS
    [CmpBlkDrvCom]
    ;Com.0.Name=MyCom
    ;Com.0.Baudrate=115200
    ;Com.0.Port=3
    ;Com.0.EnableAutoAddressing=1
    [CmpSocketCanDrv]
    ScriptPath=/opt/codesys/scripts/
    ScriptName=rts_set_baud.sh
    [SysProcess]
    Command.0=shutdown
    [CmpApp]
    Bootproject.RetainMismatch.Init=1
    Application.1=PIGEON_CANmaster
    

    add the bash script /opt/codesys/scripts/rts_set_baud.sh

    \#!/bin/sh
    BITRATE=`expr $2 \\* 1000`
    ifconfig $1 down
    echo ip link set $1 type can bitrate $BITRATE
    ip link set $1 type can bitrate $BITRATE
    ifconfig $1 up
    

    then modify the permissions:

    sudo chmod +x /opt/codesys/scripts/rts_set_baud.sh
    
     
  • GiorgioT - 2018-03-15

    Thank you very much Kristech,

    It's working like a charm now.

     
  • ainvertek - 2018-05-29

    Worked for me as well Kristech for the Pcan USB adapter

     
  • jbunel - 2019-03-02

    Hi. I try to do the same as GiorgioT ; and i have the same problem !

    So :
    Hardware :
    Pigeon RB350 (the CanOpen master) + Step by step IGUS D1 card (the CanOpen slave)

    Software :
    Codesys V3.5 SP14 64 bits

    Conf :
    "/etc/CODESYScontrol_User.cfg" and "/opt/codesys/scripts/rts_set_baud.sh" are exactly the same as KRISTECH description

    The can0 interface is working properly since i can send/receive frames on the bus through the cansend/candump commands. Like GiorgioT.

    Please do someone know, what is missing ?

    IMG: Codesys Can Failure.png

     
  • jbunel - 2019-03-03

    Is there a tutorial step by step to use canopen in codesys with raspberry compute ?

    Thank you

     

Log in to post a comment.