CanBerry with Codesys

It is possible to use Codesys to control the can bus on Raspberry. If you want to use this, simply follow the steps below.

Iso preparation:

  1. Download and Install CODESYS Control for Raspberry Pi SL at the following link:
  2. Edit the config.txt in the boot SD card
  3. Uncomment the line dtoverlay=mcp2515-can0-overlay,oscillator=16000000,interrupt=22 for CanBerryNormal, Isolated and CanBerryDual
  4. Uncomment the line dtoverlay=mcp2515-can1-overlay,oscillator=16000000,interrupt=25 only for CanBerryDual
  5. SAVE
  6. Download the canberry-codesys.tar to raspberry
  7. Decompress it by using the command: tar –xvf canberry-codesys.tar
  8. Go to folder canberry-codesys
  9. Edit the file by using the command: nano
  10. Comment or uncomment the lines according to your type of canberry board
  11. Save the file and run the command: : sudo sh
  12. Open the codesys project: canberry_project.project
  13. Connect with raspberry as is shown in the Video:


      1. thank you for your respons.
        I’m currently trying to get communication with canberry dual with codesys but i get the errorcode 521 with socketconnect function. Any idea why?

        Thanks in advance,


      1. thank you,
        I tried but at the moment you run “sudo sh” I get messages (can not find device ”
        I am going crazy

        1. Dear Davide,
          follow the instructions on CanberryDualIso for the board configuration, when the can0 is present retry with “sudo sh”.

          Best regards

  1. Ok, and what must to do do get plain can frame ? on the STRING is not posiblle to convert it to original HEX.
    8C is like 8 ;/ great project but no usable for me, how to get raw can data ?

  2. We are using the shield for reading on a truck. But there are a lot of messages on the bus. Is it possible to put a filter or filters in the Or is there another solution?

  3. Hi,

    is it possible to receive the source code of the binary files (can0_rec,can0_send,can1_rec and can1_send) which are located inside canberry-codesys.tar?

    many thanks

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.