Pico w/thonny reboot loop

I’m trying to run the sample code on a plasma stick, with this light Neon-like RGB LED Strip with Diffuser (aka NeoPixel, WS2812, SK6812) – all the examples work (after I rearranged the RGB order) EXCEPT the wifi example. that makes thonny throw a strop and the pico gets stuck in a reboot loop:

PROBLEM IN THONNY’S BACK-END: Exception while handling ‘Run’ (ConnectionError: EOF).
See Thonny’s backend.log for more info.
You may need to press “Stop/Restart” or hard-reset your MicroPython device and try again.

Process ended with exit code 1.
Couldn’t find the device automatically.
Check the connection (making sure the device is not in bootloader mode) or choose
“Configure interpreter” in the interpreter menu (bottom-right corner of the window)
to select specific port or another interpreter.

There’s nothing in that backend log that looks like an error. I’ve set the wifi SSID and password correctly.

any ideas?

Which example is this - please can you post your code? Does Thonny manage to run any of it before it crashes?

it’s cheerlights.py from the plasma 2040 examples: pimoroni-pico/micropython/examples/plasma_stick at be95e71049c4db68cd941864e1db991d38183539 · pimoroni/pimoroni-pico · GitHub

If I leave the WIFI_CONFIG.py on default, I get spooky rainbows and no reboot loop. If I set my details and country code GB, I get the reboot loop.

Before the loop, I get the following output:

Client None
Connecting to wifi...

eventually thonny will spit out a callstack, but I’m not sure if that’s the cause of the loop or a symptom of the loop:

Traceback (most recent call last):
  File "main.py", line 86, in <module>
  File "uasyncio/core.py", line 1, in run_until_complete
  File "uasyncio/core.py", line 1, in run_until_complete
  File "network_manager.py", line 55, in wait
  File "network_manager.py", line 60, in _handle_status
  File "main.py", line 29, in status_handler
MicroPython 9dfabcd on 2022-10-19; Raspberry Pi Pico W with RP2040
Type "help()" for more information.

Curious - have you double checked your wifi credentials are correct and that there’s sufficient wifi signal for the Pico W to connect to (the range of the antenna isn’t huge)? Might also be worth trying connecting to a different network (or wifi hotspot) if you have one handy, to rule out router shenanigans?

I can’t seem to replicate your issue but with the locking up if I put in incorrect wifi details mine churns away for about 30 seconds trying to connect, and finally times out with the following. I can still talk to/interrupt the board with Thonny though.

Traceback (most recent call last):
  File "<stdin>", line 235, in <module>
  File "uasyncio/core.py", line 1, in run_until_complete
  File "uasyncio/core.py", line 1, in run_until_complete
  File "uasyncio/core.py", line 1, in run_until_complete
  File "network_manager.py", line 86, in client
  File "network_manager.py", line 66, in _handle_error
RuntimeError: WIFI Client Failed

Just had a thought - if you’ve got a lot of LEDs connected the USB device might be malfunctioning due to the high current draw (I had this when trying to talk to a Plasma Stick with 100ish LEDs whilst connected via a USB hub).

Might be worth trying reducing NUM_LEDS to 50 and seeing if you still have the same problem? You could also change the led_strip.set_rgb(i, 255, 255, 255) in the status_handler function to something like led_strip.set_rgb(i, 100, 100, 100) so it’s not trying to do full white.

ahhhhh you nailed it – it’s a 96 led strip and if I dropped NUM_LEDS to 30 it boots without a problem.

1 Like

a few demo scripts I’ve written that don’t use wifi were able to fill all 96 LEDs – but I guess the extra power of the wifi tips it over the edge?