ST
A world leader in providing the semiconductor solutions that make a positive contribution to people’s lives, both today and in the future.
How to use own ETHERNET PHY
How to use your own ETHERNET PHY init functions ?¶
Default ETHERNET PHY Init and DeInit functions are defined in:
- from 5.9 OS5 release: features/netsocket/emac-drivers/TARGET_STM_EMAC/TARGET_STM32<xx>/TARGET_<xx>/stm32<xx>_eth_init.c
- before: features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_STM/TARGET_STM32<xx>/TARGET_<xx>/stm32<xx>_eth_init.c
You can overwrite these functions thanks to USE_USER_DEFINED_HAL_ETH_MSPINIT macro. This macro must be defined inside a JSON file.
For example in the targets.json, you need to add this line in your target:
"macros_add": ["USE_USER_DEFINED_HAL_ETH_MSPINIT"],
or for example in the mbed_app.json file by adding:
"macros": ["USE_USER_DEFINED_HAL_ETH_MSPINIT"],
See the mbed-cli documentation for more information on the configuration system syntax:
https://os.mbed.com/docs/latest/tools/adding-and-configuring-targets.html
You have then to implement completely the HAL_ETH_MspInit and HAL_ETH_MspDeInit functions in your application. You can take example of the default functions described in the stm32<xx>_eth_init.c file.