Arduino library to support Ethernet for STM32 based board
Switch branches/tags
Clone or download
sstaub and fpistm MAC support (#11)
Mac address support

Signed-off-by: sstaub <>
Latest commit fa66984 Jun 27, 2018
Failed to load latest commit information.
examples MAC support (#11) Jun 27, 2018
src MAC support (#11) Jun 27, 2018
AUTHORS MAC support (#11) Jun 27, 2018
README Update library documentation Jul 6, 2017 MAC support (#11) Jun 27, 2018
keywords.txt MAC support (#11) Jun 27, 2018 Update library version Jan 24, 2018

STM32 Ethernet Library for Arduino

With an STM32 board with Ethernet compatibility, this library allows a STM32 board (NUCLEO, DISCOVERY, ...) to connect to the internet.

This library follows the Ethernet API from Arduino.
For more information about it please visit:


This library is based on LwIP, a Lightweight TCP/IP stack, available here:

The LwIP has been ported as Arduino library and is available thanks Arduino Library Manager.



The LwIP has several user defined options, which is specified from within the lwipopts.h file.

This library provides a default user defined options file named lwipopts_default.h.

User can provide his own defined options at sketch level by adding his configuration in a file named STM32lwipopts.h.

New alternative init procedure !!!

There are alternative inits of the Ethernetinterface with following orders:

Ethernet.begin(ip, subnet);
Ethernet.begin(ip, subnet, gateway);
Ethernet.begin(ip, subnet, gateway, dns);

This is more logical. A MAC address is no more needed and will retrieved internally by the mbed MAC address!

You can get the MAC address with following function, this must done after Ethernet.Begin()

uint8_t *mac;
mac = Ethernet.macAddress();

You can also set a new user based MAC address, this must done before Ethernet.begin()

uint8_t newMAC[] = {0x00, 0x80, 0xE1, 0x01, 0x01, 0x01};


EthernetClass::maintain() in no more required to renew IP address from DHCP.
It is done automatically by the LwIP stack in a background task.

An Idle task is required by the LwIP stack to handle timer and data reception.
This idle task is called inside a timer callback each 1 ms by the function stm32_eth_scheduler().
A DEFAULT_ETHERNET_TIMER is set in the library to TIM14.
DEFAULT_ETHERNET_TIMER can be redefined in the core variant.
Be careful to not lock the system in a function which disabling IRQ.
Call Ethernet::schedule() performs an update of the LwIP stack.


You can find information at