Two Issues about autostart

Hi, given that that both setting and returning the date time via rtc.datetime() returns an invariant and incorrect datetime, can you confirm that the rtc.wakeup() with a given time period can be considered accurate in its periodicity over a prolonged period of numerous ‘wakeups’?

I think so, it just counts from a different date/time. Anyway, give it a test and let me know and I’ll into it next weekend.

Hi, unfortunately rtc.wakeup does not appear to be working.

Changes to the time appear to have no effect on the sleep duration - which is only a few seconds…

I have persevered with this as thought it might be an issue with my code, but do think that the rtc.wakeup is broken!

I think Ibrahim put a fix in for this on github.

Okay I’ll have more time to work on this in the weekend.

Hi, are you sure that what you are testing is the firmware image which I’ve attached here ? It should say Firmware Version: 3.4.2 on the bottom left when connected…

No matter what I do with rtc.datetime, I get the date time (2000, 1, 1, 1, 0, 0, 0, 0) returned

This test prints the right datetime:

import pyb

rtc = pyb.RTC()
rtc.datetime((2019, 8, 12, 1, 11, 10, 10, 10))
print(rtc.datetime())

It prints:

(2019, 8, 12, 1, 11, 10, 10, 255)
MicroPython v1.9.4-4574-gf31c61e4d on 2019-08-20; OPENMV4 with STM32H743
Type “help()” for more information



Changes to the time appear to have no effect on the sleep duration - which is only a few seconds…

I used this to test RTC wakeup calls, and changing the wakeup time changes the LED frequency as expected:

import time, pyb, machine

led = pyb.LED(3)

def rtc_callback(arg):
    led.toggle()

rtc = pyb.RTC()
rtc.wakeup(500, rtc_callback)

while (True):
    time.sleep(10)

I noticed one issue with RTC and stop mode on the H7, it doesn’t wake up from longer wakeup times (like >5000ms). I’ll debug that.

Hi, yes I’m using the firmware version you linked to here. I’m trying to wake from sleeps longer than 5000 ms so perhaps that’s the problem?

Yes there’s an issue with that, it needs more debugging. For now you should only sleep for <= 5000 ms.

Ok thanks. Yeh I need to put the board to sleep for many minutes to get them to run for long enough on batteries for my application so 5 seconds is not useful. I will have to wait.

Hi, I noticed wakeup is not consistent (I think it has something to do with the backup SRAM content), anyway I just updated the RTC driver from upstream and merged in another fix to disable it after soft reset. I think it works fine now. As for that other issue, the camera does wake up after long sleeps but the host does not re-enumerate the USB port after 5 or 6 seconds. So after long sleeps you can’t reconnect, but the camera still wakes up and works just fine. To test just modify the default example, adding LED toggle after wake up:

# Stop Mode Example
# This example demonstrates using the low-power Stop Mode.

import time, pyb, machine

# Create and init RTC object.
rtc = pyb.RTC()
# (year, month, day[, hour[, minute[, second[, microsecond[, tzinfo]]]]])
rtc.datetime((2014, 5, 1, 4, 13, 0, 0, 0))

# Print RTC info.
print(rtc.datetime())

# Enable RTC interrupts every 5 seconds.
rtc.wakeup(2*60*1000)

# Enter Stop Mode.
# Note the IDE will disconnect.
machine.sleep()

led = pyb.LED(3)
while (True):
    led.toggle()
    time.sleep(500)
    led.toggle()
    time.sleep(500)

I’m attaching a firmware image if you want to test, just run this and wait 2 minutes and the blue LED will start to blink again.
firmware.zip (956 KB)

deepsleep is now supported on the H7 in the latest development firmware on github:

https://github.com/openmv/openmv/tree/master/firmware

Perfect!! Many thanks.

Sleep is working well for me now with the most recent firmware you shared posted.