Two Issues about autostart

Hi all, I just bought two OpenMV H7 and they are great.

I have two questions regarding the auto-start:

  1. When I click “Save Open Script to OpenMV Cam”, I saw the file is flushed to another of my mounted storage disk on Mac (a new “main.py” generated) instead of the OpenMV disk.
  2. I manually updated the main.py on OpenMV and click “Reset OpenMV Cam”. When I powered my OpenMV again, the script didn’t start. Instead, it just has the blue LED keep blinking… Waiting to connect to IDE.

What should I do? Thanks!

Hi, the issue is that you have another disk that OpenMV IDe thinks is your OpenMV Cam disk. You can fix this by clicking on the disk drive path in the status bar and selecting the right disk and the IDE will remember that. They the IDE can save the script to the right disk.

There’s no method for me to associate the disk with the serial port of the OpenMV Cam other than guessing. If you have two FAT drives plugged into the PC the IDE needs you to pick the correct one.

Thanks for your help. I have another question.

I’m testing the sleep/wakeup function. I want OpenMV to periodically wakeup and give LED signal. My code is following:

def capture_img():
    pass
def test_led():
    intvl = 0.5
    red_led.on()
    utime.sleep(intvl)
    red_led.off()
    green_led.on()
    utime.sleep(intvl)
    green_led.off()
    blue_led.on()
    utime.sleep(intvl)
    blue_led.off()


rtc = pyb.RTC()
rtc.wakeup(2000, capture_img)

while (True):
    test_led()
    pyb.stop() # sleeping mode, 500 uA

I flushed it into my OpenMV (w/o sd card). However, now everytime I try to open it it will switch between the three LED and then go off, and my IDE cannot recognize it. Seems like the wakeup function doesn’t work? And now I cannot even flush another script because it quickly goes off…

Um, yeah, the code is working exactly as you want. Your firmware has complete control over he camera so it’s turning the power off on the camera and kicking the IDE off.

You need to reflash the firmware to fix this. I need to add a disk erase method to get around this issue. I will do that. Basically, your script you are running has effectively bricked the camera. That said, the bootloader is still fine. So, you can erase the built-in disk onboard via that.

I highly recommend not putting power control code on the device without an SD card.

Anyway, to fix your camera, click the connect button without the camera plugged into the PC. Say your camera is bricked. Then select the right version, then plug your camera in and it will get reset back to the factory default state.

Regarding wakeup. I have to check on that. Did you follow how the RTC example works? (Answering this from my phone while out at an event. Please forgive me not being able to give exact code help).

Hi, I tested your code and it works fine on the F7 but not on the H7. It seems the low-power modes are broken on the H7 (I think it’s the RTC), anyway I’ll fix this in the next release.

EDIT: You should open an issue on github to make sure we don’t forget to fix this.

Thanks guys for your help!

Now I have a micro sdcard and get my camera back to normal. My goal is simple: I want to measure the power (via Monsoon meter) consumed by OpenMV from (deep) sleep → wake up → capture an image → store it on sdcard → go to (deep) sleep. According to iabdalkader, it seems like I cannot get it done without a new release?

That’s true, I confirmed there’s an issue with RTC waking up the MCU. It will be fixed in the next release.

May I ask when the new release will come? I’m relying on this measurement for my research project. Thanks!

It could take a while we have a lot of issues to fix.

Has the issue with RTC been resolved as I cannot get rtc.wakeup() working at all?

No not yet, sorry for the delays but it’s not an easy bug and I have to fix it upstream as well. The release should be out in two weeks, I’ll have it fixed before then.

OK - I would really appreciate an update when this is fixed - thanks for working on it.

I am trying to deploy some OpenMV’s to run in the environment for many weeks (with periodic video acquisitions)- are there any other approaches to reducing power consumption to levels that will make this possible in the interim while I wait for this fix? I need to get these deployed this week really.

Not unless you control power to the camera with another board. I’ll try to work on this today.

Thanks.

I really appreciate you doing what you can. I have 8 x H7s all requiring this feature ASAP.

Hi, the attached firmware should fix the issue. Note while sleep/stop mode now works, deepsleep is still not supported on the H7.
firmware.zip (955 KB)

Hi, thanks for this - seems to work now.

Do you have an eta on deep sleep? Or, suggestions on any kind of intermediate steps to a low power state. I have tried the sensor.sleep() and sensor.shutdown() - directly from the Deep Sleep Mode Example script, and get “OSError: Reset Failed Reset Failed”.

OK - I thought that I had fixed that sensor.reset() issue by using the IDE for doing a board reset (thinking that I must have broken something - perhaps attempting the deepsleep), but apparently not. Any attempt to put the sensor to sleep then throws this OSError: Reset Failed when it attempts to wake.

Should sensor sleep using the code from the Example scripts work following an rtc.wakeup call?

Enable sensor softsleep

sensor.sleep(True)

Shutdown the sensor (pulls PWDN high).

sensor.shutdown(True)

My script works fine until I introduce these sensor sleep functions to the end of the acquisition which then throw errors when the sensor is asked to reset at the beginning of the next acquisition!!

Apologies for the multiple posts, but this also relates to RTC.

No matter what I do with rtc.datetime, I get the date time (2000, 1, 1, 1, 0, 0, 0, 0) returned. I have tried various of the Example scripts in case the issue was with my own code, but as far as I can see this appears to be an issue with rtc…

import pyb

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

Returns:

>>> (2000, 1, 1, 1, 0, 0, 0, 0)
MicroPython v1.9.4-4571-g45deee14f-dirty on 2019-08-12; OPENMV4 with STM32H743
Type "help()" for more information.

Any ideas? This is using the firmware provided by iabdalkader yesterday.

You need to disable the sensor shutdown, before another reset:

sensor.shutdown(False)

As for the datetime issue, I’m not sure why it’s not working, but you don’t need to set datetime to get a callback. I’ll work on fixing this issue. The ETA for the release is 2-3 weeks