Patrick1234
Posts: 23
Joined: Sun Feb 21, 2021 11:40 pm

Pi Pico W Access Point

Sun Jul 03, 2022 7:56 am

Hi,

My new Pico W arrived!
I had some code written for the ESP32 that set the device up as an access point and served a web page with some buttons controlling a couple of io pins. As the micropython network library is common I thought I'd see if it would run, it did.... almost!
I got an error when setting up the access point:

station = network.WLAN(network.AP_IF)
station.active(True)
station.config(essid='PICO')
station.config(authmode=3,password='12349876')

The error was thrown on the last line and reports an unknown argument. What I remove the "authmode" argument the code runs and the page is served but the WiFi network is unlocked!

I went back to the micropython docs for network.WLAN and the "authmode" argument is not there but "security" is, '3' is equal to wpa2. Changing the argument to "security" trows the same error.

I think the Pico WiFi device can operate wpa3. I assume this would be backward compatible but I'm not sure. No library option can constant appears for wpa3 that I can find.

The setup guide doesn't seem to cover operation as an access point either.

Has anyone set up their Pico as an access point with security?

Letting anyone connect even to a dev project just doesn't seem like a good idea!

Many thanks for any help you could provide

User avatar
aallan
Raspberry Pi Employee & Forum Moderator
Raspberry Pi Employee & Forum Moderator
Posts: 321
Joined: Mon Feb 09, 2015 11:30 am
Location: Exeter, UK

Re: Pi Pico W Access Point

Sun Jul 03, 2022 10:54 am

Patrick1234 wrote:
Sun Jul 03, 2022 7:56 am
I had some code written for the ESP32 that set the device up as an access point and served a web page with some buttons controlling a couple of io pins. As the micropython network library is common I thought I'd see if it would run, it did.... almost!

I got an error when setting up the access point:

station = network.WLAN(network.AP_IF)
station.active(True)
station.config(essid='PICO')
station.config(authmode=3,password='12349876')

This works for me,

Code: Select all

ssid = 'MicroPython-AP'
password = '123456789'

ap = network.WLAN(network.AP_IF)
ap.config(essid=ssid, password=password)
ap.active(True)
Head of Documentation
Raspberry Pi Ltd
About me, http://alasdairallan.com

Patrick1234
Posts: 23
Joined: Sun Feb 21, 2021 11:40 pm

Re: Pi Pico W Access Point

Sun Jul 03, 2022 1:12 pm

Many thanks I'll give that a try when I'm back.

Last night I used:
station = network.WLAN(network.AP_IF)
station.active(True)
station.config(essid='PICO')
station.config(password='12349876')

This worked but the WiFi network was open. I can't think why it would be different specifying arguments in separate variables but possible it's an oddity of the port I guess.

User avatar
neilgl
Posts: 5874
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near The National Museum of Computing

Re: Pi Pico W Access Point

Sun Jul 03, 2022 2:28 pm

Interestingly, that example sort of works for me but gives an unsecured AP called PICO2947

Code: Select all

import network
ssid = 'MicroPython-AP'
password = '123456789'

ap = network.WLAN(network.AP_IF)
ap.active(True)
ap.config(essid=ssid, password=password)
Have I got the right version of MicroPython for pico-w? Mine is: micropython-firmware-pico-w-290622.uf2
Although the "connecting-to-the-internet-with-pico-w.pdf" links to :rp2-pico-w-20220630-unstable-v1.19.1-88-g99c258977.uf2
(Same result with that version...)

Patrick1234
Posts: 23
Joined: Sun Feb 21, 2021 11:40 pm

Re: Pi Pico W Access Point

Sun Jul 03, 2022 2:49 pm

Hi Niel,

I had the same experience. You can change the SSID by moving the active() statement after assigning the SSID name. Still the same problem with an unsecured access point though.

User avatar
neilgl
Posts: 5874
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near The National Museum of Computing

Re: Pi Pico W Access Point

Sun Jul 03, 2022 3:30 pm

Yes, moving the ap.active(True) to after the ap.config works. (like the ESP32 documentation has it)
What does NOT work is having the password parameter.

fivdi
Posts: 579
Joined: Sun Sep 23, 2012 8:09 pm

Re: Pi Pico W Access Point

Sun Jul 03, 2022 3:55 pm

If I'm not mistaken, the config parameters that MicroPython has on offer for the Pico W can be seen here and are:
  • antenna
  • channel
  • ssid or essid
  • monitor
  • key or password
  • pm
  • trace
  • txpower
The security or authmode parameter which is supported on the ESP32 doesn't appear to be available for the Pico W.

That being said, there is a C SDK example called access_point in the pico_examples repository and the access point is secured. It's secured by calling cyw43_arch_enable_ap_mode here.
https://github.com/fivdi

Patrick1234
Posts: 23
Joined: Sun Feb 21, 2021 11:40 pm

Re: Pi Pico W Access Point

Sun Jul 03, 2022 4:12 pm

Hi,

