cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4 HAL ETH broken

VaZso
Associate III

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Sara BEN HADJ YAHYA
ST Employee

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.

View solution in original post

8 REPLIES 8
Pavel A.
Evangelist III

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.

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...

Moreover, these codes are generated in main at places where user can not redefine it easily (not in USER section).

Yes this is the situation, you're right. We'll have to live with it for some time, until they get around to update the templates.

Sara BEN HADJ YAHYA
ST Employee

Hello @VaZso​ ,

Thanks for your feedback,

Could you please share your ioc file?

Thanks,

Sara.

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;

This is still not fixed. Any idea for when ST will come with a fix ?

Sara BEN HADJ YAHYA
ST Employee

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.