- Notifications
You must be signed in to change notification settings - Fork53
stm32duino/STM32Ethernet
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
With an STM32 board with Ethernet compatibility, this library allows a STM32board (NUCLEO, DISCOVERY, ...) to connect to the internet.
This library follows the Ethernet API from Arduino.
For more information about it please visit:http://www.arduino.cc/en/Reference/Ethernet
This library is based on LwIP, a Lightweight TCP/IP stack, available here:
http://git.savannah.gnu.org/cgit/lwip.git
The LwIP has been ported as Arduino library and is available thanks Arduino Library Manager.
Source:https://github.com/stm32duino/LwIP
The LwIP has several user defined options, which is specified from within thelwipopts.h file.
This library provides a default user defined options file namedlwipopts_default.h.
User can provide his own defined options at sketch level by adding his configuration in a file namedSTM32lwipopts.h orextend the default one by adding some extra configuration in a file namedlwipopts_extra.h.
There are alternative inits of the Ethernet interface with following orders:
Ethernet.begin();Ethernet.begin(ip);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 be done after Ethernet.Begin()
uint8_t *mac;Ethernet.begin();Ethernet.MACAddress(mac);You can also set a new user based MAC address, this must be done before Ethernet.begin()
uint8_t newMAC[] = {0x00, 0x80, 0xE1, 0x01, 0x01, 0x01};Ethernet.setMACAddress(newMAC);Ethernet.begin();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 thefunctionstm32_eth_scheduler().
ADEFAULT_ETHERNET_TIMER is set in the library toTIM14.DEFAULT_ETHERNET_TIMER can be redefined in the core variant.
Be careful to not lock the system in a function which disabling IRQ.
CallEthernet::schedule() performs an update of the LwIP stack.
You can find information athttps://github.com/stm32duino/Arduino_Core_STM32/wiki/STM32Ethernet
About
Arduino library to support Ethernet for STM32 based board
Resources
Code of conduct
Contributing
Security policy
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors12
Uh oh!
There was an error while loading.Please reload this page.