Deep Sleep RT1062 challenges in latest release

Hello,

Recently when configuring the RT1062 (firmware version 4.54) to enter a deep sleep state and wake from the machine.rtc library by using either the rtc.wakeup() function provided in the example I encounter an error: AttributeError: ‘RTC’ object has no attribute ‘wakeup’. Previously this worked somewhat in earlier firmware versions. After reading the machine library documentation, I have attempted to use the rtc.irq() function to set a wake up trigger by the rtc.alarm function. When I attempt this, it states that for the rtc.irq function wake parameter that the machine.DEEPSLEEP constant does not exist. Is there a preferred method and if it is to use the machine library is there a way to provide a correct value for the wake parameter?

Hi, this happened because of the upstream MicroPython changes.

When I first implemented RTC support I included all methods I could think of across all ports since there was not a unified API. My PR was then reduced to only methods MP folks wanted to see and not duplicates. Yes, the wakeup method was easier to use. However, it’s broken up into an alarm method and irq method. So, you have to set an irq callback (if just using the RTC as a timer) and then activate the alarm for triggering.

For you, you just need to use the alarm() method. Setting an IRQ isn’t required when waking up from deepsleep as no context will be saved.

micropython/ports/mimxrt/machine_rtc.c at fff2e1fb525cd8f92aadecbd9901abada1e891d1 · openmv/micropython (github.com)

Thank you for the prompt response! That makes sense. I’ll remove the irq method call and give it a try!