FreeRTOS+TCP: v4.0 NetworkDown Events

I’m using FreeRTOS+TCP v4.0 on a SAMV71. I’m debugging an issue bringing the network back up after I disconnect/reconnect the ethernet cable.

Our network driver (modified from SAME5x) calls FreeRTOS_NetworkDown() once when the network goes down. This makes a one time call to pfInitialise() which obviously returns false, as the network just went down. I expected the stack to make repeated calls to pfInitialise() every time xNetworkTimer expired, but it doesn’t seem to.

v4 introduced an ‘xAllNetworksUp’ variable that’s set once after all networks go up for the first time, but never cleared when a network goes from up to down. This blocks vCheckNetworkTimers() from sending eNetworkDown events to the down interfaces.

I was able to make it work as I expected by clearing xAllNetworksUp when any network goes down, but I’m not sure what the intention of xAllNetworksUp was so I don’t know if this is really my problem or what to do for a permanent fix.

Hi @michaelyoyo

Welcome to the community!

Can you please check this PR we have recently fixed this problem on the FreeRTOS-Plus-TCP main branch.

Let me know if this helps or if you still face the issue.

Thank You

1 Like

That’s exactly it, thank you!

1 Like