Skip to main content
VaZso
Associate III
March 17, 2022
Solved

STM32F4 HAL ETH broken

  • March 17, 2022
  • 3 replies
  • 3917 views

I have tried to generate a new project using STM32CubeIDE from scratch (fw V1.27.0, no way to modify it[!!!]) but it does not compile.

A lot of descriptors are missing, like there is no resolution for the following:

ETH_TxPacketConfig TxConfig;
ETH_DMADescTypeDef DMARxDscrTab[ETH_RX_DESC_CNT]; /* Ethernet Rx DMA Descriptors */
ETH_DMADescTypeDef DMATxDscrTab[ETH_TX_DESC_CNT]; /* Ethernet Tx DMA Descriptors */

No ETH_TxPacketConfig and ETH_RX_DESC_CNT and ETH_TX_DESC_CNT defined anywhere.

Also, there is no HAL_ETH_RMII_MODE defined (for example) anywhere and if I try to resolve these issues, it reveals:

ETH_InitTypeDef does not have TxDesc and RxDesc and RxBuffLen members, so practically ethernet layer is completely messed up.

This topic has been closed for replies.
Best answer by Sara BEN HADJ YAHYA

Hello,

This is actually not an issue, it is a new implementation.

The ETH_InitTypeDef has a new definition. As an example, In V1.26.2, TxDesc and RxDesc and RxBuffLen were not defined but in V1.27.0 they exists and they are mentioned in stm32f4xx_hal_eth.h, HAL_ETH_RMII_MODE was defined as ETH_MEDIA_INTERFACE_RMII in the previous FW version.

When the project is created with CubeMX 6.5.0 the FW has to be v1.27.0 otherwise there will be compilation errors.

Sara.

3 replies

Pavel A.
Super User
March 17, 2022

This is likely because in 1.27.2 the ETH driver has undergone major changes (aka "reworked"); this change requires also change in the user code.

The previous ETH driver version is in STM32F4xx_HAL_Driver/Src/Legacy/

Try to build with that. If it works, consider updating your code to the new driver.

VaZso
VaZsoAuthor
Associate III
March 17, 2022

Right but it is a code generated from scratch, so there are no user codes written by me there.

Practically this is an STM32CubeMX/IDE version which contains an updated ETH driver code but outdated code generation - so it should has not been released yet considering ETH function.

So I have no user code in this project, it was simply fresh-generated but ETH was messed up...

Sara BEN HADJ YAHYA
Technical Moderator
March 22, 2022

Hello @VaZso​ ,

Thanks for your feedback,

Could you please share your ioc file?

Thanks,

Sara.

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question.
VaZso
VaZsoAuthor
Associate III
March 22, 2022

Thank you your reply.

Now I have disabled almost everything except ETH and some other things.

After completely deleting project files (except .ioc) then regenerating project in STM32CubeIDE, it misses respective PHY files and if I copy them from GitHUB location of latest firmware, it still drops a lot of errors regarding ethernet interface.

If I do not select PHY, it simply drops a lot of errors regarding ethernet interface.

These errors are related to missing macros and incorrect type definitions.

If it matters, I am running it under Linux.

Project's IOC file is attached and here are some compiling errors:

../Src/ethernetif.c:100:34: error: 'ETH_RX_DESC_CNT' undeclared here (not in a function)
 100 | ETH_DMADescTypeDef DMARxDscrTab[ETH_RX_DESC_CNT]; /* Ethernet Rx DMA Descriptors */
 | ^~~~~~~~~~~~~~~
../Src/ethernetif.c:101:34: error: 'ETH_TX_DESC_CNT' undeclared here (not in a function)
 101 | ETH_DMADescTypeDef DMATxDscrTab[ETH_TX_DESC_CNT]; /* Ethernet Tx DMA Descriptors */
 | ^~~~~~~~~~~~~~~
../Src/ethernetif.c:109:1: error: unknown type name 'ETH_TxPacketConfig'
 109 | ETH_TxPacketConfig TxConfig;
 | ^~~~~~~~~~~~~~~~~~
../Src/ethernetif.c: In function 'low_level_init':
../Src/ethernetif.c:160:30: error: 'HAL_ETH_RMII_MODE' undeclared (first use in this function); did you mean 'IS_ETH_RX_MODE'?
 160 | heth.Init.MediaInterface = HAL_ETH_RMII_MODE;
 | ^~~~~~~~~~~~~~~~~
 | IS_ETH_RX_MODE
../Src/ethernetif.c:160:30: note: each undeclared identifier is reported only once for each function it appears in
../Src/ethernetif.c:161:12: error: 'ETH_InitTypeDef' has no member named 'TxDesc'
 161 | heth.Init.TxDesc = DMATxDscrTab;
 | ^
../Src/ethernetif.c:162:12: error: 'ETH_InitTypeDef' has no member named 'RxDesc'
 162 | heth.Init.RxDesc = DMARxDscrTab;
 | ^
../Src/ethernetif.c:163:12: error: 'ETH_InitTypeDef' has no member named 'RxBuffLen'
 163 | heth.Init.RxBuffLen = 1536;

Sara BEN HADJ YAHYA
Technical Moderator
July 15, 2022

Hello,

This is actually not an issue, it is a new implementation.

The ETH_InitTypeDef has a new definition. As an example, In V1.26.2, TxDesc and RxDesc and RxBuffLen were not defined but in V1.27.0 they exists and they are mentioned in stm32f4xx_hal_eth.h, HAL_ETH_RMII_MODE was defined as ETH_MEDIA_INTERFACE_RMII in the previous FW version.

When the project is created with CubeMX 6.5.0 the FW has to be v1.27.0 otherwise there will be compilation errors.

Sara.

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question.