ESP8266 configuring AP channel

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
User avatar
RobH
Posts: 91
Joined: Fri Mar 23, 2018 3:37 pm
Location: Netherlands
Contact:

ESP8266 configuring AP channel

Post by RobH » Sun Nov 18, 2018 3:34 pm

MicroPython v1.9.4-272-g46091b8a on 2018-07-18; ESP module with ESP8266

In Access Point mode my ESP8266 (NODEMCU) refuses to accept my preferred WLAN channel. The access point works fine otherwise. Whatever I specify for channel it sticks to channel 3. See the console log below. Am I doing something wrong, like configuring config params in the wrong sequence (if there is a prescribed sequence)?

With an ESP32 (NODEMCU) same code works fine, the channel number is accepted and also changed on the fly.

Scanning the Forums and Issues at Github for this problem gives me the impression that network.config() may require repair/revision (and/or better documentation), for example: ap.config('password') gives 'unknown config param'.

Rob.


Code: Select all

>>> import network
>>> ap = network.WLAN(network.AP_IF)
>>> ap.active(True)
>>> #6 ets_task(4020edb4, 29, 3fff9548, 10)
>>> ap.active()
True
>>> ap.config(essid='my_AP')
#7 ets_task(4020edb4, 29, 3fff9548, 10)
>>> ap.config(channel=7)
#8 ets_task(4020edb4, 29, 3fff9548, 10)
>>> ap.config('channel')
3

>>> ap.config(password='12345678')
#9 ets_task(4020edb4, 29, 3fff9358, 10)
>>> ap.config('password')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: unknown config param
>>> 


jomas
Posts: 59
Joined: Mon Dec 25, 2017 1:48 pm
Location: Netherlands

Re: ESP8266 configuring AP channel

Post by jomas » Sun Nov 18, 2018 5:26 pm

You can not have different channels for station mode an ap mode. That is most likely the problem here.

User avatar
RobH
Posts: 91
Joined: Fri Mar 23, 2018 3:37 pm
Location: Netherlands
Contact:

Re: ESP8266 configuring AP channel

Post by RobH » Sun Nov 18, 2018 7:40 pm

Aha! I wasn't aware of this restriction. Thanks!
It explains what I experienced. Apart from the AP I have also a STA active. And when there can be only 1 WLAN channel it will be dictated by the AP to which the STA is connected. Some more experimenting showed that deactivating or even only disconnecting the STA allows changing the channel of the AP. But when the STA is connected/activated again the channel number of the AP is 'back' to that of the STA.
Regards, Rob.

Post Reply