Skip to content

stm32: Add support for ETH RMII peripheral #3808

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
08313c7
HAL ethernet module enabled
boochow Dec 9, 2017
3d47878
add ethernet module to modnetwork
boochow Dec 9, 2017
e287629
add ethernetif.c from STM32CubeMX sample (STM32Cube_FW_F7_V1.8.0/Proj…
boochow Dec 9, 2017
c0cec2f
stm32: STM32 ethernet driver integrated.
boochow Dec 10, 2017
3a16090
stm32: ethernetif.c selects hal header file according to MCU_SERIES C…
boochow Dec 10, 2017
836bdc5
stm32:NUCLEO_F767ZI/stm32f7xx_hal_conf.h corrected PHY_CONFIG_DELAY v…
boochow Dec 10, 2017
7ccee7c
stm32: ethernet dma table/data buffer moved to fixed RAM area(0x2002000)
boochow Dec 11, 2017
5cfeae6
stm32: ethernetif.c pin configuration changed to refer pin.csv and mp…
boochow Dec 15, 2017
05b153e
stm32: added: generate mac address from hardware id
boochow Dec 15, 2017
6d5e063
stm32: ethernetif.c removed unnecessary comment lines.
boochow Dec 16, 2017
edd7e0b
stm32: boards/NUCLEO_F767ZI/stm32f7x_hal_conf.h shortend PHY_RESET_DE…
boochow Dec 16, 2017
bb2cc7b
stm32: ethernetif.c mac address generator changed to use fnv-1 hash a…
boochow Dec 16, 2017
4699bae
stm32/boards/stm32f746.ld: Add ethernet DMA descriptor table in RAM.
forester3 Mar 12, 2018
726a940
stm32/boards/STM32F7DISC: Enable ETH peripheral.
forester3 Mar 12, 2018
42183dc
stm32/ethernetif: Update pin usage.
dpgeorge May 22, 2018
7903dee
stm32/boards/NUCLEO_F767ZI: Enable lwIP and ETH_RMII.
dpgeorge May 22, 2018
cc0339d
stm32/mpconfigboard_common.h: Add MICROPY_HW_ENABLE_ETH_RMII option.
dpgeorge May 22, 2018
7d5060a
stm32/ethernetif: Make TX and RX buffers just static global variables.
dpgeorge May 23, 2018
0b1d087
stm32/network_ethernet: Use generic ifconfig helper.
dpgeorge Jun 1, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ports/stm32/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,8 @@ SRC_C = \
servo.c \
dac.c \
adc.c \
ethernetif.c \
network_ethernet.c \

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where did you obtain this file from?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Specifically, the network_ethernet.c file

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned above, this PR was superseded by #4541 and network_ethernet.c was replaced by network_lan.c

$(wildcard boards/$(BOARD)/*.c)

ifeq ($(MCU_SERIES),f0)
Expand All @@ -282,6 +284,7 @@ SRC_HAL = $(addprefix $(HAL_DIR)/Src/stm32$(MCU_SERIES)xx_,\
hal_dac.c \
hal_dac_ex.c \
hal_dma.c \
hal_eth.c \
hal_flash.c \
hal_flash_ex.c \
hal_gpio.c \
Expand Down
15 changes: 15 additions & 0 deletions ports/stm32/boards/NUCLEO_F767ZI/mpconfigboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@
#define MICROPY_HW_BOARD_NAME "NUCLEO-F767ZI"
#define MICROPY_HW_MCU_NAME "STM32F767"

#define MICROPY_PY_LWIP (1)

#define MICROPY_HW_HAS_SWITCH (1)
#define MICROPY_HW_HAS_FLASH (1)
#define MICROPY_HW_ENABLE_RNG (1)
#define MICROPY_HW_ENABLE_RTC (1)
#define MICROPY_HW_ENABLE_DAC (1)
#define MICROPY_HW_ENABLE_USB (1)
#define MICROPY_HW_ENABLE_ETH_RMII (1)

#define MICROPY_BOARD_EARLY_INIT NUCLEO_F767ZI_board_early_init
void NUCLEO_F767ZI_board_early_init(void);
Expand Down Expand Up @@ -78,3 +81,15 @@ void NUCLEO_F767ZI_board_early_init(void);
#define MICROPY_HW_USB_FS (1)
#define MICROPY_HW_USB_VBUS_DETECT_PIN (pin_A9)
#define MICROPY_HW_USB_OTG_ID_PIN (pin_A10)

// Ethernet RMII Interface
#define RMII_REF_CLK (pin_A1)
#define RMII_MDIO (pin_A2)
#define RMII_MDC (pin_C1)
#define RMII_MII_CRS_DV (pin_A7)
#define RMII_MII_RXD0 (pin_C4)
#define RMII_MII_RXD1 (pin_C5)
#define RMII_MII_RXER (pin_G2)
#define RMII_MII_TX_EN (pin_G11)
#define RMII_MII_TXD0 (pin_G13)
#define RMII_MII_TXD1 (pin_B13)
10 changes: 10 additions & 0 deletions ports/stm32/boards/NUCLEO_F767ZI/pins.csv
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,13 @@ UART6_RX,PG9
SPI_B_NSS,PA4
SPI_B_SCK,PB3
SPI_B_MOSI,PB5
RMII_REF_CLK,PA1
RMII_MDIO,PA2
RMII_MDC,PC1
RMII_MII_CRS_DV,PA7
RMII_MII_RXD0,PC4
RMII_MII_RXD1,PC5
RMII_MII_RXER,PG2
RMII_MII_TX_EN,PG11
RMII_MII_TXD0,PG13
RMII_MII_TXD1,PB13
6 changes: 3 additions & 3 deletions ports/stm32/boards/NUCLEO_F767ZI/stm32f7xx_hal_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
/* #define HAL_DCMI_MODULE_ENABLED */
#define HAL_DMA_MODULE_ENABLED
/* #define HAL_DMA2D_MODULE_ENABLED */
/* #define HAL_ETH_MODULE_ENABLED */
#define HAL_ETH_MODULE_ENABLED
#define HAL_FLASH_MODULE_ENABLED
/* #define HAL_NAND_MODULE_ENABLED */
/* #define HAL_NOR_MODULE_ENABLED */
Expand Down Expand Up @@ -192,9 +192,9 @@
/* LAN8742A PHY Address*/
#define LAN8742A_PHY_ADDRESS 0x00
/* PHY Reset delay these values are based on a 1 ms Systick interrupt*/
#define PHY_RESET_DELAY ((uint32_t)0x00000FFF)
#define PHY_RESET_DELAY ((uint32_t)0x000000FF)
/* PHY Configuration delay */
#define PHY_CONFIG_DELAY ((uint32_t)0x00000FFFF)
#define PHY_CONFIG_DELAY ((uint32_t)0x000000FF)

#define PHY_READ_TO ((uint32_t)0x0000FFFF)
#define PHY_WRITE_TO ((uint32_t)0x0000FFFF)
Expand Down
16 changes: 16 additions & 0 deletions ports/stm32/boards/STM32F7DISC/mpconfigboard.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
#define MICROPY_HW_BOARD_NAME "F7DISC"
#define MICROPY_HW_MCU_NAME "STM32F746"

#define MICROPY_PY_LWIP (1)

#define MICROPY_HW_HAS_SWITCH (1)
#define MICROPY_HW_HAS_FLASH (1)
#define MICROPY_HW_HAS_SDCARD (1)
#define MICROPY_HW_ENABLE_RNG (1)
#define MICROPY_HW_ENABLE_RTC (1)
#define MICROPY_HW_ENABLE_USB (1)
#define MICROPY_HW_ENABLE_ETH_RMII (1)

#define MICROPY_BOARD_EARLY_INIT STM32F7DISC_board_early_init
void STM32F7DISC_board_early_init(void);
Expand Down Expand Up @@ -78,3 +81,16 @@ void STM32F7DISC_board_early_init(void);
#define MICROPY_HW_USB_FS (1)
/*#define MICROPY_HW_USB_VBUS_DETECT_PIN (pin_J12)*/
#define MICROPY_HW_USB_OTG_ID_PIN (pin_A10)

// Ethernet RMII Interface
#define RMII_REF_CLK (pin_A1)
#define RMII_MDIO (pin_A2)
#define RMII_MDC (pin_C1)
#define RMII_MII_CRS_DV (pin_A7)
#define RMII_MII_RXD0 (pin_C4)
#define RMII_MII_RXD1 (pin_C5)
#define RMII_MII_RXER (pin_G2)
#define RMII_MII_TX_EN (pin_G11)
#define RMII_MII_TXD0 (pin_G13)
#define RMII_MII_TXD1 (pin_G14)

10 changes: 10 additions & 0 deletions ports/stm32/boards/STM32F7DISC/pins.csv
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,13 @@ VCP_TX,PA9
VCP_RX,PB7
CAN_TX,PB13
CAN_RX,PB12
RMII_REF_CLK,PA1
RMII_MDIO,PA2
RMII_MDC,PC1
RMII_MII_CRS_DV,PA7
RMII_MII_RXD0,PC4
RMII_MII_RXD1,PC5
RMII_MII_RXER,PG2
RMII_MII_TX_EN,PG11
RMII_MII_TXD0,PG13
RMII_MII_TXD1,PG14
2 changes: 1 addition & 1 deletion ports/stm32/boards/STM32F7DISC/stm32f7xx_hal_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
/* #define HAL_DCMI_MODULE_ENABLED */
#define HAL_DMA_MODULE_ENABLED
/* #define HAL_DMA2D_MODULE_ENABLED */
/* #define HAL_ETH_MODULE_ENABLED */
#define HAL_ETH_MODULE_ENABLED
#define HAL_FLASH_MODULE_ENABLED
/* #define HAL_NAND_MODULE_ENABLED */
/* #define HAL_NOR_MODULE_ENABLED */
Expand Down
11 changes: 10 additions & 1 deletion ports/stm32/boards/stm32f746.ld
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,22 @@ MEMORY
FLASH_FS (r) : ORIGIN = 0x08008000, LENGTH = 96K /* sectors 1, 2, 3 (32K each) */
FLASH_TEXT (rx) : ORIGIN = 0x08020000, LENGTH = 896K /* sectors 4-7 1*128Kib 3*256KiB = 896K */
DTCM (xrw) : ORIGIN = 0x20000000, LENGTH = 64K /* Used for storage cache */
RAM (xrw) : ORIGIN = 0x20010000, LENGTH = 256K /* SRAM1 = 240K, SRAM2 = 16K */
ETH_RXDMA (rw) : ORIGIN = 0x20010000, LENGTH = 256 /* 32 * 5 bytes for DMARxDscrTab in ethernetif.c */
ETH_TXDMA (rw) : ORIGIN = 0x20010100, LENGTH = 256 /* 32 * 5 bytes for DMATxDscrTab in ethernetif.c */
RAM (xrw) : ORIGIN = 0x20014000, LENGTH = 240K /* SRAM1 = 240K, SRAM2 = 16K */
}

/* produce a link error if there is not this amount of RAM for these sections */
_minimum_stack_size = 2K;
_minimum_heap_size = 16K;

/* Ethernet DMA Descriptor table / buffer */
SECTIONS
{
.RxDescripSection : { *(.DMARxDscrTab_section) } >ETH_RXDMA
.TxDescripSection : { *(.DMATxDscrTab_section) } >ETH_TXDMA
}

/* Define tho top end of the stack. The stack is full descending so begins just
above last byte of RAM. Note that EABI requires the stack to be 8-byte
aligned for a call. */
Expand Down
12 changes: 11 additions & 1 deletion ports/stm32/boards/stm32f767.ld
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,23 @@ MEMORY
FLASH_FS (r) : ORIGIN = 0x08008000, LENGTH = 96K /* sectors 1, 2, 3 (32K each) */
FLASH_TEXT (rx) : ORIGIN = 0x08020000, LENGTH = 896K /* sectors 4-7 1*128Kib 3*256KiB = 896K */
DTCM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K /* Used for storage cache */
RAM (xrw) : ORIGIN = 0x20020000, LENGTH = 384K /* SRAM1 = 368K, SRAM2 = 16K */
ETH_RXDMA (rw) : ORIGIN = 0x20020000, LENGTH = 256 /* 32 * 5 bytes for DMARxDscrTab in ethernetif.c */
ETH_TXDMA (rw) : ORIGIN = 0x20020100, LENGTH = 256 /* 32 * 5 bytes for DMATxDscrTab in ethernetif.c */
RAM (xrw) : ORIGIN = 0x20024000, LENGTH = 368K /* SRAM1 = 368K, SRAM2 = 16K */
}

/* produce a link error if there is not this amount of RAM for these sections */
_minimum_stack_size = 2K;
_minimum_heap_size = 16K;


/* Ethernet DMA Descriptor table / buffer */
SECTIONS
{
.RxDescripSection : { *(.DMARxDscrTab_section) } >ETH_RXDMA
.TxDescripSection : { *(.DMATxDscrTab_section) } >ETH_TXDMA
}

/* Define tho top end of the stack. The stack is full descending so begins just
above last byte of RAM. Note that EABI requires the stack to be 8-byte
aligned for a call. */
Expand Down
Loading