Wiznet / RP2040-HAT-LWIP-C

lwIP Example for RP2040
15 stars 5 forks source link

do/while loop in wizchip_initialize() in w5x00_spi.c is blocking if network cable is unplugged #1

Open inthestillofthenight opened 1 year ago

inthestillofthenight commented 1 year ago

This is really a question, as a result of a question on the WIZnet forum (topic 10579). Why does the code in wizchip_initialize() block until LINK UP is established? So when called if the ethernet cable is unplugged or the switch is down the call would not return. See code at line 211 here: https://github.com/Wiznet/RP2040-HAT-LWIP-C/blob/main/port/ioLibrary_Driver/src/w5x00_spi.c

Would it do any harm to just return the LINK status rather than looping to wait for LINK_UP? or can it just return no matter what the LINK status is? Unplugging and re-plugging the cable back in once the network is up results in full recovery.

This call is made in nearly all of the example programs.