wifi:station join and leave continuously while connecting Mobile device

Ritesh
Posts: 1383
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

wifi:station join and leave continuously while connecting Mobile device

Postby Ritesh » Mon Dec 18, 2023 12:23 pm

Hello Team,

We were using ESP32 IDF 3.2 into one of our product and migrated to SP32 IDF 4.4 in which following component has been kept as older ESP32 IDF 3.2
TCP/IP Adapter
So, We have ported our application with that and it is also running fine into normal case.

ESP32 is working as AP+STA Mode in which STA mode is working while into AP mode devices are not able to connect.

But, We are facing issues after couple of days into few hardware like Mobile Device or any other device which is trying to connect to ESP32 (ESP32 as AP Mode) is not able to connect and continuous join and leave prints are coming.

It was working fine till few days and after that issue is being faced randomly without any change into device side.

Below are logs for reference
I (23226) wifi:new:<6,0>, old:<6,0>, ap:<6,2>, sta:<6,0>, prof:1

I (23226) wifi:station: b2:33:2e:ce:80:57 join, AID=1, bgn, 20

I (27236) wifi:station: b2:33:2e:ce:80:57 leave, AID = 1, bss_flags is 658530, bss:0x3fff9240

I (27236) wifi:new:<6,0>, old:<6,0>, ap:<6,2>, sta:<6,0>, prof:1

I (29266) wifi:new:<6,0>, old:<6,0>, ap:<6,2>, sta:<6,0>, prof:1

I (29276) wifi:station: b2:33:2e:ce:80:57 join, AID=1, bgn, 20


I (33276) wifi:station: b2:33:2e:ce:80:57 leave, AID = 1, bss_flags is 658530, bss:0x3fff9240

I (33276) wifi:new:<6,0>, old:<6,0>, ap:<6,2>, sta:<6,0>, prof:1

I (35306) wifi:new:<6,0>, old:<6,0>, ap:<6,2>, sta:<6,0>, prof:1

I (35316) wifi:station: b2:33:2e:ce:80:57 join, AID=1, bgn, 20

I (35326) wifi:station: b2:33:2e:ce:80:57 leave, AID = 1, bss_flags is 658530, bss:0x3fff9240

I (35326) wifi:new:<6,0>, old:<6,0>, ap:<6,2>, sta:<6,0>, prof:1


Let me know if anyone has faced similar kind of issues at their end.

Note - If we change wifi configuration or flash firmware again then it is started to work normally.
Regards,
Ritesh Prajapati

Ritesh
Posts: 1383
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: wifi:station join and leave continuously while connecting Mobile device

Postby Ritesh » Tue Dec 19, 2023 7:17 am

Hello Espressif Team,

As per further debugging from our end like it seems Password has been corrupted into NVS Storage location of wifi configuration.

Still, We will compare both working and non working NVS partition of both device and will let you know.

Because, when we set wifi configurations into non working device through CLI at that time it is started to working.
Regards,
Ritesh Prajapati

Ritesh
Posts: 1383
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: wifi:station join and leave continuously while connecting Mobile device

Postby Ritesh » Tue Dec 19, 2023 12:29 pm

Hello ESP_Sprite or Espressif Developers,

We have looked issue into details, and it seems like NVS location is going to corrupt for wifi configurations or may be particular region is going to corrupt.

Do we have any tool or utility to read NVS data specific for AP SSID and Password which are stored into NVS Memory? so that we can execute that command directly into non-working board and can check like what are the configurations are stored into NVS Flash Memory

Also, It would be good if you can share some more information and details about NVS Storage perspective just for understanding perspective.
Regards,
Ritesh Prajapati

Ritesh
Posts: 1383
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: wifi:station join and leave continuously while connecting Mobile device

Postby Ritesh » Thu Dec 21, 2023 5:05 pm

Hello Espressif Team or Developer Team,

We have further looked into issues and did some testing from our end as per possible test-cases and observed that when we are dumping NVS Memory from Non-working system into working system then also it is working fine.

Initially we have doubt that there are some issues into NVS section where AP SSID and Password are stored but when we taken NVS partition from non-working system to working system then it is working fine without any issues.

So, now, we don't have any clue that why it is not working into few boards in which Access Point is not working.

Also, I have one request that do we have any document or flow like how AP and STA wifi configurations are stored into NVS while changing both configurations many times? is there any Link List or kind of traverse mechanism is being managed into it for number of AP and STA SSID and Password to be stored as per configurations?
Regards,
Ritesh Prajapati

Ritesh
Posts: 1383
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: wifi:station join and leave continuously while connecting Mobile device

Postby Ritesh » Tue Dec 26, 2023 4:20 am

Hello Espressif Team or Developer Team,

Would you please help us to isolate issue if anyone has any expertise into it? Because it is really critical issue for us like we must need to take device from customer field and resolve issue manually when this issue is faced at customer end.

Let me know if anyone has any clue for the same.
Regards,
Ritesh Prajapati

DrMickeyLauer
Posts: 168
Joined: Sun May 22, 2022 2:42 pm

Re: wifi:station join and leave continuously while connecting Mobile device

Postby DrMickeyLauer » Wed Mar 27, 2024 2:10 pm

Did you find anything with regards to this problem? I have this behavior as well.

axellin
Posts: 200
Joined: Mon Sep 17, 2018 9:09 am

Re: wifi:station join and leave continuously while connecting Mobile device

Postby axellin » Thu Mar 28, 2024 7:38 am

DrMickeyLauer wrote:
Wed Mar 27, 2024 2:10 pm
Did you find anything with regards to this problem? I have this behavior as well.
I suggest you create an issue on https://github.com/espressif/esp-idf
with information about the soc/module, idf version and related log.

djixon
Posts: 113
Joined: Sun Oct 01, 2023 7:48 pm

Re: wifi:station join and leave continuously while connecting Mobile device

Postby djixon » Sat Apr 06, 2024 10:35 am

Damn same issue here too (but connection to wifi on windows PC) .... It looks it is related to ESP32S3 chips only because I can not reproduce the same failure behavior (connect and 2 seconds later misterious disconnection when ESP chip is in AP mode) on other simple ESP32 chips.
ESP32 works fine (same code compiled) ... ESP32S3 continues to refuse all incomming connections with following logs

Code: Select all

I (1002) wifi: File server started
I (86892) wifi:new:<1,1>, old:<1,1>, ap:<1,1>, sta:<255,255>, prof:1
I (86892) wifi:station: f4:a4:75:b3:c1:21 join, AID=1, bgn, 40U
I (86952) wifi: station f4:a4:75:b3:c1:21 join, AID=1
I (87342) wifi:<ba-add>idx:2 (ifx:1, f4:a4:75:b3:c1:21), tid:0, ssn:7, winSize:64
I (91342) wifi:station: f4:a4:75:b3:c1:21 leave, AID = 1, bss_flags is 8916035, bss:0x3c66c894
I (91342) wifi:new:<1,0>, old:<1,1>, ap:<1,1>, sta:<255,255>, prof:1
I (91342) wifi:<ba-del>idx:2, tid:0
I (91342) wifi: station f4:a4:75:b3:c1:21 leave, AID=1
I (91552) wifi:new:<1,1>, old:<1,0>, ap:<1,1>, sta:<255,255>, prof:1
I (91552) wifi:station: f4:a4:75:b3:c1:21 join, AID=1, bgn, 40U
I (91682) wifi: station f4:a4:75:b3:c1:21 join, AID=1
I (92202) wifi:<ba-add>idx:2 (ifx:1, f4:a4:75:b3:c1:21), tid:0, ssn:9, winSize:64
I (92662) esp_netif_lwip: DHCP server assigned IP to a client, IP is: 192.168.4.2
I (93702) wifi:station: f4:a4:75:b3:c1:21 leave, AID = 1, bss_flags is 658531, bss:0x3c66c894
I (93702) wifi:new:<1,0>, old:<1,1>, ap:<1,1>, sta:<255,255>, prof:1
I (93702) wifi:<ba-del>idx:2, tid:0
I (93702) wifi: station f4:a4:75:b3:c1:21 leave, AID=1

So smells to something related to handshaking when ESP32S3 is in AP mode.

djixon
Posts: 113
Joined: Sun Oct 01, 2023 7:48 pm

Re: wifi:station join and leave continuously while connecting Mobile device

Postby djixon » Thu Apr 11, 2024 5:31 am

Voila ..... I finally catch the damn thing. Problem was that I also used NVS for storage of some data. So everytime new data is stored to NVS, Commit is called but I didnt have CLOSE NVS HANDLE right after commit but at some other place, so when reset (from debbuging) or regular reset happens and NVS handle was not closed, corruption in NVS happens, which then makes problems on next reboot with credentials (or other things stored by wifi driver into NVS) and any try to connect to that AP fails followed by immediate disconnection.

Edit:
I don't want to oversize this thread so I decided to put some additional info about changes I made during hunting for this nasty behavior in this post. So in my setup, ESP acts as an AP. I also had changed security level threshold from WPA3 down to WPA2 (still didn't try to bring it back to WPA3 and re-test) but that alone didn't fix the problem, then I found a possible branches in code where reset can occur leaving nvs handle not closed, so I put nvs_close_handle after each commit. And after that I have never experienced issue related to immediate disconnection. Also, by design, only one STA at the time is allowed to connect, however I left max allowed connection to 4 because I am not sure how DHCP on esp AP handle used IP address once STA is disconnected. I mean, does it release imediatelly or it stays as reserved for some time which (if it is the case) could refuse another connections for a while if only 1 max connection is allowed. So I set it up to 4 to avoid such or simmilar possibly denies related to DHCP on AP.
Last edited by djixon on Thu Apr 11, 2024 11:01 am, edited 3 times in total.

DrMickeyLauer
Posts: 168
Joined: Sun May 22, 2022 2:42 pm

Re: wifi:station join and leave continuously while connecting Mobile device

Postby DrMickeyLauer » Thu Apr 11, 2024 9:23 am

Interesting. I doubt that this is the problem here, but it's worth a shot. So it should not happen when the partition is clean and no app code is using NVS. Let me do some tests.

Who is online

Users browsing this forum: Baidu [Spider] and 87 guests