HAL ETH Overview

Introducing ETH

group ETH_Introduction

The Ethernet peripheral enables devices to transmit and receive data over Ethernet in compliance with the IEEE 802.3-2002 standard.

The Ethernet peripheral provides a configurable, flexible interface to meet the needs of various applications and customers. It supports two industry-standard interfaces to the external physical layer (PHY): the default media-independent interface (MII) defined in the IEEE 802.3 specifications and the reduced media-independent interface (RMII). It can be used in a number of applications such as switches and network interface cards.

In addition to the default interfaces defined in the IEEE 802.3 specifications, the Ethernet peripheral supports several industry-standard interfaces to the PHY. It is compliant with the following standards:
  • IEEE 802.3-2015 for Ethernet MAC and media independent interface (MII)

  • IEEE 1588-2008 for precision networked clock synchronization (PTP)

  • IEEE 802.1AS-2011 and 802.1-Qav-2009 for Audio Video (AV) traffic

  • IEEE 802.3az-2010 for Energy Efficient Ethernet (EEE)

  • AMBA 2.0 for AHB slave port

  • AMBA4 for AXI master port

  • RGMII specification version 2.6 from HP/Marvell

  • RMII specification version 1.2 from RMII consortium

Main features

The software allows use of all features offered by the Ethernet hardware IP.

The main features supported by the Ethernet HAL driver are summarized below:

  • Configure MAC, MTL and DMA parameters

  • Transmit packets in polling and interrupt mode

  • Receive packets in polling and interrupt mode

  • Configure and enable MAC filters

  • Configure and enable PTP

  • Configure and enable ARP offload

  • Manage multi-queuing in transmission and reception if supported.

    • Manage queue priorities

  • Configure and enable Audio/Video (AV) features if supported:

    • Select AV Queues

    • IEEE 802.1-Qav: Credit-Based Shaper (CBS) algorithm

  • Configure and enable TSN features if supported:

    • IEEE 802.1Qbv-2015: Enhancements to Scheduling Traffic

    • IEEE 802.1Qbu/802.3br: Frame preemption and Interspersing Express Traffic

    • Time-based scheduling (TBS)

  • Detect and manage errors.

Module and files

The following diagram illustrates the ETH module and its associated files.

Module and files diagram

Component diagram

The following diagram illustrates the software components involved in the ETH module. It shows the interactions between the user application, HAL drivers, low-level drivers, and the hardware components.


@startuml
<style>
componentDiagram {
   arrow {
      FontSize 10
   }
}
</style>

title ETH Software Component Diagram

package "MW" {
    [TCP/IP]
}

package "HAL" {
    [HAL_SERVICE]
    [HAL_ETH]
}

package "Low Layer" {
    [CMSIS]
    [ETH Interrupt routine service]
}

package "HW" {
    [STM32_HW]
}

[Appli] <-d- [TCP/IP]

[TCP/IP] --> [HAL_ETH] : <b>HAL ETH API
[TCP/IP] <-- [HAL_ETH] : <b>HAL ETH Callback

[HAL_ETH] -l-> [HAL_SERVICE]
[HAL_ETH] <-- [ETH Interrupt routine service]
[HAL_ETH] -d-> [CMSIS]: <b>ETH register def

[STM32_HW] -u-> [ETH Interrupt routine service] : <b>ETH IRQ
[STM32_HW] <-l- [CMSIS] : <b>ETH registers R/W
@enduml

Configuration table

The following table lists the configuration defines for the HAL ETH module, specifying their locations, default values, and descriptions:

group ETH_Configuration_Table

Configuration inside the ETH driver

Config defines

Description

Default value

Note

PRODUCT

from IDE

NA

The selected device (e.g. STM32C5XXxx)

USE_HAL_ETH_MODULE

from hal_conf.h

1

Allows use of the HAL ETH module.

USE_ASSERT_DBG_PARAM

from IDE

None

Allows use of the assert check parameters.

USE_ASSERT_DBG_STATE

from IDE

None

Allows use of the assert check states.

USE_HAL_CHECK_PARAM

from hal_conf.h

0

Allows use of the run-time checks parameters.

USE_HAL_CHECK_PROCESS_STATE

from hal_conf.h

0

Enables atomic access to process state check.

USE_HAL_ETH_CLK_ENABLE_MODEL

from hal_conf.h

HAL_CLK_ENABLE_NO

Enables gating of the peripheral clock.

USE_HAL_ETH_GET_LAST_ERRORS

from hal_conf.h

0

Allows use of the error code mechanism.

USE_HAL_ETH_USER_DATA

from hal_conf.h

0

Allows use of user data.

USE_HAL_ETH_ATOMIC_CHANNEL_LOCK

from hal_conf.h

0

Enables atomic access to channel resources.

USE_HAL_ETH_REGISTER_CALLBACKS

from hal_conf.h

0

Enables the registration of callbacks.

USE_HAL_ETH_MAX_TX_CH_NB

from hal_conf.h

Defined

User-defined number of Transmit Channels.

USE_HAL_ETH_MAX_RX_CH_NB

from hal_conf.h

Defined

User-defined number of Receive Channels.