WiFi station no longer finds APs after 5 minutes of scanning
-
- Posts: 6
- Joined: Wed Mar 22, 2023 7:51 am
WiFi station no longer finds APs after 5 minutes of scanning
Hello everyone,
I am currently working on an application for the ESP32S2 in which a WiFi station searches for APs whose SSID starts with a certain prefix. The station should search until it finds such an AP. I have a log running in the background. From this I can conclude the following:
The station always finds APs in the vicinity for around 5 minutes. However, it does not connect to any of them because the SSIDs of the APs do not start with the correct prefix (this was intended to test the behavior of the station). However, after 5 minutes of searching, the station can no longer find a single AP in the vicinity, even though I know that the same APs are still available.
Does anyone have a similar problem?
Best regards,
Louis
I am currently working on an application for the ESP32S2 in which a WiFi station searches for APs whose SSID starts with a certain prefix. The station should search until it finds such an AP. I have a log running in the background. From this I can conclude the following:
The station always finds APs in the vicinity for around 5 minutes. However, it does not connect to any of them because the SSIDs of the APs do not start with the correct prefix (this was intended to test the behavior of the station). However, after 5 minutes of searching, the station can no longer find a single AP in the vicinity, even though I know that the same APs are still available.
Does anyone have a similar problem?
Best regards,
Louis
Re: WiFi station no longer finds APs after 5 minutes of scanning
You should check if you dont have memory leak in code.
When there is no free ram wifi wont work.
When there is no free ram wifi wont work.
-
- Posts: 6
- Joined: Wed Mar 22, 2023 7:51 am
Re: WiFi station no longer finds APs after 5 minutes of scanning
Thank you for your answer. I don't think it's a memory leak, I've already doubled the available memory for the task and checked to see if it changes anything about the time. The scanning does not stop after the 5 minutes, I can see that in the log. The ESP keeps scanning, but the WiFi stack tells me that there are 0 APs in the vicinity.
Re: WiFi station no longer finds APs after 5 minutes of scanning
I barely remember something that by error if the station does not find any AP after 10 attempts it stops searching. Each attempt is logged and final a log is fired saying that after 10 attempts without result it stops searching
May be that helps, just bean an issue for me like a year ago
May be that helps, just bean an issue for me like a year ago
-
- Posts: 6
- Joined: Wed Mar 22, 2023 7:51 am
Re: WiFi station no longer finds APs after 5 minutes of scanning
I added to the code that the ESP should restart if it detects 0 APs 20 times in a row. I let the log run on the side so that I can see how many scans the ESP performs until it finds no more APs. This is the result:
Number of WiFi scans in area 1: 120
Number of WiFi scans in area 2: 109
Number of WiFi scans in area 3: 108
Number of WiFi scans in area 4: 107
Number of WiFi scans in area 5: 114
Number of WiFi scans in area 6: 115
Number of WiFi scans in area 7: 117
Number of WiFi scans in area 8: 112
So it always seems to happen after a similar time. However, it is not always the same value.
Number of WiFi scans in area 1: 120
Number of WiFi scans in area 2: 109
Number of WiFi scans in area 3: 108
Number of WiFi scans in area 4: 107
Number of WiFi scans in area 5: 114
Number of WiFi scans in area 6: 115
Number of WiFi scans in area 7: 117
Number of WiFi scans in area 8: 112
So it always seems to happen after a similar time. However, it is not always the same value.
Re: WiFi station no longer finds APs after 5 minutes of scanning
You want to rule out a memory leak exhausting heap memory, not your task's stack.
Log these after each scan: esp_get_free_heap_size(), esp_get_minimum_free_heap_size()
Log these after each scan: esp_get_free_heap_size(), esp_get_minimum_free_heap_size()
-
- Posts: 6
- Joined: Wed Mar 22, 2023 7:51 am
Re: WiFi station no longer finds APs after 5 minutes of scanning
Thank you, I have found the mistake. For whatever reason, I had used a malloc for the AP list during the scan, but forgot to release the memory again (classic). I have now removed all mallocs from the code
Last edited by stonehouse on Mon Mar 11, 2024 12:53 pm, edited 1 time in total.
Re: WiFi station no longer finds APs after 5 minutes of scanning
well then please we spend the time to help you so you spend the time to tell what the cause was !!!!
-
- Posts: 6
- Joined: Wed Mar 22, 2023 7:51 am
Re: WiFi station no longer finds APs after 5 minutes of scanning
See my last post
Re: WiFi station no longer finds APs after 5 minutes of scanning
Yes, its classic. Everyone been there, including me, thats why my previous responsestonehouse wrote: ↑Mon Mar 11, 2024 12:47 pmThank you, I have found the mistake. For whatever reason, I had used a malloc for the AP list during the scan, but forgot to release the memory again (classic). I have now removed all mallocs from the code
Good you found the issue
Who is online
Users browsing this forum: Bing [Bot], Majestic-12 [Bot] and 211 guests