STM32Cube  Version 1.3.0
Create Projects for STM32H5 Series with STM32Cube HAL and STM32CubeMX
Ethernet MAC

Revision History

  • Version 1.0
    • Initial release

Instances

Hardware resource relating to driver instance is shown in the table below:

Driver Instance Hardware Resource
Driver_ETH_MAC0 EMAC

Limitations

Descriptor and data buffers location:

  • Memory for ETH DMA Descriptors (DMARxDscrTab and DMATxDscrTab) must be configured as: non-cacheable, non-shareable device memory, execute never
  • Memory for ETH data buffers (Rx_Buff and Tx_Buff) must be configured as: non-cacheable, non-shareable normal memory, execute never

Configuration

Compile-time

Definitions used for compile-time configuration of this driver are shown in the table below:

Definition Default value Value Description
EMAC_CHECKSUM_OFFLOAD 1 1 Receive/transmit Checksum offload: enabled
0 Receive/transmit Checksum offload: disabled
EMAC_TIME_STAMP 0 1 IEEE 1588 time stamping (PTP): enabled
0 IEEE 1588 time stamping (PTP): disabled

STM32CubeMX

The CMSIS-Driver EMAC requires:

  • PLL1Q clock configured to 200MHz or lower
  • ETH peripheral configured in MII or RMII mode
  • NVIC configured to enabled Ethernet global interrupt
  • DMA descriptors and data buffers located in internal memory
Note
The User Label name is used to connect the CMSIS-Driver to the GPIO pin.

NUCLEO-H563ZI board configuration

These settings are relevant for this board, for different board please refer to the board schematic for proper configuration.

Link to NUCLEO-H563ZI board schematic.

STM32CubeMX

Required peripherals for the NUCLEO-H563ZI board are listed in the table below:

Peripheral Mode Description
ETH RMII ETH Controller
PA1 Alternate Function Push Pull ETH REF_CLK Pin
PA2 Alternate Function Push Pull ETH MDIO Pin
PA7 Alternate Function Push Pull ETH CRS_DV Pin
PB15 Alternate Function Push Pull ETH TXD1 Pin
PC1 Alternate Function Push Pull ETH_MDC Pin
PC4 Alternate Function Push Pull ETH RXD0 Pin
PC5 Alternate Function Push Pull ETH RXD1 Pin
PG11 Alternate Function Push Pull ETH TX_EN Pin
PG13 Alternate Function Push Pull ETH TXD0 Pin
Note
All settings have to be configured as described in the procedure below. Important settings, typically the ones different from default, are emphasized in bold.

Pinout & Configuration tab

  1. In the Pinout view window click on a pin and select it's functionality:
    Pin Functionality
    PA1 ETH_REF_CLK
    PA2 ETH_MDIO
    PA7 ETH_CRS_DV
    PB15 ETH TXD1
    PC1 ETH_MDC
    PC4 ETH RXD0
    PC5 ETH RXD1
    PG11 ETH TX_EN
    PG13 ETH TXD0

  2. Under Categories: Connectivity select ETH:

    Mode:

    • Mode: RMII
    • Activate Rx Err signal: unchecked

    Configuration:

    • Parameter Settings:
      General: Ethernet Configuration Value
      Ethernet MAC Address unused
      Tx Descriptor Length 4
      Rx Descriptor Length 4
      Rx Buffers Length 1524

    • User Constants: not used
    • NVIC Settings: configured in later step (under Category: System Core: NVIC)
    • GPIO Settings:
      Pin Name Signal on Pin Pin Context.. GPIO output.. GPIO mode GPIO Pull-up/Pull.. Maximum out.. Fast Mode User Label
      PA1 ETH_REF_CLK n/a n/a Alternate Function Push Pull No pull-up and no.. High n/a .
      PA2 ETH_MDIO n/a n/a Alternate Function Push Pull No pull-up and no.. High n/a .
      PA7 ETH_CRS_DV n/a n/a Alternate Function Push Pull No pull-up and no.. High n/a .
      PB15 ETH TXD1 n/a n/a Alternate Function Push Pull No pull-up and no.. High n/a .
      PC1 ETH_MDC n/a n/a Alternate Function Push Pull No pull-up and no.. High n/a .
      PC4 ETH RXD0 n/a n/a Alternate Function Push Pull No pull-up and no.. High n/a .
      PC5 ETH RXD1 n/a n/a Alternate Function Push Pull No pull-up and no.. High n/a .
      PG11 ETH TX_EN n/a n/a Alternate Function Push Pull No pull-up and no.. High n/a .
      PG13 ETH TXD0 n/a n/a Alternate Function Push Pull No pull-up and no.. High n/a .

  3. Under Categories: System Core select NVIC:

    Configuration:

    • NVIC:
      NVIC Interrupt Table Enabled Preemption Priority Sub Priority
      Ethernet global interrupt checked 0 0
      Ethernet Wakeup global interrupt checked 0 0
    • Code generation:
      Enabled interrupt table Select for.. Generate Enable in.. Generate IRQ h.. Call HAL handler
      Ethernet global interrupt unchecked checked checked checked
      Ethernet Wakeup global interrupt unchecked checked checked checked

Clock Configuration tab

  1. Configure To ETH (MHz): 200

Project Manager tab

  1. Under Advanced Settings:

    Generated Function Calls:

    Generate Code Function Name Peripheral Inst.. Do not generate .. Visibility (Static)
    checked MX_ETH_Init ETH checked checked

Generate Code

Generate source code by clicking on the GENERATE CODE button on the toolbar.

Validation

Results of the CMSIS-Driver Validation for this driver can be found in the EMAC_TestReport.txt file.