cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H7S3 CubeMX bug - ETH_CLK pin not initialized when using external clock source for Ethernet PHY

Happybolt
Associate II

Hello,

I found a bug in STM32CubeMX code generation for STM32H7S3.

When configuring Ethernet with external clock input (ETH_CLK pin,
PD6 with AF4_ETH) as PHY clock source, CubeMX does not generate
GPIO initialization for this pin in HAL_ETH_MspInit().

Workaround - must add manually:

__HAL_RCC_GPIOD_CLK_ENABLE();
GPIO_InitStruct.Pin = GPIO_PIN_6;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF4_ETH;
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);

Without this, Ethernet does not work even though all other
ETH pins are correctly initialized by CubeMX.

Steps to reproduce:
1. Select STM32H7S3
2. Enable Ethernet (ETH)
3. Set clock source to external clock via ETH_CLK pin (PD6)
4. Generate code
5. ETH_CLK pin GPIO init is missing in generated code

CubeMX version: 6.17.0
MCU: STM32H7S3

Thank you

1 ACCEPTED SOLUTION

Accepted Solutions

Hello @Happybolt 

Your contribution is much appreciated.

Issue has been escalated to dev team under internal ticket ID #0060894

I will keep you posted with updates.

THX

Ghofrane

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

3 REPLIES 3
TDK
Super User

Unable to duplicate. Please include your IOC file.

If you feel a post has answered your question, please click "Accept as Solution".

Made a new project and added ETH peripheral. PD6 (ETH_CLK) GPIO is not initialized in generated code. However, PHY clock generation is configured: PeriphClkInit.Eth1PhyClockSelection = RCC_ETH1PHYCLKSOURCE_HSE;

Hello @Happybolt 

Your contribution is much appreciated.

Issue has been escalated to dev team under internal ticket ID #0060894

I will keep you posted with updates.

THX

Ghofrane

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.