netxduo link state not initialized properly
Dear Community,
We're just building up a product with NetXDuo on a STM32H563 having some issues with the Link-Establishment.
We use newest CubeMX (6.11.0) with newest Firmware-Package (1.2.0) to generate the init-code and use the same PHY as in the Eval-Board (lan8742).
If a link is not available on boot, because auto-neg takes a while the network will never come up. In this case dhcp tries to sent a request again and again and will be blocked at _nx_driver_packet_send because link is not established (nx_stm32_eth_driver.c @757 )
As I can follow the code, the NetXDuo IP thread will only call the driver with NX_LINK_ENABLE on the first initialization before the thread-loop ( nx_ip_thread_entry.c @207 ) which will call "_nx_driver_enable" ( nx_stm32_eth_driver.c @494 ).
There is only a way to call the NX_LINK_ENABLE again with a call to nx_interface_attach ( which is the wrong way I think as the interface is already attached ).
For my opinion "_nx_driver_enable" needs to be called again on a l8er link-establishment. I'm still wondering if this is a thing that should be done in either the driver, the NetXDuo stack or the application.
Doing this in the driver may not be triggered by the driver itself, as we don't have a "timebase" for polling the phy-state here. Nevertheless we could poll the phy-state by the application using "nx_ip_interface_status_check". Then the driver could enable itself when a link is established. For my opinion there is no direct nx-api call to re-issue a NX_LINK_ENABLE to the driver.
Another option would be to report a bug to the NetXDuo to re-call the NX_LINK_ENABLE when a phy-link is established (which is difficult as ST is using a rather old version of AZURE).
Nevertheless I'm missing examples or some hints how to do so.
Providing an example .ioc file would be hard work at this point because we're working on custom hardware here. Hopefully one can reconstruct the problem theoretically with a code-walk along the given lines.
Regards Pascal