I would agree that the issue seems to be that the security or authmode Param is not implemented. I hope that this is just a temporary issue and wl be picked up by a future release soon as it's a significant safety/reliability issue especially considering the client limit is 4.
I'm also hesitant about using the Pico as a client as without an encryption feature such as the ESP32 offers the network password is vulnerable. I
Also I wonder about the possibility of remote reconfiguration when an AP or as a client.
I really like the Pico so hope at least secure AP functionality can be implemented soon

User avatar
aallan
Raspberry Pi Employee & Forum Moderator
Raspberry Pi Employee & Forum Moderator
Posts: 321
Joined: Mon Feb 09, 2015 11:30 am
Location: Exeter, UK

Re: Pi Pico W Access Point

Sun Jul 03, 2022 4:27 pm

Patrick1234 wrote:
Sun Jul 03, 2022 1:12 pm
This worked but the WiFi network was open…

Huh. This does seem to be the case for the current release build, I'm also seeing an open network.

However it did work in earlier, pre-release builds, of MicroPython. Leave it with me, I'll start an internal email chain and see if we can sort this out.
Head of Documentation
Raspberry Pi Ltd
About me, http://alasdairallan.com

Patrick1234
Posts: 23
Joined: Sun Feb 21, 2021 11:40 pm

Re: Pi Pico W Access Point

Sun Jul 03, 2022 4:38 pm

Hi Alan,

Many thanks
For looking into this.

Patrick

User avatar
neilgl
Posts: 5874
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near The National Museum of Computing

Re: Pi Pico W Access Point

Sun Jul 03, 2022 5:43 pm

Yes thanks.
The C access point works (poll version) with SSID = picow_test and password = password
It is shown (on connected phone) as WPA/WPA2-Personal
Thanks fivdi

hippy
Posts: 13434
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Pi Pico W Access Point

Sun Jul 03, 2022 8:08 pm

fivdi wrote:
Sun Jul 03, 2022 3:55 pm
The security or authmode parameter which is supported on the ESP32 doesn't appear to be available for the Pico W.
They look to be here to me - https://github.com/micropython/micropyt ... w43.c#L232

Both "auth" and "security" there, with "auth" noted as deprecated a few lines below where "security" supplants it. I'm guessing "auth" is what used to be "authmode" on other boards - MicroPython seems to make a habit of that, making the new subtly different to what's gone before and what the documentation says. That means example code and libraries for one board annoyingly won't work as is on another even though they should and could.


Oops - That's 'connet' not 'config'.

As to how it works, or why it doesn't - Can't help there it's all new to me. I think you have to dig through the layers to figure out what does what, and why it isn't.
Last edited by hippy on Sun Jul 03, 2022 9:02 pm, edited 1 time in total.

Patrick1234
Posts: 23
Joined: Sun Feb 21, 2021 11:40 pm

Re: Pi Pico W Access Point

Sun Jul 03, 2022 8:28 pm

Interesting, I couldn't find a stable version of the Pico W micropython u2f file. Maybe it's just a damaged file on Fridays build?
At the moment "security" nor "auth" appear to operate in this build.
I'll try next week and see where I get.
I'm wondering if there is a way to list all parameters available - perhaps using inspect?

fivdi
Posts: 579
Joined: Sun Sep 23, 2012 8:09 pm

Re: Pi Pico W Access Point

Sun Jul 03, 2022 8:59 pm

hippy wrote:
Sun Jul 03, 2022 8:08 pm
fivdi wrote:
Sun Jul 03, 2022 3:55 pm
The security or authmode parameter which is supported on the ESP32 doesn't appear to be available for the Pico W.
They look to be here to me - https://github.com/micropython/micropyt ... w43.c#L232
To me that looks like part of the connect method which isn't used for access points (this topic is about access points.)
https://github.com/fivdi

hippy
Posts: 13434
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Pi Pico W Access Point

Sun Jul 03, 2022 9:05 pm

fivdi wrote:
Sun Jul 03, 2022 8:59 pm
hippy wrote:
Sun Jul 03, 2022 8:08 pm
fivdi wrote:
Sun Jul 03, 2022 3:55 pm
The security or authmode parameter which is supported on the ESP32 doesn't appear to be available for the Pico W.
They look to be here to me - https://github.com/micropython/micropyt ... w43.c#L232
To me that looks like part of the connect method which isn't used for access points (this topic is about access points.)
Yes; I was editing my post to correct that. I concur - it doesn't appear to be supported.

Patrick1234
Posts: 23
Joined: Sun Feb 21, 2021 11:40 pm

Re: Pi Pico W Access Point

Sun Jul 03, 2022 9:32 pm

