Random and rare TCP receive failures (error 9 / WICED_NOTUP)

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

cross mob
NiMc_1688136
Level 5
Level 5
10 sign-ins 50 questions asked 10 solutions authored

This is a strange problem. I have found at least two devices, one in our lab and one in the field which gets stuck in a loop of wiced_tcp_receive returning an error code of 9.

The module is connected to an AP

The module is pulling valid NTP timesyncs and reaching public DNS servers so the networking stack seems okay, at least UDP.

I am trying to connect to a MQTT broker (AWS MQTT library) and the TCP connection and TLS handshake to the broker passes (good). I then see the CONNECT request go out but then the library starts polling wiced_tcp_receive for the CONNACK response but returns error code 9.

From wiced_results.h, an error code 9 is WICED_NOTUP which indicates that the interface is not valid but yet previous TCP/IP actions are working and passing the same checks.

What is weird is that these devices were communicating just fine, publishing messages to the MQTT broker every minute and then all of a sudden it got the error 9. In my code, this disconnected the device from the broker and tried to reconnect but only could once the module was rebooted.

Has anyone seen this? I am guessing something has happened to the socket variable being passed into wiced_tcp_receive, which provides an invalid interface to WICED_LINK_CHECK_TCP_SOCKET, but is odd that it cannot recover on following connect attempts.

SDK 6.2.1

LWIP + FreeRTOS

0 Likes
5 Replies
GauravS_31
Moderator
Moderator
Moderator
10 questions asked 250 solutions authored 250 sign-ins

It appears that there has been a disassociation between STA and AP. WICED_NOTUP means that netif_is_up() does not have NETIF_FLAG_UP flag. Do you have wireshark logs to share? We can check if there is any disassociation or roaming.

0 Likes

Thats just the thing though, UDP transmits were working in the background (NTP, DNS hostname lookup, UDP debug broadcasts) but the TCP socket was returning NOTUP.

0 Likes

We have never seen this or able to reproduce this issue. Perhaps if you could share a portion of your code where you could see the issue. What happens if you run wiced_wifi_up() after seeing the WICED_NOTUP error?

0 Likes
AxLi_1746341
Level 7
Level 7
10 comments on KBA 5 comments on KBA First comment on KBA

NiMc_1688136 wrote:

Has anyone seen this? I am guessing something has happened to the socket variable being passed into wiced_tcp_receive, which provides an invalid interface to WICED_LINK_CHECK_TCP_SOCKET, but is odd that it cannot recover on following connect attempts.

SDK 6.2.1

LWIP + FreeRTOS

+1

The same error code 9 for unknown reason and not able to connect anymore.

0 Likes

GauravS_31

Not sure calling wiced_wifi_up will do anything...

Other network connections are good: DNS/DHCP/SNTP/other UDP sockets and also 1 other TCP/TLS connection. This occurs on a single TCP/TLS socket. The said TCP socket is working correctly until it disconnects and following connects fail with socket error code 9.

I was thinking it could be variable states being overwritten for the socket data structre but if AxLi_1746341​ has seen it too, then that removes out application code as a culprit.

AxLi_1746341

My only work around at this time is to perform a SW reset when i encounter the error 9.

0 Likes