cancel
Showing results for 
Search instead for 
Did you mean: 

CubeIDE 1.9.0, and CubeH7 1.10.0 does not generate HAL_ETH_MspInit.

Sokolowski.Tomasz
Associate II

Problem with generating initialization code for ETH. After updating my project written in CubeIDE 1.8.0 and CubeH7 1.9.1 do Cube IDE 1.9.0 and CubeH7 1.10.0 Ethernet stopped working. After short investigation I find out that CubeMX does not generated HAL_ETH_MspInit, this is part where GPIO is configured. When I added missing functions from previous version everything start to work. I also tried to generate new project and it still miss HAL_ETH_MspInit.

Is it known issue?

Edit:

It happens also when I use CubeIDE 1.9.0 and CubeH7 1.9.1, so probably its CubeIDE problem.

1 ACCEPTED SOLUTION

Accepted Solutions
Sara BEN HADJ YAHYA
ST Employee

Hello @Sokolowski.Tomasz​ ,

It turns out that it is mandatory to set the BSP component in Platform Settings as explained in the "General Settings" tab of LwIP. By leaving it "Undefined", HAL_ETH_MspInit() will not be generated which is a normal behavior and not an issue since the LwIP is not completely configured.

0693W00000Nr9pGQAR.pngSara.

View solution in original post

11 REPLIES 11
Sara BEN HADJ YAHYA
ST Employee

Hello @Sokolowski.Tomasz​ ,

Thanks for your feedback,

Could you please specify which MCU are you using or share an ioc file to help us reproduce the issue.

Thanks,

Sara.

Sokolowski.Tomasz
Associate II

It is STM32H753IITx. I am using Windows 10 Pro.

Tomasz

Sara BEN HADJ YAHYA
ST Employee

Hello @Sokolowski.Tomasz​ ,

I tested from my part and I don't see any issue, the HAL_ETH_MspInit() function is generated correctly.

I tried the CubeMX standalone version (v6.5.0) and I also tested the MX plugin in CubeIDE (v1.9.0) and as I said nothing unusual was seen.

I need a detailed scenario or your ioc file to help me reproduce the issue.

Thanks,

Sara.

Hello @Sara BEN HADJ YAHYA​ 

In attachment you will find my test project with only eth configured. Maybe I am doing something wrong.

Sara BEN HADJ YAHYA
ST Employee

Hello @Sokolowski.Tomasz​ ,

You are right, I see the issue now. It seems that the HAL_ETH_MspInit() doesn't get generated in ethernetif.c file when LAN8742 is not selected as a solution in LWIP Platform settings in CubeMX UI.

I submitted a ticket to the dev team to fix this issue. I will keep you posted.

Internal ticket number: 129696 (This is an internal tracking number and is not accessible or usable by customers).

In the meantime, I advice you to change the solution from Undefined to LAN8742. By doing this, HAL_ETH_MspInit() will get generated correctly.

0693W00000Nr6m9QAB.pngI hope this helps !

If your issue is solved, please close this post by clicking the "Select as Best" button. This will help other members of the community find this response more quickly 🙂

Sara.

Sokolowski.Tomasz
Associate II

Hello @Sara BEN HADJ YAHYA​ 

Thank you for information. In sometime I plan to change to LAN8742 but this requires hardware changes. Currently we using LAN8720A and I have to use this custom configuration.

Tomasz

Sara BEN HADJ YAHYA
ST Employee

Hello @Sokolowski.Tomasz​ ,

It turns out that it is mandatory to set the BSP component in Platform Settings as explained in the "General Settings" tab of LwIP. By leaving it "Undefined", HAL_ETH_MspInit() will not be generated which is a normal behavior and not an issue since the LwIP is not completely configured.

0693W00000Nr9pGQAR.pngSara.

Sokolowski.Tomasz
Associate II

Hello @Sara BEN HADJ YAHYA​ 

Thank you for answer. But the main problem is that I don't use LAN8742 and when I choose as you said I will get code which will not work with my PHY. Moreover when I will delete his generated code and put my own it will be overwritten by CubeMX on next generation.

This behavior is somehow illogical. Because GPIOs for Ethernet we configure in ETH section not in LwIP. ETH is hardware configuration. LwIP and PHY driver are more software configuration. This two parts should be independent, because we can user another stack eg. Azure RTOS NetX or another PHY. Option custom PHY would be great.

Tomasz

Sara BEN HADJ YAHYA
ST Employee

Hello @Sokolowski.Tomasz​ ,

To have HAL_ETH_MspInit() and HAL_ETH_MspDeInit() code generated with the current implementation, it is necessary to select a BSP component. However, there is a workaround for your case. You can generate the needed functions without choosing the BSP component. To do so, please follow the following steps:

  • Navigate to templates folder in STM32CubeMX install folder ( C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeMX\db\templates )
  • Open ethernetif_h7.ftl file
  • move "[#include mxTmpFolder+"/eth_Msp.tmp"]" just before "[#if bsp == 1]" condition
  • Save the file

I hope this helps 😊

Please, try to apply the proposed workaround. If you face any issue don't hesitate to get back to me.

Sara.