STM32F767ZI Ethernet not working without MX_USB_OTG_FS_PCD_Init()
I am using an STM32 Nucleo-F767ZI with RMII Ethernet + LAN8742A PHY and an example project based on lwIP/TCP-IP.
I noticed a strange behavior: if I comment out MX_USB_OTG_FS_PCD_Init(), Ethernet communication stops working. If I keep it enabled, Ethernet works correctly.
The peripheral initialization order is:
MX_GPIO_Init();
MX_USART3_UART_Init();
MX_LWIP_Init();
MX_TIM3_Init();
MX_SPI4_Init();
MX_CAN1_Init();
MX_UART5_Init();
MX_USB_OTG_FS_PCD_Init();
Additional observations:
-
SystemClock_Config() does not change
-
Replacing MX_USB_OTG_FS_PCD_Init() with HAL_Delay() does not fix it
-
So it does not look like a timing issue
-
It seems that HAL_PCD_Init() / HAL_PCD_MspInit() for USB is enabling or configuring something indirectly that Ethernet depends on
My question is:
What could USB FS initialization be configuring that would make Ethernet work, even though they should be unrelated?
I am thinking about possibilities such as:
-
GPIO clocks being enabled indirectly
-
MSP/NVIC configuration side effects
-
Some indirect dependency affecting HAL_ETH_MspInit() or lwIP
Has anyone seen something similar with STM32F767 + LAN8742A + lwIP?
