EtherCAT® Shield for Raspberry PI – EtherBerry V1.6

EtherCAT® is an Ethernet-based fieldbus system, invented by Beckhoff Automation. The protocol is standardized in IEC 61158 and is suitable for both hard and soft real-time requirements in automation technology. EtherBerry V 1.6 is an extension board for RaspBerry Pi based on LAN9252 EtherCAT® Slave produced by Microchip, there is a Real Time clock powered by a 12 mm battery CR1216 (Battery is not included). The LAN9252 is a 2/3-port EtherCAT® slave controller wi th integrated dual Ethernet PHYs Which Contain each to full-duplex 100BASE-TX transceiver and support 100Mbps (100 BASE-TX) operation. Three possible configurations are possible: Microcontroller Mode, Digital I / O and Expansion Mode.
Our board not implements a fusion between the Microcontroller mode and the Digital I/O.

Raspberry Boards Compatibility


The SPI bus permits the communication with Raspberry PI, while the GPIO of LAN9252 are not exported. These pins are controlled by EtherCAT bus, no from Raspberry GPIO.

On pin header JP2 are exported the following RPI pins :

    • GPIO05
    • GPIO06
    • GPIO12
    • GPIO13
    • GPIO16
    • GPIO19
    • GPIO20
    • GPIO21
    • GPIO22
    • GPIO23
    • GPIO24
    • GPIO26

Every EtherCAT® slave requires a Vendor ID, we use the ID of SG Electronic Systems. This company supports us with boards distribution and their customization.

Etherberry V1.6 Schematic

It’s possible to order this board on our Partner Shop with a different brand name.

If you want additional informations use our contact form.

EtherBerry V 1.6 Bottom View


EtherBerry V 1.6 Top View

EtherCAT on Raspberry Pi 4




  1. Download the Etherberry Code: EtherBerry_Code_v1.6
  1. Copy Etherberry_Code_v1.6 to Raspberry
  1. Read Instructions.txt in Etherberry_Code_v1.6 directory use the example code.
  1. With the example code provided, it is possible to configure the IO in JP2 as Inputs or Outputs, and read the Inputs  and set the Outputs via Ethercat.
  1. It is possible to Read the i2c RTC (DS3231) via ETHERCAT® .  EtherBerry_Test.cpp is only an example that inizialise the RTC at the same value “14 April 2017”, if you want to set the RTC with a different value, you must remove the line marked in the picture below.


  1. For further applications it is possible add device i2c in Etherberry header JP1

and control via ETHERCAT®: Etherberry XML Configuration ETHERCAT® (ESI)



Dowloand Etherberry XML for configuration slave on ETHERCAT® master: Etherberry_XML_v1.6

Download and install CODESYS Development System V3 from:

Download and install WinPcap from:

Download Codesys project

Unzip and open Etherberry_Demo_Master_v1.6.project

At first opening you see that our Etherberry Ethercat slave is not installed (see the red arrow)

Install Etherberry Ethercat slave clicking on Tools→Device Repository…

Click on Install.. (see red arrow) and select EtherBerry.xml located in Codesys project directory.

Etherberry Salve is installed click Close

Double click on Device (see red Arrow) to open Device Tab.

Click on Codesys Control Win sys (bottom right corner windows see red arrow)

Start PLC

Click ok

In Codesys Project click in selection box (see red arrow) and Press Enter

If everithing is ok PLC will be connected.

Double Click on EtherCAT_Master  (see red arrow)

Click on Browse  (see red arrow)

Select the MAC Address of your PC Ethernet Card  (see red arrow) and click OK.

Double Click  EtherBerry_32_32 (see red arrow) and click EtherCAT I/O Mapping, here are defined the variables associated to the I/O of etherberry slave. ( Don’t do anything to use demo project).

Double Click PLC_PRG(see red arrow) , this is the the code of the demo project. ( Don’t do anything to use demo project).

Set static IP in your PC Ethernet.

Connect network cable between your PC and Etherberry Board (LINK_IN)

Run the EtherBerry from Raspberry (for more detail to compile the code see section Installation Etherberry to Raspberry)

In Codesys Project click  login  (see red arrow).

Click  Start  (see red arrow)

Master and Salve are connected and exchange the data

In the EtherBerry Board you can read the outputs G23,G24,G12,G16,G20,G21 HEADER JP2 or set the inputs G22,G05,G06,G13,G19,G26 HEADER JP2 ETHERBERRY and see the variables changing in the codesys project.


Update to CODESYS 3.5.12

When using the Projekt with newer Codesys Version (tested with 3.5.12) you may have errors, when started Codesys.

First update the Project Environment, this screens appears automatically

Select in all section the latest software, on Library versions select the

Now you can select the Compiler version update with 3.5.12

Now you can select the Visualization profile update with SP12

Now update the SoftMotion Version update

Now press ENTER, the Codesys updates the environment

But there is still something to do…

Download missing device description…

Right click on the devices…

This will download the device description…

But there are still errors and again there is something to do..

Upgrade the Library


These are the modules that need an upgrade

Finally there is no more “Download missing library” section..

Now we are ready and no more errors left..

Now you can proceed..

If you use Codesys Version for 64 Bit, than you have to change the device in the project, otherwise you can not connect to the PLC.

Follow the last two steps: Update Device

Select the CODESYS Control Win V3 x64

Certification Disclaimer


  1. Dear technical support,
    I intend to set up a communication line between an IPC running Matlab/Simulink and raspberry pi that works as a gateway to connect to a PLC. In Matlab/Simulink there is a Etercat Master library. So I need an Ethercat adapter to send/receive the packets. Then I need to read the data of the adapter in CODESYS (for example SPI interface) and pass the data to the filedbus netwrok. Can I use your board to this aim? Does your adapter send/receive bytes?

    Also do you have any distribute in USA?

    Thank you in advance

    1. Dear Amin,
      Our device permits the SPI communication with a Raspberry over EtherCat, or If you want, with a MCU powerd at 3.3V.
      We can ship in the USA directly.


  2. Hi,

    I have received Etherberry v1.6 today and tried follow the instructions. I have the following errors.

    pi@raspberrypi:~/Desktop/EtherBerry_Code_v1.6 $ sudo ./EtherBerry_Test
    2017/04/14 08:30:20 FRI
    DS1307 RTC device Initialized!
    inizialization failed

    FYI, I didn’t put in CR1255 battery. Will it be the problem? I am running on Raspberry Pi 3 (Jessie OS).

    As for CodeSys, I have some issue connecting Gateway to LAPTOP-47BJS9RL (active). May I know what could it be the problem? I checked my Gateway and CodeSys PLC Control is started.

    Thank you.

  3. Hello ! For a project, we have recently bought Etherberry V1.6.1. I have followed all the instructions mentioned in the website and also tried to run the code provided by Codesys.

    In order to make complete use of Etherberry on Codesys platform we request some example projects and documents on Etherberry and its libraries.

    Instead of configuring the inputs and outputs of Etherberry in raspberry Pi, we would like to do it on Codesys instead. Also, in the ‘EtherBerry_Test.cpp’ Etherberry.maintask(); is executed. We would like to know the functionality of this method.

    Your response is every much appreciated. Thank you in advance.

  4. Hello, I’ve just ordered a unit for testing, but I’m wondering how hard would it be to make it an EtherCAT I want to run servos

    And also have other items on the Ethernet bus

    1. Dear Patrick,
      as described into Etherberry V1.6 web page “It is based on LAN9252 EtherCAT® Slave produced by Microchip”. In order to create an EtherCAT Master, it is necessary only the standard LAN Interface, this is a feature of EtherCAT specification.

      Best Regards

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.