From 1de688c35239745774491f7f1c06ceb293a61dc6 Mon Sep 17 00:00:00 2001 From: Alexandre Abadie Date: Sun, 13 Mar 2022 18:17:33 +0100 Subject: [PATCH] boards/nucleo-f429zi: add support for ethernet --- boards/nucleo-f429zi/Kconfig | 1 + boards/nucleo-f429zi/Makefile.dep | 4 +++ boards/nucleo-f429zi/Makefile.features | 1 + boards/nucleo-f429zi/include/periph_conf.h | 29 ++++++++++++++++++++++ tests/Makefile.boards.netif | 1 + 5 files changed, 36 insertions(+) diff --git a/boards/nucleo-f429zi/Kconfig b/boards/nucleo-f429zi/Kconfig index 67369229d7..6180a1b3ed 100644 --- a/boards/nucleo-f429zi/Kconfig +++ b/boards/nucleo-f429zi/Kconfig @@ -17,6 +17,7 @@ config BOARD_NUCLEO_F429ZI # Put defined MCU peripherals here (in alphabetical order) select HAS_PERIPH_ADC select HAS_PERIPH_DMA + select HAS_PERIPH_ETH select HAS_PERIPH_I2C select HAS_PERIPH_PWM select HAS_PERIPH_RTC diff --git a/boards/nucleo-f429zi/Makefile.dep b/boards/nucleo-f429zi/Makefile.dep index 7294858272..3e965d26ad 100644 --- a/boards/nucleo-f429zi/Makefile.dep +++ b/boards/nucleo-f429zi/Makefile.dep @@ -1 +1,5 @@ +ifneq (,$(filter netdev_default,$(USEMODULE))) + USEMODULE += stm32_eth +endif + include $(RIOTBOARD)/common/nucleo/Makefile.dep diff --git a/boards/nucleo-f429zi/Makefile.features b/boards/nucleo-f429zi/Makefile.features index a718321d99..9e973c9028 100644 --- a/boards/nucleo-f429zi/Makefile.features +++ b/boards/nucleo-f429zi/Makefile.features @@ -4,6 +4,7 @@ CPU_MODEL = stm32f429zi # Put defined MCU peripherals here (in alphabetical order) FEATURES_PROVIDED += periph_adc FEATURES_PROVIDED += periph_dma +FEATURES_PROVIDED += periph_eth FEATURES_PROVIDED += periph_i2c FEATURES_PROVIDED += periph_pwm FEATURES_PROVIDED += periph_rtc diff --git a/boards/nucleo-f429zi/include/periph_conf.h b/boards/nucleo-f429zi/include/periph_conf.h index d3c5c94e3c..1cf3b9501c 100644 --- a/boards/nucleo-f429zi/include/periph_conf.h +++ b/boards/nucleo-f429zi/include/periph_conf.h @@ -34,6 +34,7 @@ #include "cfg_i2c1_pb8_pb9.h" #include "cfg_timer_tim5.h" #include "cfg_usb_otg_fs.h" +#include "mii.h" #ifdef __cplusplus extern "C" { @@ -46,10 +47,12 @@ extern "C" { static const dma_conf_t dma_config[] = { { .stream = 11 }, /* DMA2 Stream 3 - SPI1_TX */ { .stream = 10 }, /* DMA2 Stream 2 - SPI1_RX */ + { .stream = 8 }, /* DMA2 Stream 0 - ETH_TX */ }; #define DMA_0_ISR isr_dma2_stream3 #define DMA_1_ISR isr_dma2_stream2 +#define DMA_2_ISR isr_dma2_stream0 #define DMA_NUMOF ARRAY_SIZE(dma_config) /** @} */ @@ -193,6 +196,32 @@ static const adc_conf_t adc_config[] = { #define ADC_NUMOF ARRAY_SIZE(adc_config) /** @} */ +/** + * @name ETH configuration + * @{ + */ +static const eth_conf_t eth_config = { + .mode = RMII, + .speed = MII_BMCR_SPEED_100 | MII_BMCR_FULL_DPLX, + .dma = 2, + .dma_chan = 8, + .phy_addr = 0x00, + .pins = { + GPIO_PIN(PORT_G, 13), + GPIO_PIN(PORT_B, 13), + GPIO_PIN(PORT_G, 11), + GPIO_PIN(PORT_C, 4), + GPIO_PIN(PORT_C, 5), + GPIO_PIN(PORT_A, 7), + GPIO_PIN(PORT_C, 1), + GPIO_PIN(PORT_A, 2), + GPIO_PIN(PORT_A, 1), + } +}; + +#define ETH_DMA_ISR isr_dma2_stream0 +/** @} */ + #ifdef __cplusplus } #endif diff --git a/tests/Makefile.boards.netif b/tests/Makefile.boards.netif index 6dfcb2ea97..aaf746ec44 100644 --- a/tests/Makefile.boards.netif +++ b/tests/Makefile.boards.netif @@ -32,6 +32,7 @@ BOARD_PROVIDES_NETIF := \ nrf52dk \ nrf6310 \ nucleo-f207zg \ + nucleo-f429zi \ nucleo-f767zi \ openlabs-kw41z-mini \ openlabs-kw41z-mini-256kib \