nrf5340+nrf7002 running Zephyr with NCS v2.6.x.
When trying to connect to a wifi AP with incorrect credentials, I have several issues:
1/ the result of the (failed) connect request always returns 10s later, no matter the value of 'timeout' in the wifi_connect_req_params structure passed to the net_mgmt request.
- shouldn't it use the timeout value?
2/ the result, returned as event NET_EVENT_WIFI_CONNECT_RESULT in a net_mgmt callback handler, doesn't give me a 'result' I can use?
How do I find out that the connection attempt failed? I tried checking the 'state' of the connection by doing a NET_REQUEST_WIFI_IFACE_STATUS, but it shows the state as being 'WIFI_STATE_ASSOCIATED', which the wifi demo code uses to indicate the wifi is connected!
(I can clearly see that the attempt has stopped after 10s because the power consumpion drops back to 5-6mA, instead of around 60mA)
3/ if I do not explicltly disconnect after the failed attempt, the stack continually retries the connection every 30s, and appears to have a memory leak of about 120 bytes at eash attempt... leading eventually to a hang because it exhausts the heap...
To avoid this, I added a 'connect timer' in my code, which does an explicit NET_REQUEST_WIFI_DISCONNECT after X seconds. This stops the automatic retry, and lets my code retry the connect at its own pace....
However:
4/ After a few attempts (<10, one every 3 minutes), the wifi stack seems to get in a bad state, and the power consumption sticks at 60mA average! (as though it was still trying to connect to the AP)
I get this log:
[00:57:24.123,870] <err> wifi_nrf: nrf_wifi_wpa_supp_scan_abort: Timedout waiting for scan abort response, ret = -11
Requesting a disconnect operation is accepted by the wifi stack but has no apparent affect on the power consumption. And it doesn't then accept a connect attempt with valid credentials after getting in this state. Could this be because I force disconnect when its still trying to connect?
Any pointers on how to get this to be more robust?
thanks