Background
I have a 3V coin battery connected to VBAT and Gnd. The RTC battery has been connected for around a week and the date/time was set last week after adding the RTC battery. I've had the board powered off for 5 days now. Today I power on the pyboard and checked the time in the terminal and it was close to where it should be, maybe 20-30 seconds off. The program I have been running uses the sleep functionality of the pyboard (rtc.wakeup(...)) and uses interrupts. The program was working fine even after adding the new RTC battery backup.
Today I ran my program and it failed to run properly. I finally identified that once rtc.stop() was issued it never wakes again. I wrote a simple program to verify this:
Code: Select all
import pyb
import micropython
from pyb import Pin
YEL_LED = pyb.Pin('X4', pyb.Pin.OUT_PP, pull=pyb.Pin.PULL_UP)
rtc = pyb.RTC()
def toggle_YEL_LED(dt = 200):
YEL_LED.high()
pyb.delay(dt)
YEL_LED.low()
pyb.delay(dt)
def mainloop():
while True:
print("RTC Wake Event")
toggle_YEL_LED()
pyb.stop() # go to sleep until next wakeup
rtc.wakeup(15000)
mainloop()
Therefore, I powered off the pyboard and disconnected the power and Gnd from the RTC backup battery. Then I powered on the pyboard and ran the above program and the sleep/wake cycle started working again! I then re-connected VBAT, set the clock and ran the above program and it worked as expected (no issue). Therefore, is there a bug which caused sleep/wake to stop working (related to the battery) and perhaps since the pyboard was not powered for days? For me this is a serious issue.