---
title: "SOEM4Mbed"
url: "https://maker.wiznet.io/teddy/projects/soem4mbed/"
markdown_url: "https://maker.wiznet.io/teddy/projects/soem4mbed/md"
type: "UCC: User Created Content"
author: "lipoyang"
author_url: "https://github.com/lipoyang/SOEM4Mbed/tree/master"
editor: "WIZnet"
editor_url: "https://maker.wiznet.io/"
original_author: "lipoyang"
original_url: "https://github.com/lipoyang/SOEM4Mbed/tree/master"
published: "2023-11-02"
language: "en"
hardware: ["Arduino Ethernet Shield 2", "STMicroelectronics NUCLEO-F446RE"]
likes: 0
views: 243
comments: 0
source: "WIZnet Makers (https://maker.wiznet.io/)"
---

# SOEM4Mbed

> Simple Open EtherCAT Master Library for Mbed

Original author: lipoyang (source: https://github.com/lipoyang/SOEM4Mbed/tree/master)

## Components

- **Arduino Ethernet Shield 2** x 1: w5500 ([docs](https://docs.arduino.cc/hardware/ethernet-shield-rev2))
- **STMicroelectronics NUCLEO-F446RE** x 1

## Documents and links

- [SOEM4Mbed](https://github.com/lipoyang/SOEM4Mbed.git) (code)

## Article

## [Simple Open EtherCAT Master Library for Mbed](https://github.com/lipoyang/SOEM4Mbed/tree/master#simple-open-ethercat-master-library-for-mbed)

This is SOEM (Simple Open EtherCAT Master) library ported for Mbed.

It's just for educational or experimental purposes.

The original SOEM is at <https://github.com/OpenEtherCATsociety/SOEM>

### [Supported hardware](https://github.com/lipoyang/SOEM4Mbed/tree/master#supported-hardware)

- GR-PEACH (Renesas RZ/A1H, ARM Cortex-A9)

- GR-MANGO (Renesas RZ/A2M, ARM Cortex-A9) ([README](https://github.com/lipoyang/SOEM4Mbed/blob/master/custom/README.md))

- NUCLEO-F767ZI (STM32F767ZI) ([README](https://github.com/lipoyang/SOEM4Mbed/blob/master/custom/README.md))

- NUCLEO-F446RE (STM32F446RE) + Ethernet Shield 2 (W5500) ([README](https://github.com/lipoyang/SOEM4Mbed/blob/master/custom/README.md))

- mbed LPC1768 ([README](https://github.com/lipoyang/SOEM4Mbed/blob/master/custom/README.md))

### [limitations](https://github.com/lipoyang/SOEM4Mbed/tree/master#limitations)

Many of MCUs don't have large memory, and has only one LAN port. SOEM4Mbed reduces memory usage, and does not support redundant LAN ports.

Doe to reducing memory usage, some functions are limited.

| item | constant name | original SOEM | SOEM4Mbed |
| --- | --- | --- | --- |
| max entries in Object Dictionary list | EC_MAXODLIST | 1024 | 64 |
| max entries in Object Entry list | EC_MAXOELIST | 256 | 64 |
| max number of slaves in array | EC_MAXSLAVE | 200 | 64 |
| number of frame buffers | EC_MAXBUF | 16 | 2 |

### [Documentation of original SOEM](https://github.com/lipoyang/SOEM4Mbed/tree/master#documentation-of-original-soem) [Customized versions of SOEM4Mbed](https://github.com/lipoyang/SOEM4Mbed/tree/master/custom#customized-versions-of-soem4mbed)

### [GR-MANGO](https://github.com/lipoyang/SOEM4Mbed/tree/master/custom#gr-mango)

The GR-MANGO doesn't support `Ethernet` class for handling RAW Ethernet frames. Therefore the customized SOEM library for GR-MANGO uses the low level Ethernet driver of RZ/A2M.

[SOEM for GR-MANGO](https://github.com/lipoyang/SOEM4Mbed/blob/master/custom/GR-MANGO)

### [NUCLEO-F767ZI](https://github.com/lipoyang/SOEM4Mbed/tree/master/custom#nucleo-f767zi)

The NUCLEO-F767ZI doesn't support `Ethernet` class for handling RAW Ethernet frames. Therefore the customized SOEM library for NUCLEO-F767ZI uses the low level Ethernet driver of STM32F7 (STM32F7 HAL library).

[SOEM for NUCLEO-F767ZI](https://github.com/lipoyang/SOEM4Mbed/blob/master/custom/NUCLEO-F767ZI)

### [NUCLEO-F446RE](https://github.com/lipoyang/SOEM4Mbed/tree/master/custom#nucleo-f446re)

The NUCLEO-F446RE doesn't support `Ethernet` class for handling RAW Ethernet frames. In addition, the NUCLEO-F446RE has no PHY chip and no RJ45 connector. Therefore the customized SOEM library for NUCLEO-F446RE uses the Arduino Ethernet Shield 2.

The Arduino Ethernet Shield 2 uses Arduino ICSP port as a SPI port, but the NUCLEO-F446RE has no Arduino ICSP port. Therefore you have to modify your Arduino Ethernet Shield 2. Please connect D11(MOSI), D12(MISO) and D13(SCK) to corresponding pins of the ICSP port via wires.

[![NUCLEO-F446RE](https://github.com/lipoyang/SOEM4Mbed/raw/master/custom/NUCLEO-F446RE.jpg)](https://github.com/lipoyang/SOEM4Mbed/blob/master/custom/NUCLEO-F446RE.jpg)

[SOEM for NUCLEO-F446RE](https://github.com/lipoyang/SOEM4Mbed/blob/master/custom/NUCLEO-F446RE)

### [mbed LPC1768](https://github.com/lipoyang/SOEM4Mbed/tree/master/custom#mbed-lpc1768)

The LPC1768 has only 64kB RAM. In addition, LPC1768's RAM is divided into 3 blocks (AHBSRAM, AHBSRAM0, AHBSRAM1). Therefore the customized SOEM library reduces RAM usage and allocates buffer variables to the vacant area.

The mbed LPC1768 board needs a external RJ45 connector.

[![LPC1768](https://github.com/lipoyang/SOEM4Mbed/raw/master/custom/LPC1768.jpg)](https://github.com/lipoyang/SOEM4Mbed/blob/master/custom/LPC1768.jpg)

---

Source: https://maker.wiznet.io/teddy/projects/soem4mbed/
