Ethernet PHY type resets itself
- April 4, 2025
- 1 reply
- 528 views
Hi,
A small but annoying bug with STM32CubeMX 6.14.0 with H7 package 1.12.1. Every time I change anything in the LWIP general settings (e.g. DHCP enable/disable), the PHY setting changes by itself from USER_PHY to undefined.
This is a nuisance as if you generate code without realizing, some files are deleted meaning you lose user defined code blocks.

Example file attached.
On a side note, ST please add a KSZ8081 PHY option. Seems to be commonly asked for. The code is 95% the same as the LAN8742 option. I have attached a KSZ8081 example to show how similar it is. Or at least abstract the PHY function call names so that just the part number specific function definitions need to be changed (as is done in the EthPHY.h example attached.
The USER_DEFINED code template that is generated is not much use. It does not allow returning error for init failure. It also does not have access to the netif or PHY register read/write functions.
Thanks
