Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
User8819
Level 4
Level 4
Hello,

In ETH4 app, ethernetif.c in function low_level_init there is infinite loop

while(XMC_ETH_PHY_GetLinkStatus(&eth_mac, PHY_ADDR) != XMC_ETH_LINK_STATUS_UP)

waiting for link status to come up. The problem I see with this solution is that when cable in not plugged in the program hangs in this while.

Any recommendations? Should the user modify this application?

rum
0 Likes
4 Replies
User10215
Level 4
Level 4
First like received
Hi rum,

I'm using the ETH_LWIP_0-App with RTOS from the newer DAVE version and there is no while loop in the "low_level_init"-function. Does it seem like there are things in your version of the "low_level_init"-function that need the link to be up?
Otherwise I would suggest to remove the while loop. In my version the link status is polled in the function "ethernetif_link_status" and the link status is handled accordingly. So the APP should already have the means to deal correctly with a changing link-status. That should make it unnecessary to have this while-loop.
Can you post the whole code of the "low_level_init"-function? I'm curious about the differences between the APP-Versions.
Keep in mind that changes in that source-file might not survive a new code generation from DAVE. If the modifications in the ethernetif.c are final I would put it at a place that is not affected by the code-generation-procedure and then find a way to let the compiler ignore the new ethernetif.c that DAVE generates.

Regards,
Niclas
0 Likes
User8819
Level 4
Level 4
Hi Niclas,

I am using DAVE 4.1.2 and there is while loop. You say that in 4.2.2 it has been removed? Can you post ethernetif.c. and h.

rum
0 Likes
lock attach
Attachments are accessible only for community members.
User10215
Level 4
Level 4
First like received
Hi rum,

here is the ethernetif.c and h generated with DAVE v4.2.6 with the ETH_LWIP_0-App v4.0.4. This is the generated code without RTOS. Note that the PHY-Address is set to 0 here.
Also note that there is a while loop (not in low_level_init but in the function ethernetif_link_callback).

/* If autonegotiation is enabled */
while(XMC_ETH_PHY_IsAutonegotiationCompleted(&eth_mac, ETH_LWIP_0_PHY_ADDR) == false);


But I think the function with that loop is only called when there are changes in the link status.
In some other code where I use the ETH_LWIP_0-App with RTOS I noticed that the Autonegation seems to take some time so I just put a "osDelay(100)" into the while-loop which worked well.

Regards,
Niclas
0 Likes
User8819
Level 4
Level 4
Hi Niclas,

In the meanwhile I have downloaded newest LWIP app and noticed, as you pointed out, the code is now different. I did the same as you in previous version putting some OS delay.
thanks

rum
0 Likes