← index #15623Issue #17940
Off-topic · high · value 2.465
QUERY · ISSUE

RP2350 / Pico 2 machine.deepsleep results in crash

openby geerlingguyopened 2024-08-08updated 2025-03-03
bugport-rp2

Port, board and/or hardware

Pico 2 / RP2350

MicroPython version

MicroPython v1.24.0-preview.201.g269a0e0e1 on 2024-08-09; Raspberry Pi Pico2 with RP2350

Reproduction

  1. Install latest Firmware from https://micropython.org/download/RPI_PICO2/
  2. Implement machine.deepsleep(5000) in your code
  3. Run code.

Expected behaviour

Expected Pico 2 to enter deepsleep mode for 5 seconds, then continue to next bit of code.

Observed behaviour

Upon reaching deepsleep, the LED on my Pico blinks when it reaches that part of the code, but Thonny's console outputs:

PROBLEM IN THONNY'S BACK-END: Exception while handling 'Run' (ConnectionError: read failed: [Errno 6] Device not configured).
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.
Unable to connect to /dev/cu.usbmodem83101: [Errno 2] could not open port /dev/cu.usbmodem83101: [Errno 2] No such file or directory: '/dev/cu.usbmodem83101'

Contents of backend.log after the Shell displays that error:

12:00:29.977 [MainThread] INFO    thonny: Thonny version: 4.1.4
12:00:29.977 [MainThread] INFO    thonny: cwd: /Users/jgeerling
12:00:29.977 [MainThread] INFO    thonny: original argv: ['/Applications/Thonny.app/Contents/Frameworks/Python.framework/Versions/3.10/Resources/Python.app/Contents/MacOS/Python', '-s', '-u', '-B', '/Applications/Thonny.app/Contents/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/thonny/plugins/rp2040/rp2040_back.py', "{'clean': True, 'port': '/dev/cu.usbmodem83101', 'dtr': None, 'rts': None, 'submit_mode': 'raw_paste', 'interrupt_on_connect': True, 'write_block_size': 64, 'write_block_delay': None, 'proxy_class': 'RaspberryPiPicoBackendProxy', 'sync_time': True, 'validate_time': False, 'local_rtc': True}"]
12:00:29.977 [MainThread] INFO    thonny: sys.executable: /Applications/Thonny.app/Contents/Frameworks/Python.framework/Versions/3.10/bin/python3.10
12:00:29.977 [MainThread] INFO    thonny: sys.argv: ['/Applications/Thonny.app/Contents/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/thonny/plugins/rp2040/rp2040_back.py', "{'clean': True, 'port': '/dev/cu.usbmodem83101', 'dtr': None, 'rts': None, 'submit_mode': 'raw_paste', 'interrupt_on_connect': True, 'write_block_size': 64, 'write_block_delay': None, 'proxy_class': 'RaspberryPiPicoBackendProxy', 'sync_time': True, 'validate_time': False, 'local_rtc': True}"]
12:00:29.977 [MainThread] INFO    thonny: sys.path: ['/Applications/Thonny.app/Contents/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/thonny/plugins/rp2040', '/Applications/Thonny.app/Contents/Frameworks/Python.framework/Versions/3.10/lib/python310.zip', '/Applications/Thonny.app/Contents/Frameworks/Python.framework/Versions/3.10/lib/python3.10', '/Applications/Thonny.app/Contents/Frameworks/Python.framework/Versions/3.10/lib/python3.10/lib-dynload', '/Applications/Thonny.app/Contents/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages']
12:00:29.977 [MainThread] INFO    thonny: sys.flags: sys.flags(debug=0, inspect=0, interactive=0, optimize=0, dont_write_bytecode=1, no_user_site=1, no_site=0, ignore_environment=0, verbose=0, bytes_warning=0, quiet=0, hash_randomization=1, isolated=0, dev_mode=False, utf8_mode=0, warn_default_encoding=0, int_max_str_digits=-1)
12:00:29.978 [MainThread] INFO    thonny.plugins.micropython.bare_metal_backend: Starting backend, args: {'clean': True, 'port': '/dev/cu.usbmodem83101', 'dtr': None, 'rts': None, 'submit_mode': 'raw_paste', 'interrupt_on_connect': True, 'write_block_size': 64, 'write_block_delay': None, 'proxy_class': 'RaspberryPiPicoBackendProxy', 'sync_time': True, 'validate_time': False, 'local_rtc': True}

Additional Information

Full code example:

# Lightsleep MicroPython example.
from machine import Pin
import time
led = Pin(25, Pin.OUT)

while True:
    led.toggle()
    time.sleep_ms(5000)
    led.toggle()
    machine.deepsleep(5000)

On the original Pico, deepsleep was, I believe, an alias to lightsleep. On Pico 2, it looks like there are deeper sleep states that may be implemented and an internal RTC that can be used to wake the chip... is it possible that either the deepsleep option could differ on the Pico 2, or should it just remain an alias to lightsleep?

Either way, the behavior here is different than lightsleep—which also breaks right now, see #15622.

Code of Conduct

Yes, I agree

CANDIDATE · ISSUE

Large Viper code causing hang/crash on RP2350 but OK on RP2040

closedby samneggsopened 2025-08-16updated 2025-08-19
bug

Port, board and/or hardware

MicroPython v1.26.0 on 2025-08-09; Raspberry Pi Pico2 with RP2350

MicroPython version

MicroPython v1.26.0 on 2025-08-09; Raspberry Pi Pico2 with RP2350
Large viper functions have been improved in v26 and shown to work on RP2040. The same code on a RP2350 however causes the pico VM to hang or crash.
In the code below a DEPTH of 500 works but 600 crashes.

Reproduction

DEPTH = const(600)

src = "@micropython.viper\ndef big_jump() -> int:\n"
src += "    x = 0\n"
src += "    while x < 10:\n"
for i in range(DEPTH):
    src += f"        x += 1\n"
src += "    return x"

#print(src)
exec(src)
print(big_jump())

### Expected behaviour

_No response_

### Observed behaviour

Observed behaviour is that the RP2350 is non responsive and requires a hard reset.

### Additional Information

No, I've provided everything above.

### Code of Conduct

Yes, I agree

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied