GithubHelp home page GithubHelp logo

isabella232 / stm32ethernet Goto Github PK

View Code? Open in Web Editor NEW

This project forked from stm32duino/stm32ethernet

0.0 0.0 0.0 154 KB

Arduino library to support Ethernet for STM32 based board

C++ 87.65% C 12.35%

stm32ethernet's Introduction

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: http://www.arduino.cc/en/Reference/Ethernet

Dependency

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

Configuration

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 or extend the default one by adding some extra configuration in a file named lwipopts_extra.h.

New alternative init procedure !!!

There are alternative inits of the Ethernetinterface 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 done after Ethernet.Begin()

uint8_t *mac;
Ethernet.begin();
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};
Ethernet.MACAddress(newMAC);
Ethernet.begin();

Note

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.

Wiki

You can find information at https://github.com/stm32duino/wiki/wiki/STM32Ethernet

stm32ethernet's People

Contributors

abostm avatar fpistm avatar gdsports avatar ramboerik avatar rzr avatar sstaub avatar straccio avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.