# Unable to scan for WiFi Networks

**URL:** <https://forum.unphone.net/t/unable-to-scan-for-wifi-networks/78>\
**Category:** unPhone programming\
**Created:** [22 May 2025 16:36 UTC](https://forum.unphone.net/t/unable-to-scan-for-wifi-networks/78 "2025-05-22T16:36:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hegdeatri](https://avatars.discourse-cdn.com/v4/letter/h/eada6e/32.png) [@hegdeatri](https://forum.unphone.net/u/hegdeatri)\
**Post date:** [22 May 2025 16:36 UTC](https://forum.unphone.net/t/unable-to-scan-for-wifi-networks/78/1 "2025-05-22T16:36:08Z")

</div>

When using `WiFi.h`. I am unable to use its `scanNetworks` function like this - `WiFi.ScanNetworks();` I am using the unPhone 9 building through platformio. Everything else works, its just when I try to scan the network. I have also attached the serial monitor output: [ESP-ROM:esp32s3-20210327Build:Mar 27 2021rst:0xc (RTC\_SW\_CPU\_RST),boot:0x2b - Pastebin.com](https://pastebin.com/B1G09wsX)

I have tried two methods:

```auto
// WiFi Page
void wifiPage()
{
  int n = WiFi.scanNetworks();
...
}

```

and also this, where it was non-blocking.

```auto
    void scanNetworks()
    {
        Serial.println("Scanning for WiFi networks...");
        WiFi.scanNetworks(true);

        unsigned long scanStar = millis();

        int scanResult = WIFI_SCAN_RUNNING;

        while (scanResult == WIFI_SCAN_RUNNING)
        {
            scanResult = WiFi.scanComplete();

            delay(100);
            yield();

            if (millis() - scanStar > 10000)
            {
                Serial.println("Scan timed out");
                WiFi.scanDelete();
                return;
            }
        }
...

```

---

<div class="post-metadata">

**Author:** ![hamish](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.unphone.net/hamish/32/3_2.png) [@hamish](https://forum.unphone.net/u/hamish)\
**Post date:** [23 May 2025 09:09 UTC](https://forum.unphone.net/t/unable-to-scan-for-wifi-networks/78/2 "2025-05-23T09:09:02Z")

</div>

The error in the serial output is that a task timed out (and triggered the WDT watchdog). It reports this in async\_tcp I think. What happens if you don’t run that code, just the WiFi scan networks code? HTH, H

---

<div class="post-metadata">

**Author:** ![hegdeatri](https://avatars.discourse-cdn.com/v4/letter/h/eada6e/32.png) [@hegdeatri](https://forum.unphone.net/u/hegdeatri)\
**Post date:** [26 May 2025 07:47 UTC](https://forum.unphone.net/t/unable-to-scan-for-wifi-networks/78/3 "2025-05-26T07:47:33Z")

</div>

Hey Hamish,

thanks for your response, it was heplful! I ended up changing the task watchdog settings to this (importantly to not panic, through the false flag)  
`esp_task_wdt_init(1000, false)`
