Pico 2W fails to write to NeoPixels from second core
Port, board and/or hardware
Pico 2 W and 4 LED NeoPixel string
MicroPython version
MicroPython v1.27.0 on 2025-12-09; Raspberry Pi Pico 2 W with RP2350
Writing from core0 on GPIO 22 to a 4 LED string works fine using neopixel library. Writing to same GPIO from core1 produces a random 'bright' display.
Code below is based on example in MicroPython NeoPixel documentation.
Reproduction
import neopixel
from machine import Pin
import _thread
def main1():
n = neopixel.NeoPixel(Pin(22), 4)
# Draw a red gradient.
for i in range(4):
n[i] = (i, 0, 0)
# Update the strip.
n.write()
_thread.start_new_thread(main1,())
Expected behaviour
Expected to see a red gradient as per comments in code.
Observed behaviour
Random display (all four LEDS lit). Replacing _thread.start_thread(main1,()) by main1() gives correct output.
Additional Information
No, I've provided everything above.
Code of Conduct
Yes, I agree
RP2 Hanging on file write after soft reboot when a thread was started
Port, board and/or hardware
RP2 Pico
MicroPython version
MicroPython v1.23.0-5.g3613ad962 on 2024-05-31; Raspberry Pi Pico with RP2040
Reproduction
- Copy this code to main.py
- Run the code
- Do soft reboot
If the thread is started before writing to the file, it works. If the thread has not been started, it hangs.
import _thread
import time
thread_running = True
def second_thread():
while thread_running:
print("Second thread running")
time.sleep(1)
#thread = _thread.start_new_thread(second_thread,()) # Works if thread is started here
print("Writing file 1") # Hangs here after soft reboot
with open("test1.bin","w") as fh:
fh.write(b'test')
print("Writing file 2") # Hangs here after soft reboot
with open("test.bin","ab") as fh:
fh.write(b'test')
print("End writing file")
thread = _thread.start_new_thread(second_thread,())
try:
while True:
print("First thread running")
time.sleep(1)
except KeyboardInterrupt:
thread_running = False
time.sleep(2)
Expected behaviour
The file should be written without blocking after a soft reboot whether the thread is started before or after writing the file.
Observed behaviour
After soft reboot, the micro hangs and it needs a hard reset.
Additional Information
I think everything is here. I'm running the code on a custom hardware (compatible with pico), I'll try with a pico whenever I can access one.
Please ask if you want me to try something or you need more info.
Also, I did not experience bugs on 1.21.0 (although I did not try this specific code yet). It seems it happens in 1.22/1.23.
Code of Conduct
Yes, I agree