pimoroni / badger2040

Examples and firmware for Badger 2040 and Badger 2040 W
MIT License
165 stars 52 forks source link

Wifi not initializing on Badger2040W #32

Open christopherdoyle opened 1 year ago

christopherdoyle commented 1 year ago

I am getting the following error trying to initialize wifi network using .connect:

ampy.pyboard.PyboardError: ('exception', b'', b'Traceback (most recent call last):\r\n  File "<stdin>", line 19, in <module>\r\n  File "badger2040.py", line 264, in connect\r\n  File "uasyncio/core.py", line 1, in run_until_complete\r\n  File "uasyncio/core.py", line 1, in run_until_complete\r\n  File "uasyncio/core.py", line 1, in run_until_complete\r\n  File "network_manager.py", line 78, in client\r\nOSError: [Errno 1] EPERM\r\n')

I have tried this on 3 different wifi networks and with v0.0.1 and v0.0.2 of the firmware, and the firmware from the latest build.

The simplest example of the error is:

>>> import network
>>> wlan = network.WLAN(network.STA_IF)
>>> wlan.active(True)
>>> wlan.scan()
Traceback (most recent call last):   
  File "<stdin>", line 1, in <module>
OSError: [Errno 1] EPERM

I thought hardware issue, but then I flashed the latest stock rp2 pico-w firmware, and the same command works correctly and lists wifi networks. I am able to connect with wlan.connect and get an ip address.

christopherdoyle commented 1 year ago

Specifically clocking to "fast" seems to fix this, doesn't really explain the difference between badger2040w firmware and pico-w firmware though.

badger2040.system_speed(badger2040.SYSTEM_FAST)
Gadgetoid commented 1 year ago

Relates to WiFi simply breaking at slower clock speeds which is mentioned here - https://github.com/pimoroni/badger2040/pull/25