Hi,
Ive had a crude look:
print(station.config("mac")
print(station.config("essid")
print(station.config("key")
All respond as expected, auth, auth_mode, security all return the expected "unknown config param" error.

Taki7o7
Posts: 5
Joined: Fri Jul 01, 2022 7:31 pm

Re: Pi Pico W Access Point

Mon Jul 04, 2022 6:33 am

Patrick1234 wrote:
Sun Jul 03, 2022 9:32 pm
Hi,
Ive had a crude look:
print(station.config("mac")
print(station.config("essid")
print(station.config("key")
All respond as expected, auth, auth_mode, security all return the expected "unknown config param" error.
can you report this on the github repo?

//Edit: Nvm, i've done it now: https://github.com/micropython/micropython/issues/8858
Last edited by Taki7o7 on Mon Jul 04, 2022 6:48 am, edited 1 time in total.

User avatar
aallan
Raspberry Pi Employee & Forum Moderator
Raspberry Pi Employee & Forum Moderator
Posts: 321
Joined: Mon Feb 09, 2015 11:30 am
Location: Exeter, UK

Re: Pi Pico W Access Point

Mon Jul 04, 2022 8:04 am

Patrick1234 wrote:
Sun Jul 03, 2022 8:28 pm
Interesting, I couldn't find a stable version of the Pico W micropython u2f file. Maybe it's just a damaged file on Fridays build?

There hasn't yet been a stable release for Pico W.
Head of Documentation
Raspberry Pi Ltd
About me, http://alasdairallan.com

hippy
Posts: 13434
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Pi Pico W Access Point

Mon Jul 04, 2022 11:35 am

Patrick1234 wrote:
Sun Jul 03, 2022 8:28 pm
Interesting, I couldn't find a stable version of the Pico W micropython u2f file.
MicroPython have moved away from using "stable" and "unstable" terminology to using "release" and "nightly build". That avoids any incorrect interpretation that 'stable is reliable but unstable isn't".

A "nightly build" should be no less stable than a "release" in terms of reliability of operation. It's just that there may be some recently added features which need to be tested further, or issues ironed out, before it becomes a "release".

If something is not in a particular build it is unlikely that the UF2 is corrupt, more likely it has not been implemented due to an oversight or being a forthcoming feature, the implementation has changed but that has not been documented everywhere, or there have been issues not previously identified with the implementation; good old fashioned bugs.

MicroPython builds for the Pico-W can be found here -
There is only a "nightly build" at the present time. Releases tend to happen every 3 to 5 months, but a 1.19.2 or 1.20.1 release may arrive sooner. Just use the latest "nightly build" until it does.

User avatar
aallan
Raspberry Pi Employee & Forum Moderator
Raspberry Pi Employee & Forum Moderator
Posts: 321
Joined: Mon Feb 09, 2015 11:30 am
Location: Exeter, UK

Re: Pi Pico W Access Point

Tue Jul 05, 2022 8:03 am

Looks like this issue has now been resolved, see https://github.com/micropython/micropython/issues/8858.
Head of Documentation
Raspberry Pi Ltd
About me, http://alasdairallan.com

Patrick1234
Posts: 23
Joined: Sun Feb 21, 2021 11:40 pm

Re: Pi Pico W Access Point

Tue Jul 05, 2022 8:19 am

That's great news. Many thanks

User avatar
neilgl
Posts: 5874
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near The National Museum of Computing

Re: Pi Pico W Access Point

Tue Jul 05, 2022 8:34 am

Tested with the 4th July version - still gives security = None, so maybe I need to wait for a later build than :
rp2-pico-w-20220704-unstable-v1.19.1-90-g3d76292f3.uf2

User avatar
aallan
Raspberry Pi Employee & Forum Moderator
Raspberry Pi Employee & Forum Moderator
Posts: 321
Joined: Mon Feb 09, 2015 11:30 am
Location: Exeter, UK

Re: Pi Pico W Access Point

Tue Jul 05, 2022 8:43 am

neilgl wrote:
Tue Jul 05, 2022 8:34 am
Tested with the 4th July version - still gives security = None, so maybe I need to wait for a later build than :
rp2-pico-w-20220704-unstable-v1.19.1-90-g3d76292f3.uf2

Looking at the timestamps on my emails it should be in today's (5th July) nightly build. Or you could just download the source and build the UF2 yourself?
Head of Documentation
Raspberry Pi Ltd
About me, http://alasdairallan.com

hippy
Posts: 13434
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Pi Pico W Access Point

Tue Jul 05, 2022 8:48 am

The good news is that the fixes have made it way into the latest source code - v1.19.1-93

The bad news is it no longer builds - - Solved : viewtopic.php?p=2017292#p2017292
Last edited by hippy on Tue Jul 05, 2022 9:26 am, edited 1 time in total.

User avatar
aallan
Raspberry Pi Employee & Forum Moderator
Raspberry Pi Employee & Forum Moderator
Posts: 321
Joined: Mon Feb 09, 2015 11:30 am
Location: Exeter, UK

Re: Pi Pico W Access Point

Tue Jul 05, 2022 9:00 am

hippy wrote:
Tue Jul 05, 2022 8:48 am
The good news is that the fixes have made it way into the latest source code - v1.19.1-93

The bad news is it no longer builds…

Just checked, v1.19.1-93 built for me out of the box?
MicroPython running an AP.jpg
MicroPython running an AP.jpg (69.43 KiB) Viewed 6941 times
Head of Documentation
Raspberry Pi Ltd
About me, http://alasdairallan.com

Return to “MicroPython”