-->
Page 1 of 2

WiFi Scanning while Station Status = Idle crashes

PostPosted: Mon May 20, 2019 5:50 pm
by Agentsmithers
Hi Everyone! I wrote a simple loop in the software that will connect to any open SSID around it on disconnect to keep this device connect to any available hotspot. The method I use is to kick off a scan manually in one of the System Post tasks. Once it connects it will call WiFi_Handle_event_cb. On disconnect, it will do the same kicking off the scan and looping over until it finds an open ssid.
Heres the thing though, Every time the WiFi is about to kick off a scan I get the status of the WiFi station and it reflects the station is in either connecting mode or some other mode... but the moment the mode reflects Idle on a random loop the system crashes with LoadProhitbitedCaused.
I wrote this code and I don't take any code paths any differently based on the Stations status.. I just know that when it reads Idle it crashes and I'm not sure why. Anyone else ever come across this issue before?

Re: WiFi Scanning while Station Status = Idle crashes

PostPosted: Tue May 21, 2019 2:13 am
by quackmore
Not sure I get it all

but the when I see errors like that I usually think about pointers issues in my code

assuming that sdk tends to be a bit autonomous when it comes to wifi
make sure you have disabled auto-connect and auto-reconnect
Code: Select all    wifi_station_set_auto_connect(0);
    wifi_station_set_reconnect_policy(false);

cause it could be that when the station status is not idle then it's sdk code doing the job
while when the station code is idle then your code is failing

Re: WiFi Scanning while Station Status = Idle crashes

PostPosted: Tue May 21, 2019 10:26 am
by Agentsmithers
quackmore wrote:Not sure I get it all

but the when I see errors like that I usually think about pointers issues in my code

assuming that sdk tends to be a bit autonomous when it comes to wifi
make sure you have disabled auto-connect and auto-reconnect
Code: Select all    wifi_station_set_auto_connect(0);
    wifi_station_set_reconnect_policy(false);

cause it could be that when the station status is not idle then it's sdk code doing the job
while when the station code is idle then your code is failing


Interesting, I do have wifi_station_set_reconnect_policy(false); but not the other one.. Doesn't wifi_station_set_auto_connect(0) only take place when you call to save the SSID in memory using the API? I thought it needs like a profile saved or something in order to know what to connect to.. or does it do this when you call connect() for the first time in the background anyhow?
I'll disable it anyways and give it a shot.

Re: WiFi Scanning while Station Status = Idle crashes

PostPosted: Tue May 21, 2019 11:06 am
by quackmore
Auto connect should only run at power on and with cached ssid...