Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Impossible to recover from a WiFi signal lost due to fading #9571

Open
1 task done
pberna67 opened this issue Apr 28, 2024 · 1 comment
Open
1 task done

Impossible to recover from a WiFi signal lost due to fading #9571

pberna67 opened this issue Apr 28, 2024 · 1 comment
Labels
Status: Awaiting triage Issue is waiting for triage

Comments

@pberna67
Copy link

Board

NINA-W101, NINA-W106

Device Description

EVK-NINA-W101 from u-blox

Hardware Configuration

ESP32 I'm running the v2.0.15 (Not listed in the Issue form)

https://www.u-blox.com/en/product/evk-nina-w10

Version

v2.0.14

IDE Name

Arduino 1.8.19

Operating System

Windows 11

Flash frequency

80Mhz

PSRAM enabled

no

Upload speed

921600

Description

I've encountered a problem using the library when the WiFi connection is lost due to a fading of the WiFi signal between the ESP32 module and the router. If the connection is lost, the library is no longer able to restore it again. The conditions for reproducing the problem are as follows:

Hw: EVK-NINA-W101/106 based on ESP32
https://www.u-blox.com/en/product/evk-nina-w10
Board lib package: ESP32 2.0.15 installed
Sketch example: See attached,

How to reproduce the problem:
The app Mailbox_Change_Notification connects to internet via a router. Move slowly the EVN-NINA-W102 (ESP32) board far from the router wifi range, until the ESP32 will lost the Wifi connection (do not switch off the router and then switch on it, to simulate the Wifi drop, otherwise the problem doesn’t occurs). Wait some second (1 minutes, see Serial.Dump, wait for that time or more, shorter time couldn't trigger the problem) with ESP32 position out of Wifi range of the router, then slowly enter the ESP 32 EVK in the range of the Wifi router. The result is that the sketch is not able to reconnect to the WiFi

Regards
Paolo

Sketch

#include <Arduino.h>
#include <WiFi.h>

#define WIFI_SSID     "mySSID"
#define WIFI_PASSWORD "myPASS"

#define  NINA_W101

#define LED_R    23                  // Pin IO23 J4 LED RED
#define LED_R_CH 1 
#if defined(NINA_W101) || defined(NINA_W102)
#define LED_G    33                  // Pin IO33 J2 LED GREEN  per NINA-W101/102
#elif defined(NINA_W106)
#define LED_G    32                  // Pin IO32 J2 LED GREEN  per NINA-W106
#else 
#error "NO EVK_BOARD defined"
#endif
#define LED_G_CH 2
#define LED_B    21                  // PIN IO21 J2 LED BLUE
#define LED_B_CH 3


unsigned long DebugMills = 0;
unsigned long ReconMills = 0;

void connectWiFi()
{
    WiFi.disconnect();

    Serial.println();

    WiFi.begin(WIFI_SSID, WIFI_PASSWORD);

    Serial.print("Connecting to Wi-Fi");

    while (WiFi.status() != WL_CONNECTED)
    {
        Serial.print(".");
        delay(300);
        digitalWrite(LED_R, LOW);
    }

    digitalWrite(LED_R, HIGH);
    digitalWrite(LED_G, LOW);
    
    Serial.println();
    Serial.print("SSID: ");
    Serial.println(WIFI_SSID);
    Serial.print("Connected with IP: ");
    Serial.println(WiFi.localIP());
    Serial.println();
}

void setup()
{
    Serial.begin(115200);
    Serial.println();

    pinMode(LED_R, OUTPUT);
    pinMode(LED_G, OUTPUT);
    pinMode(LED_B, OUTPUT);
        
    digitalWrite(LED_R, HIGH);
    digitalWrite(LED_G, HIGH);
    digitalWrite(LED_B, HIGH);
            
    connectWiFi();
}

void loop()
{
    if (millis() - DebugMills > 10000)
    { 
      DebugMills = millis();

      Serial.printf("WIFI Status : %d\n", WiFi.status());
      Serial.printf("RSSI: %d\n",WiFi.RSSI());      
      Serial.print("Connected with IP: ");
      Serial.println(WiFi.localIP());

      Serial.println();
    }  
    
    if (WiFi.status() != WL_CONNECTED)
    {      
      digitalWrite(LED_G, HIGH);
      digitalWrite(LED_R, LOW);
       
      if (millis() - ReconMills > 20000)
      {
        ReconMills = millis();
        connectWiFi();  
      }  
    }
    else
    {   
      ReconMills = millis();
      digitalWrite(LED_R, HIGH);
      digitalWrite(LED_G, LOW);      
    }
    
      
}

Debug Message

......ets Jul 29 2019 12:21:46
13:26:47.988 -> 
13:26:47.988 -> rst:0x1 (POWERON_RESET),boot:0x37 (SPI_FAST_FLASH_BOOT)
13:26:47.988 -> configsip: 0, SPIWP:0xee
13:26:47.988 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
13:26:47.988 -> mode:DIO, clock div:1
13:26:47.988 -> load:0x3fff0030,len:1184
13:26:47.988 -> load:0x40078000,len:13260
13:26:47.988 -> load:0x40080400,len:3028
13:26:47.988 -> entry 0x400805e4
13:26:48.267 -> [     5][D][esp32-hal-cpu.c:244] setCpuFrequencyMhz(): PLL: 480 / 2 = 240 Mhz, APB: 80000000 Hz
13:26:48.313 -> 
13:26:48.313 -> 
13:26:48.313 -> [    47][D][WiFiGeneric.cpp:1040] _eventCallback(): Arduino Event: 0 - WIFI_READY
13:26:48.360 -> [   122][D][WiFiGeneric.cpp:1040] _eventCallback(): Arduino Event: 2 - STA_START
13:26:48.406 -> Connecting to Wi-Fi.[   228][D][WiFiGeneric.cpp:1040] _eventCallback(): Arduino Event: 4 - STA_CONNECTED
13:26:48.544 -> [   261][D][WiFiGeneric.cpp:1040] _eventCallback(): Arduino Event: 7 - STA_GOT_IP
13:26:48.544 -> [   269][D][WiFiGeneric.cpp:1103] _eventCallback(): STA IP: 192.168.10.60, MASK: 255.255.255.0, GW: 192.168.10.1
13:26:48.684 -> 
13:26:48.684 -> SSID: Vodafone-27586605
13:26:48.684 -> Connected with IP: 192.168.10.60
13:26:48.684 -> 
13:26:58.262 -> WIFI Status : 3
13:26:58.262 -> RSSI: -63
13:26:58.262 -> Connected with IP: 192.168.10.60
13:26:58.262 -> 
13:27:08.245 -> WIFI Status : 3
13:27:08.245 -> RSSI: -58
13:27:08.245 -> Connected with IP: 192.168.10.60
13:27:08.245 -> 
13:27:18.260 -> WIFI Status : 3
13:27:18.260 -> RSSI: -71
13:27:18.260 -> Connected with IP: 192.168.10.60
13:27:18.260 -> 
13:27:28.257 -> WIFI Status : 3
13:27:28.257 -> RSSI: -62
13:27:28.257 -> Connected with IP: 192.168.10.60
13:27:28.257 -> 
13:27:38.242 -> WIFI Status : 3
13:27:38.242 -> RSSI: -86
13:27:38.242 -> Connected with IP: 192.168.10.60
13:27:38.288 -> 
13:27:48.245 -> WIFI Status : 3
13:27:48.245 -> RSSI: -82
13:27:48.245 -> Connected with IP: 192.168.10.60
13:27:48.291 -> 
13:27:58.269 -> WIFI Status : 3
13:27:58.269 -> RSSI: -93
13:27:58.269 -> Connected with IP: 192.168.10.60
13:27:58.269 -> 
13:28:08.277 -> WIFI Status : 3
13:28:08.277 -> RSSI: -90
13:28:08.277 -> Connected with IP: 192.168.10.60
13:28:08.277 -> 
13:28:14.368 -> [ 86108][D][WiFiGeneric.cpp:1040] _eventCallback(): Arduino Event: 5 - STA_DISCONNECTED
13:28:14.368 -> [ 86116][W][WiFiGeneric.cpp:1062] _eventCallback(): Reason: 200 - BEACON_TIMEOUT
13:28:14.368 -> [ 86123][D][WiFiGeneric.cpp:1082] _eventCallback(): WiFi Reconnect Running
13:28:15.442 -> [ 87198][D][WiFiGeneric.cpp:1040] _eventCallback(): Arduino Event: 5 - STA_DISCONNECTED
13:28:15.442 -> [ 87206][W][WiFiGeneric.cpp:1062] _eventCallback(): Reason: 2 - AUTH_EXPIRE
13:28:15.489 -> [ 87212][D][WiFiGeneric.cpp:1086] _eventCallback(): WiFi AutoReconnect Running
13:28:16.563 -> [ 88324][D][WiFiGeneric.cpp:1040] _eventCallback(): Arduino Event: 5 - STA_DISCONNECTED
13:28:16.609 -> [ 88332][W][WiFiGeneric.cpp:1062] _eventCallback(): Reason: 2 - AUTH_EXPIRE
13:28:16.609 -> [ 88339][D][WiFiGeneric.cpp:1086] _eventCallback(): WiFi AutoReconnect Running
13:28:17.732 -> [ 89450][D][WiFiGeneric.cpp:1040] _eventCallback(): Arduino Event: 5 - STA_DISCONNECTED
13:28:17.732 -> [ 89458][W][WiFiGeneric.cpp:1062] _eventCallback(): Reason: 2 - AUTH_EXPIRE
13:28:17.732 -> [ 89465][D][WiFiGeneric.cpp:1086] _eventCallback(): WiFi AutoReconnect Running
13:28:18.292 -> WIFI Status : 5
13:28:18.292 -> RSSI: 0
13:28:18.292 -> Connected with IP: 0.0.0.0
13:28:18.292 -> 
13:28:20.145 -> [ 91888][D][WiFiGeneric.cpp:1040] _eventCallback(): Arduino Event: 5 - STA_DISCONNECTED
13:28:20.145 -> [ 91896][W][WiFiGeneric.cpp:1062] _eventCallback(): Reason: 201 - NO_AP_FOUND
13:28:20.145 -> [ 91903][D][WiFiGeneric.cpp:1086] _eventCallback(): WiFi AutoReconnect Running
13:28:21.311 -> [ 93034][D][WiFiGeneric.cpp:1040] _eventCallback(): Arduino Event: 5 - STA_DISCONNECTED
13:28:21.311 -> [ 93042][W][WiFiGeneric.cpp:1062] _eventCallback(): Reason: 2 - AUTH_EXPIRE
13:28:21.311 -> [ 93049][D][WiFiGeneric.cpp:1086] _eventCallback(): WiFi AutoReconnect Running
13:28:23.734 -> [ 95472][D][WiFiGeneric.cpp:1040] _eventCallback(): Arduino Event: 5 - STA_DISCONNECTED
13:28:23.734 -> [ 95480][W][WiFiGeneric.cpp:1062] _eventCallback(): Reason: 201 - NO_AP_FOUND
13:28:23.734 -> [ 95487][D][WiFiGeneric.cpp:1086] _eventCallback(): WiFi AutoReconnect Running
13:28:24.893 -> [ 96618][D][WiFiGeneric.cpp:1040] _eventCallback(): Arduino Event: 5 - STA_DISCONNECTED
13:28:24.893 -> [ 96626][W][WiFiGeneric.cpp:1062] _eventCallback(): Reason: 2 - AUTH_EXPIRE
13:28:24.893 -> [ 96633][D][WiFiGeneric.cpp:1086] _eventCallback(): WiFi AutoReconnect Running
13:28:27.309 -> [ 99056][D][WiFiGeneric.cpp:1040] _eventCallback(): Arduino Event: 5 - STA_DISCONNECTED
13:28:27.309 -> [ 99064][W][WiFiGeneric.cpp:1062] _eventCallback(): Reason: 201 - NO_AP_FOUND
13:28:27.309 -> [ 99071][D][WiFiGeneric.cpp:1086] _eventCallback(): WiFi AutoReconnect Running
13:28:28.290 -> WIFI Status : 1
13:28:28.290 -> RSSI: -92
13:28:28.290 -> Connected with IP: 0.0.0.0
13:28:28.290 -> 
13:28:28.337 -> [100100][D][WiFiGeneric.cpp:1040] _eventCallback(): Arduino Event: 5 - STA_DISCONNECTED
13:28:28.384 -> [100108][W][WiFiGeneric.cpp:1062] _eventCallback(): Reason: 2 - AUTH_EXPIRE
13:28:28.384 -> [100115][D][WiFiGeneric.cpp:1086] _eventCallback(): WiFi AutoReconnect Running
13:28:29.490 -> [101226][D][WiFiGeneric.cpp:1040] _eventCallback(): Arduino Event: 5 - STA_DISCONNECTED
13:28:29.490 -> [101234][W][WiFiGeneric.cpp:1062] _eventCallback(): Reason: 2 - AUTH_EXPIRE
13:28:29.490 -> [101241][D][WiFiGeneric.cpp:1086] _eventCallback(): WiFi AutoReconnect Running
13:28:30.614 -> [102353][D][WiFiGeneric.cpp:1040] _eventCallback(): Arduino Event: 5 - STA_DISCONNECTED
13:28:30.614 -> [102361][W][WiFiGeneric.cpp:1062] _eventCallback(): Reason: 2 - AUTH_EXPIRE
13:28:30.614 -> [102367][D][WiFiGeneric.cpp:1086] _eventCallback(): WiFi AutoReconnect Running
13:28:33.039 -> [104790][D][WiFiGeneric.cpp:1040] _eventCallback(): Arduino Event: 5 - STA_DISCONNECTED
13:28:33.039 -> [104798][W][WiFiGeneric.cpp:1062] _eventCallback(): Reason: 201 - NO_AP_FOUND
13:28:33.039 -> [104805][D][WiFiGeneric.cpp:1086] _eventCallback(): WiFi AutoReconnect Running
13:28:34.388 -> 
13:28:34.388 -> Connecting to Wi-Fi.........[108524][D][WiFiGeneric.cpp:1040] _eventCallback(): Arduino Event: 5 - STA_DISCONNECTED
13:28:36.787 -> [108532][W][WiFiGeneric.cpp:1062] _eventCallback(): Reason: 201 - NO_AP_FOUND
13:28:36.787 -> [108539][D][WiFiGeneric.cpp:1086] _eventCallback(): WiFi AutoReconnect Running
13:28:37.066 -> ........[110961][D][WiFiGeneric.cpp:1040] _eventCallback(): Arduino Event: 5 - STA_DISCONNECTED
13:28:39.213 -> [110969][W][WiFiGeneric.cpp:1062] _eventCallback(): Reason: 201 - NO_AP_FOUND
13:28:39.213 -> [110976][D][WiFiGeneric.cpp:1086] _eventCallback(): WiFi AutoReconnect Running
13:28:39.490 -> ........[113398][D][WiFiGeneric.cpp:1040] _eventCallback(): Arduino Event: 5 - STA_DISCONNECTED
13:28:41.671 -> [113406][W][WiFiGeneric.cpp:1062] _eventCallback(): Reason: 201 - NO_AP_FOUND
13:28:41.671 -> [113413][D][WiFiGeneric.cpp:1086] _eventCallback(): WiFi AutoReconnect Running
13:28:41.860 -> ........[115835][D][WiFiGeneric.cpp:1040] _eventCallback(): Arduino Event: 5 - STA_DISCONNECTED
13:28:44.099 -> [115843][W][WiFiGeneric.cpp:1062] _eventCallback(): Reason: 201 - NO_AP_FOUND
13:28:44.099 -> [115850][D][WiFiGeneric.cpp:1086] _eventCallback(): WiFi AutoReconnect Running
13:28:44.285 -> ........[118272][D][WiFiGeneric.cpp:1040] _eventCallback(): Arduino Event: 5 - STA_DISCONNECTED
13:28:46.557 -> [118280][W][WiFiGeneric.cpp:1062] _eventCallback(): Reason: 201 - NO_AP_FOUND
13:28:46.557 -> [118287][D][WiFiGeneric.cpp:1086] _eventCallback(): WiFi AutoReconnect Running
13:28:46.653 -> ........[120709][D][WiFiGeneric.cpp:1040] _eventCallback(): Arduino Event: 5 - STA_DISCONNECTED
13:28:48.988 -> [120717][W][WiFiGeneric.cpp:1062] _eventCallback(): Reason: 201 - NO_AP_FOUND
13:28:48.988 -> [120723][D][WiFiGeneric.cpp:1086] _eventCallback(): WiFi AutoReconnect Running
13:28:49.081 -> ........[123145][D][WiFiGeneric.cpp:1040] _eventCallback(): Arduino Event: 5 - STA_DISCONNECTED
13:28:51.409 -> [123153][W][WiFiGeneric.cpp:1062] _eventCallback(): Reason: 201 - NO_AP_FOUND
13:28:51.409 -> [123160][D][WiFiGeneric.cpp:1086] _eventCallback(): WiFi AutoReconnect Running
13:28:51.454 -> ........[125583][D][WiFiGeneric.cpp:1040] _eventCallback(): Arduino Event: 5 - STA_DISCONNECTED
13:28:53.874 -> [125590][W][WiFiGeneric.cpp:1062] _eventCallback(): Reason: 201 - NO_AP_FOUND
13:28:53.874 -> [125597][D][WiFiGeneric.cpp:1086] _eventCallback(): WiFi AutoReconnect Running
13:28:53.874 -> ....[126621][D][WiFiGeneric.cpp:1040] _eventCallback(): Arduino Event: 5 - STA_DISCONNECTED
13:28:54.904 -> [126629][W][WiFiGeneric.cpp:1062] _eventCallback(): Reason: 2 - AUTH_EXPIRE
13:28:54.904 -> [126636][D][WiFiGeneric.cpp:1086] _eventCallback(): WiFi AutoReconnect Running
13:28:55.093 -> ........[129059][D][WiFiGeneric.cpp:1040] _eventCallback(): Arduino Event: 5 - STA_DISCONNECTED
13:28:57.337 -> [129066][W][WiFiGeneric.cpp:1062] _eventCallback(): Reason: 201 - NO_AP_FOUND
13:28:57.337 -> [129073][D][WiFiGeneric.cpp:1086] _eventCallback(): WiFi AutoReconnect Running
13:28:57.477 -> ....[130206][D][WiFiGeneric.cpp:1040] _eventCallback(): Arduino Event: 5 - STA_DISCONNECTED
13:28:58.460 -> [130213][W][WiFiGeneric.cpp:1062] _eventCallback(): Reason: 2 - AUTH_EXPIRE
13:28:58.460 -> [130220][D][WiFiGeneric.cpp:1086] _eventCallback(): WiFi AutoReconnect Running
13:28:58.694 -> ....[131332][D][WiFiGeneric.cpp:1040] _eventCallback(): Arduino Event: 5 - STA_DISCONNECTED
13:28:59.586 -> [131340][W][WiFiGeneric.cpp:1062] _eventCallback(): Reason: 2 - AUTH_EXPIRE
13:28:59.586 -> [131347][D][WiFiGeneric.cpp:1086] _eventCallback(): WiFi AutoReconnect Running
13:28:59.858 -> ...[132458][D][WiFiGeneric.cpp:1040] _eventCallback(): Arduino Event: 5 - STA_DISCONNECTED
13:29:00.744 -> [132466][W][WiFiGeneric.cpp:1062] _eventCallback(): Reason: 2 - AUTH_EXPIRE
13:29:00.744 -> [132473][D][WiFiGeneric.cpp:1086] _eventCallback(): WiFi AutoReconnect Running
13:29:00.789 -> ........[134895][D][WiFiGeneric.cpp:1040] _eventCallback(): Arduino Event: 5 - STA_DISCONNECTED
13:29:03.169 -> [134903][W][WiFiGeneric.cpp:1062] _eventCallback(): Reason: 201 - NO_AP_FOUND
13:29:03.169 -> [134910][D][WiFiGeneric.cpp:1086] _eventCallback(): WiFi AutoReconnect Running
13:29:03.169 -> ....[135956][D][WiFiGeneric.cpp:1040] _eventCallback(): Arduino Event: 5 - STA_DISCONNECTED
13:29:04.241 -> [135964][W][WiFiGeneric.cpp:1062] _eventCallback(): Reason: 39 - TIMEOUT
13:29:04.381 -> ..........................................................................................................................................................................................................................................[206109][D][WiFiGeneric.cpp:1040] _eventCallback(): Arduino Event: 9 - STA_LOST_IP
13:30:14.554 -> ........................

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.
@pberna67 pberna67 added the Status: Awaiting triage Issue is waiting for triage label Apr 28, 2024
@pberna67
Copy link
Author

At this time

13:29:04.381 -> ..........................................................................................................................................................................................................................................[206109][D][WiFiGeneric.cpp:1040] _eventCallback(): Arduino Event: 9 - STA_LOST_IP
13:30:14.554 -> ........................

The Module is moved closed to the Access point, but it doesn't reconnect.
Is the AutoReconnect procedure set by default ?

@pberna67 pberna67 changed the title Impossible to recover from a WiFi signal lost due to fadding Impossible to recover from a WiFi signal lost due to fading May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Awaiting triage Issue is waiting for triage
Projects
None yet
Development

No branches or pull requests

1 participant