|
TM STM32F4xx Libraries
v1.0.0
Libraries for STM32F4xx devices from Tilen Majerle
|
Ethernet library for STM32F4xx devices with built in ETH MAC - http://stm32f4-discovery.com/2015/02/library-52-ethernet-peripheral-on-stm32f4xx/. More...
Modules | |
| TM_ETHERNET_Macros | |
| Library defines. | |
| TM_ETHERNET_Typedefs | |
| Library Typedefs. | |
| TM_ETHERNET_Functions | |
| Library Functions. | |
Ethernet library for STM32F4xx devices with built in ETH MAC - http://stm32f4-discovery.com/2015/02/library-52-ethernet-peripheral-on-stm32f4xx/.
Library supports 2 modes of connecting and use:
MII connection uses a lot of pins, but has slower (25MHz) reference clock.
It uses 4 data bytes and with 25MHz clock, you get 100Mbit connection.
To enable MII connection mode, open defines.h file and add define like below:
//Enable MII connection mode #define ETHERNET_MII_MODE
ETH PHY |STM32F4xx with ethernet MDIO |PA2 MDC |PC1 REF_CLK |PA1 CRS |PH2 COL |PH3 PPS_OUT |PB5 RXD0 |PC4 RXD1 |PC5 RXD2 |PH6 RXD3 |PH7 RX_ERR |PI10 RX_DV |PA7 RX_CLK |PC3 TX_EN |PG11 TXD0 |PG13 TXD1 |PG14 TXD2 |PC2 TXD3 |PB8
RMII connection uses a small number of pins, but has greater (50MHz) reference clock.
It uses 2 data bytes and with 50MHz clock, you get 100Mbit connection.
RMII mode is supported using 2 pinspacks. By default, PP1 (PinsPack 1) is used. If you want to use PP2, then you need define in defines.h file:
//Enable PinsPack 2 for RMII ethernet: #define ETHERNET_RMII_PINSPACK_2
ETH PHY |STM32F4xx with ethernet
|PP1 |PP2
MDIO |PA2 |PA2
MDC |PC1 |PC1
REF_CLK |PA1 |PA1
CRS |PA7 |PA7
RXD0 |PC4 |PC4
RXD1 |PC5 |PC5
TX_EN |PB11 |PG11
TXD0 |PB12 |PG13
TXD1 |PB13 |PG14
Also, PA8 pins HAVE TO be initialized as MCO alternate function, or communication will not work. Who knows why.
PA8 pin is also MCO output, which has ability to output different clocks.
I've added feature to output HSE crystal on this MCO pin. It can be used for 25MHz output if you have HSE 25MHz crystal and MII connection.
Then you don't need separate crystal for PHY device.
To enable MCO output HSE crystal value, open defines.h file and add define:
//Enable MCO output with HSE clock #define ETHERNET_MCO_CLOCK
Library supports DHCP to get IP from router. This feature is disabled by default To enable it, you need to add define in defines.h file:
//Enable DHCP #define ETHERNET_USE_DHCP
This library supports more than just DP83848 PHY. Currently, supported list is below. The number which is near text means value you have to set ETHERNET_PHY define in case you want to select custom PHY.
If you want (for example) to use KSZ8081RNA PHY, you need to do this (defines.h):
//Use KSZ8081RNA PHY #define ETHERNET_PHY 2
Version 1.1 - March 18, 2015 - Added support for MII connection - Tested on STM324x9-Eval board Version 1.0 - First release
- STM32F4xx - STM32F4xx RCC - STM32F4xx GPIO - STM32F4xx ETH - defines.h - attributes.h - LwIP stack - TM DELAY - TM GPIO