micropython / micropython/micropython
if uart receives 0xf0 byte then mcu after entering lightsleep never wakes up
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 22.1k
- Forks
- 9k
- Avg merge
- 6d 4h
- Merged PRs (30d)
- 16
Description
Checks
-
I agree to follow the MicroPython Code of Conduct to ensure a safe and respectful space for everyone.
-
I've searched for existing issues matching this bug, and didn't find any.
Port, board and/or hardware
RP2, STM32L4, STM32H7
MicroPython version
MicroPython v1.22.2 on 2024-02-22; Raspberry Pi Pico with RP2040
Reproduction
Example for Rpi Pico:
from machine import Pin, UART, lightsleep
from time import sleep
uart = UART(0, baudrate=115200, bits=8, tx=Pin(0), rx=Pin(1), parity=None, stop = 1, timeout=2000)
## Main Loop ##
uart.write("Start \n")
while True:
sleep(1)
buff=bytearray()
while uart.any():
buff.extend(bytearray(uart.read(uart.any())))
# to exit program send '9'
if buff.find(b"9")>=0:
break
if len(buff)>0:
buff.append(10)
uart.write(buff)
uart.write("before lightsleep \n")
lightsleep(100)
sleep(0.05)
uart.write("after lightsleep\n")
Expected behaviour
No response
Observed behaviour
If uart receives 0xf0 byte then mcu after entering lightsleep never wakes up.
If message doesn't have 0xf0 byte then it continues working ok.
I tried it on RPi Pico, and STM32 boards they have same behavior.
Additional Information
No, I've provided everything above.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with machine.UART and lightsleep using the provided Raspberry Pi Pico example, then compare behavior on the listed RP2, STM32L4, and STM32H7 ports. Trace the UART receive and lightsleep entry points; done means the MCU wakes and continues after receiving 0xf0, while existing behavior remains intact for other bytes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- embedded-iot
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100