Channel selection for WIFI STA

fredj0207
Posts: 7
Joined: Mon Apr 19, 2021 4:07 pm

Channel selection for WIFI STA

Postby fredj0207 » Mon Apr 19, 2021 4:17 pm

Hello,
I get some issue to select the channel for WIFI STA.
Using esp_wifi_set_config with a channel different from 0 does not have any effect on the wifi driver.
It always start using the last channel used during the last successful selection.
Is it a known issue ?

For best understanding of my needs, in my environment I have two wifi AP with same credentials but on different channels. Both are DHCP server. When a router is not able to provide an IP, I need to address the second one.

Is there a specific settings to set to force the wifi driver to use a specific channel ?

Thanks,

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: Channel selection for WIFI STA

Postby WiFive » Mon Apr 19, 2021 10:44 pm

Suggest that you use bssid

fredj0207
Posts: 7
Joined: Mon Apr 19, 2021 4:07 pm

Re: Channel selection for WIFI STA

Postby fredj0207 » Tue Apr 20, 2021 7:29 am

Thanks for your reply.

Finally my code works. I was mislead by the log messages showing the device connected to channel 1 when trying another (wrong) channel

Code: Select all

I (11215) DEBUG: (HEAP:146668) (0:0) [halwifi.cpp:64] Retry with channel 3
I (13275) wifi:new:<1,0>, old:<1,0>, ap:<255,255>, sta:<1,0>, prof:1
I (13275) wifi:state: init -> auth (b0)
I (13275) wifi:state: auth -> assoc (0)
I (13285) wifi:state: assoc -> run (10)
I (13315) wifi:connected with myssid, aid = 6, channel 1, BW20, bssid = xx:xx:xx:xx:xx:xx
But when trying with an existing one I get the right message.

Code: Select all

I (26245) DEBUG: (HEAP:146668) (0:0) [halwifi.cpp:64] Retry with channel 6
I (28305) wifi:new:<6,0>, old:<1,0>, ap:<255,255>, sta:<6,0>, prof:1
I (28305) wifi:state: init -> auth (b0)
I (28315) wifi:state: auth -> assoc (0)
I (28325) wifi:state: assoc -> run (10)
I (28385) wifi:connected with myssid, aid = 1, channel 6, BW20, bssid = yy:yy:yy:yy:yy:yy 

Who is online

Users browsing this forum: MicroController and 130 guests