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

CAN communications with Raspberry Pi and CodeSys

Runtime
egret
2016-10-31
2019-03-27
  • egret

    egret - 2016-10-31

    Codesys Forum,

    I would like to use the Raspberry Pi with an SPI CAN module to establish CAN communications. However, I'm unclear on a few points:

    With "CODESYS Control for Raspberry Pi SL

    I'm considering the following CAN modules. Can anybody recommend one over another?
    SK Pang Electronics - PiCAN2
    MikroElektronika - CAN SPI click 3.3V with Pi 2 click SHIELD
    IndustrialBerry - CanBerryDual V2.1

    If CAN communications is the only requirement is the Beaglebone a better alternative?

    Regards, Ben

     
  • menno

    menno - 2016-11-09

    CODESYS supports SocketCAN communication. I managed to get CODESYS CAN communication working on a Raspberry Pi 3 with CanberryDual. However, for some reason it only works if one mcp2515-overlay is configured in /boot/config.txt, so only one CAN bus is working. Still figuring out, why that is the case and whether it is a CODESYS or SocketCAN problem. Any help on this appreciated.

     
  • bmunsil

    bmunsil - 2016-11-15

    I have the PiCanV2 from Skpang it took some browsing of the forums here, but there is a really good thread on it that will help you get it working. you can compile socketcan into you image and configure the codesys control to auto load on CAN1. I actually have an image that I would be more than happy to share if you send me your information. as a side note I am NOT a Linux or Codesys expert. I have just compiled the bits and pieces that the community has provided to make a working system.

    so far I have it running on a Raspberry PI B, and Raspberry PI 2 B. I don't have a Raspberry PI 3 yet to get it working but I have been told that there is little difference in the configurations.

    I do know however that the Device version 3.5.9.20 doesn't work for me. I have to use an older device version in Codesys V3.

    I know this was a bunch of random info put into a not so nicely formatted post but I hope it somewhat helps.

     
  • CanBohr

    CanBohr - 2018-01-09

    @bmunsil
    I have a problem with PiCanV2 from Skpang
    Codesys gives me the error message "Bus not running"
    But the canbus is working on the raspi, I can see messages by using candump can0.
    Codesys Version is 3.5.12.0.
    Can you tell me where you found the solution for your problem?
    Cheers,
    CanBohr

     
  • eschwellinger

    eschwellinger - 2018-01-11

    Hi,
    to have this script executable is mandatory:
    l viewtopic.php?f=21&t=8463#p20132 l

    #!/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

    BR
    Edwin

     
  • jond

    jond - 2019-03-27

    I have similar problem with PiCanV2 from Skpang
    Canbus is working on the raspi, I can see messages by using candump can0.
    Have installed Codesys Version is 3.5.14.0.
    Downloaded CANbus example from the store.
    Unfortunately I can not get the example working.

    Can you help me please to get this example running on Raspberry 3 controlled with Codesys?
    Cheers,

     

Log in to post a comment.