WiFi issues makes OTA to fail

FreeOurToes wrote on March 14, 2019:

Hi,

I am using esp32 and have been experiencing failures for OTA while on bad wifi station.

OTA downloads successfully and when it reboots, if it fails to connect to wifi then it reboots again and it drops OTA. I believe this is probably a normal behaviour for a bootloader and for OTA checking.

I have multiple wifi stations and with some it always works perfectly, after OTA or not whenever I reboot my device it just reconnects to WiFi and it’s no problem, but I also have a station that it kinda gets stuck while connecting to WiFI, my guess is that it probably gets stuck on DHCP process.

My question would be on on how I could protect myself from this, as I cannot reassure that in client’s location they would have a perfect WiFi.

Should there be some improvements in a WiFi or a bootloader, or for OTA section?

SarenaAtAws wrote on March 14, 2019:

In the current ESP32 AWS OTA port it is correct that we expect the bootloader to rollback to the last image if WiFi cannot reconnect.

A suggestion to try: Add some type of retry around WIFI_ConnectAP() in main.c. We use an exponential retry in the in the ESp32 test project to reconnect to the WiFi access point: https://github.com/aws/amazon-freertos/blob/release/tests/espressif/esp32_devkitc_esp_wrover_kit/common/application_code/main.c#L227

Let me know if this works for you.

FreeOurToes wrote on April 01, 2019:

Thank you, this workaround will work.