Skip to content

rp2040 light_sleep did not restore clocks #8561

Closed
@Sokoloft

Description

@Sokoloft

CircuitPython version

Adafruit CircuitPython 9.0.0-alpha.2 on 2023-10-27; Adafruit Feather RP2040 with rp2040

Code/REPL

# import
import alarm
import board
import pwmio
#import simpleio
import time

# Time values set by user
seconds = 10 #testing
minutes = 0
hours = 0
days = 0

# math
minute = minutes * 60
hour = hours * 3600
day = days * 86400
val = minute + hour + day

# power on tone

# simpleio
#simpleio.tone(board.A0, 1000, duration=0.5)

# pwmio
piezo = pwmio.PWMOut(board.A0, duty_cycle=0, frequency=440, variable_frequency=False)
piezo.duty_cycle = 65535 // 2  # On 50%
time.sleep(1)
piezo.duty_cycle = 0 # off

# wait for timer
print("Sleeping for", val, "seconds...")
#time.sleep(seconds)
time_alarm = alarm.time.TimeAlarm(monotonic_time=time.monotonic() + seconds)
alarm.light_sleep_until_alarms(time_alarm)
while True:
    print("Beeping...")
    #simpleio.tone(board.A0, 1000, duration=0.5)
    piezo.duty_cycle = 65535 // 2  # On 50%
    time.sleep(1)
    piezo.duty_cycle = 0 # off
    time.sleep(1)

Behavior

The code runs through. In the loop, I receive unexpected behavior with my attached piezo beeper not beeping as it should.

Description

With simpleio, I will receive a beep from the piezo beeper under #power on tone. However once alarm is called and woken back up. In the loop I only get the print statement. No tone from the piezo beeper. This persists until the hardware is reset.

With pwmio, I again receive the beep under #power on tone at its stated frequency. After alarm, I will receive the print statement in console many times before I hear a tone from the piezo beeper. The tone is not at its stated frequency and is higher pitched. The tone is also on longer than one second. The tone seems to toggle off after the loop has gone around 3 times. Reloading the code in REPL, I do not receive the #power on tone, I do however eventually get beeping from the loop with the same behavior described. It takes a hardware reset to hear the #power on tone again.

I've tried both circuitpython stable release 8.2.7, and now the alpha 9.x release. Both have the same outcome.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions