WiFi.scanNetworks() hangs

I noticed after updating to the latest rtl fw and wifi libraries, rpcUnified 2.1.3 and rpcWifi 1.0.4
I notice the scanNetworks() function sometimes hangs forever. I have to reset the Wio to get out of the issue.

For a debug test, I decided to switch to Async mode of scanning, and that eventually hangs also.

n = WiFi.scanNetworks(/async/true, /hidden/true, /passive/false, ms_per_chan);
I put this into a loop with a delay and poll the status, and after about 5 min of scanning and completing, the WiFi.scanNetworks() function even in async mode hangs. I would expect it to return -1 (Running) or -2 (failed) but instead it blocks forever.

Hi,
I run the example of wifiscan
image

it works well.

and i try the scan wifi async mode, too.

image

this is the result.

image

whether is it the result you want? Because you said that you expected it to return -1 (Running) or -2 (failed).

if u still have some problems, feel free to upload more details or code.

How long did you let it run?
It works fine for about 5 min. Then it hangs forever.
I added the Watchdog to reboot the Wio when it hangs, and now my Wio will reboot randomly when the scan hangs.

I just loaded the WiFiScan Example, and let it run, It hung within 2 min. Notice the console output below. The Wio is now Hung. I need to power cycle it, or reset it

09:45:53.408 -> scan start
09:45:57.556 -> scan done
09:45:57.556 -> 7 networks found
09:45:57.556 -> 1: scar5GHz (-51)
09:45:57.556 -> 2: Scar5-test (-51)*
09:45:57.556 -> 3: priv (-51)*
09:45:57.556 -> 4: Scar’s Guest (-62)*
09:45:57.591 -> 5: (-63)
09:45:57.591 -> 6: Scar’s Guest (-82)*
09:45:57.591 -> 7: (-82)
09:45:57.629 ->
09:46:02.615 -> scan start
09:46:06.723 -> scan done
09:46:06.723 -> 7 networks found
09:46:06.723 -> 1: scar5GHz (-52)
09:46:06.761 -> 2: Scar5-test (-52)*
09:46:06.761 -> 3: priv (-52)*
09:46:06.761 -> 4: (-63)
09:46:06.799 -> 5: Scar’s Guest (-63)*
09:46:06.799 -> 6: Scar’s Guest (-80)*
09:46:06.799 -> 7: (-80)
09:46:06.799 ->
09:46:11.800 -> scan start
09:46:15.950 -> scan done
09:46:15.950 -> 7 networks found
09:46:15.950 -> 1: scar5GHz (-52)
09:46:15.950 -> 2: Scar5-test (-52)*
09:46:15.950 -> 3: priv (-52)*
09:46:15.950 -> 4: (-63)
09:46:15.986 -> 5: Scar’s Guest (-63)*
09:46:15.986 -> 6: Scar’s Guest (-80)*
09:46:15.986 -> 7: (-80)
09:46:16.021 ->
09:46:20.990 -> scan start
09:46:25.119 -> scan done
09:46:25.119 -> 7 networks found
09:46:25.119 -> 1: Scar5-test (-52)*
09:46:25.157 -> 2: priv (-52)*
09:46:25.157 -> 3: scar5GHz (-53)
09:46:25.157 -> 4: (-63)
09:46:25.157 -> 5: Scar’s Guest (-63)*
09:46:25.191 -> 6: Scar’s Guest (-80)*
09:46:25.191 -> 7: (-80)
09:46:25.191 ->
09:46:30.198 -> scan start
09:46:34.339 -> scan done
09:46:34.339 -> 7 networks found
09:46:34.339 -> 1: scar5GHz (-52)
09:46:34.339 -> 2: Scar5-test (-52)*
09:46:34.339 -> 3: priv (-52)*
09:46:34.372 -> 4: Scar’s Guest (-63)*
09:46:34.372 -> 5: (-64)
09:46:34.372 -> 6: (-80)
09:46:34.372 -> 7: Scar’s Guest (-80)*
09:46:34.410 ->
09:46:39.391 -> scan start
09:46:43.516 -> scan done
09:46:43.516 -> 7 networks found
09:46:43.516 -> 1: scar5GHz (-52)
09:46:43.550 -> 2: Scar5-test (-52)*
09:46:43.550 -> 3: priv (-52)*
09:46:43.550 -> 4: (-63)
09:46:43.550 -> 5: Scar’s Guest (-63)*
09:46:43.587 -> 6: Scar’s Guest (-80)*
09:46:43.587 -> 7: (-80)
09:46:43.587 ->
09:46:56.003 -> scan start
09:46:56.003 -> scan done
09:46:56.003 -> 8 networks found
09:46:56.003 -> 1: scar5GHz (-52)
09:46:56.003 -> 2: Scar5-test (-52)*
09:46:56.003 -> 3: priv (-52)*
09:46:56.003 -> 4: Scar’s Guest (-62)*
09:46:56.003 -> 5: (-63)
09:46:56.003 -> 6: Scar’s Guest (-81)*
09:46:56.003 -> 7: (-81)
09:46:56.003 -> 8: myBBBdom24_EXT (-96)*
09:46:56.003 ->
09:47:00.440 -> scan start

@Seeed-Liu So you don’t see the hang ? I still see it randomly. The hardware watchdog luckily will reboot the Wio, but that is really a band aide

@Seeed-Liu Is there any Update on this? I still see my Wio hang all the time.

After 2 years, I just updated the wifi FW and recompiled with latest wifi lib’s but I still see the issue.
Its good that the Wio has a watchdog, so it reboots, but this is annoying.

The Line that randomly hangs forever is
int n = WiFi.scanNetworks(/async/true, /hidden/true, /passive/false, ms_per_chan);