STM32Cube  Version 2.0
Create Projects for STM32H7 Series with STM32Cube HAL and STM32CubeMX
 All Files Functions Variables Macros Pages
CMSIS-Driver Ethernet MAC Setup

The CMSIS-Driver EMAC requires:

  • Setup of AHB1 clock to 200MHz or lower
  • Setup of ETH in MII or RMII mode
  • Setup of NVIC to enable Ethernet global interrupt
  • Setup of DMA descriptors and data buffers to AXI SRAM (D1) or AHB SRAM (D2 or D3)
  • Setup MPU to disable CPU DCache when accessing Ethernet DMA descriptors
Note
The User Label name is used to connect the CMSIS-Driver to the GPIO pin.

The example below uses correct settings for STM32H743I-EVAL:

  • ETH Mode: RMII

For different boards, refer to the hardware schematics to reflect correct setup values.

The STM32CubeMX configuration steps for Pinout, Clock, and System Configuration are listed below. Enter the values that are marked bold.

Pinout tab

  1. Configure ETH mode
    • Peripherals ETH: Mode=RMII

Clock Configuration tab

  1. Configure AHB1 Clock: To AHB1,2 Peripheral Clocks (MHz) = 200MHz or lower

Configuration tab

  1. Under Connectivity open ETH Configuration:

    • GPIO Settings: review settings, no changes required
      Pin Name Signal on Pin GPIO mode GPIO Pull-up/Pull..Maximum out User Label
      PA1 ETH_REF_CLK Alternate No pull-up and no..High .
      PA2 ETH_MDIO Alternate No pull-up and no..High .
      PA7 ETH_CRS_DV Alternate No pull-up and no..High .
      PC1 ETH_MDC Alternate No pull-up and no..High .
      PC4 ETH_RXD0 Alternate No pull-up and no..High .
      PC5 ETH_RXD1 Alternate No pull-up and no..High .
      PG11 ETH_TX_EN Alternate No pull-up and no..High .
      PG13 ETH_TXD0 Alternate No pull-up and no..High .
      PG14 ETH_TXD1 Alternate No pull-up and no..High .
    • NVIC Settings: enable interrupts
      Interrupt Table Enable Preemption Priority Sub Priority
      Ethernet global interrupt ON 0 0
    • Parameter Settings: configure descriptor and RX buffer memory locations
      General:Ethernet Configuration Value
      Ethernet MAC Address unused
      Tx Descriptor Length 4
      First Tx Descriptor Address 0x30040060
      Rx Descriptor Length 4
      First Rx Descriptor Address 0x30040000
      Rx Buffers Address 0x30040200
      Rx Buffers Length 1524
    • User Constants: not used

    Click OK to close the ETH Configuration dialog

  2. Under System open CORTEX_M7 Configuration
    • Parameter Settings: optionally enable cache and configure MPU
      Cortex Interface Settings Value
      CPU ICache Enabled (optional)
      CPU DCache Length Enabled (optional)
      Cortex MPU Control Settings Value
      MPU Control Mode Background Region Privileged accesses only
      Cortex MPU Region 0 Settings Value
      MPU Region Enabled
      MPU Region Base Address 0x30040000
      MPU Region Size 256B
      MPU SubRegion Disable 0x0
      MPU TEX field level level 0
      MPU Access Permission ALL ACCESS PERMITTED
      MPU Instruction Access ENABLE
      MPU Shareability Permission ENABLE
      MPU Cacheable Permission DISABLE
      MPU Bufferable Permission ENABLE