WiFi.setCredentials blocking for 1.6 seconds

Hello,

Calling WiFi.setCredentials blocks user code for a little over 1600ms.

This would normally not be a problem but our product has a STM6321RWY6F watchdog. We chose this particular one as it has one of the longest timeouts available of 1.6 seconds. At a minimum we pet it every 500ms

We can disable the watchdog when setting the WiFi Credentials but that sort of defeats the purpose. Granted this is a short period of time and setting credentials is a rare occurrence in the products lifetime but setting credentials shouldn’t take that long. I’m also thinking that if it takes 1.6 seconds, how much is it doing and what are the chances it hangs in this process?

I’m using a P1, Firmware 1.4.4. I am running SYSTEM_THREAD(ENABLED).

Not a show stopper, just looking for some education or a way to shorten this time

Thanks in advance,
Joerg Seiler

How are you setting the credentials?

If you are not providing fully qualified credentials (including WLAN cipher) then the device has to request the missing data from the network and that can take some time.

How does the timing look when you use the four-parameter overload of WiFi.setCredentials()?

1 Like

And that is why this forum is so awesome!

Thank you for letting me know what it’s actually doing, I can see that taking time. I suppose if the SSID you are configuring isn’t active at the time, that there is some sort of timeout which is even longer than the 1.6 seconds. I will try the four-parameter method tonight and see what the numbers are.

Thanks again,
Joerg

1 Like

If the SSID you want to store credentials for isn’t available at the time, the creds won’t be stored at all - unless it’s fully qualified.

Wow, that’s two things I’ve learned today. Now the trick is to hang on to all this new found knowledge. :thinking:

1 Like

Thank you @ScruffR, using the four parameter overload, the setting of credentials is now down to 117ms or 0.117 seconds. That works for me! :partying_face:

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.