Two Issues about autostart

General discussion about topics related to OpenMV.
PKUEcho
Posts: 4
Joined: Sat Jun 29, 2019 11:03 am

Two Issues about autostart

Postby PKUEcho » Sat Jun 29, 2019 11:12 am

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!
User avatar
kwagyeman
Posts: 3188
Joined: Sun May 24, 2015 2:10 pm

Re: Two Issues about autostart

Postby kwagyeman » Sat Jun 29, 2019 1:02 pm

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.
Nyamekye,
PKUEcho
Posts: 4
Joined: Sat Jun 29, 2019 11:03 am

Re: Two Issues about autostart

Postby PKUEcho » Sat Jun 29, 2019 1:20 pm

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:

Code: Select all

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...
User avatar
kwagyeman
Posts: 3188
Joined: Sun May 24, 2015 2:10 pm

Re: Two Issues about autostart

Postby kwagyeman » Sat Jun 29, 2019 3:41 pm

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.
Nyamekye,
User avatar
kwagyeman
Posts: 3188
Joined: Sun May 24, 2015 2:10 pm

Re: Two Issues about autostart

Postby kwagyeman » Sat Jun 29, 2019 3:42 pm

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).
Nyamekye,
User avatar
iabdalkader
Posts: 912
Joined: Sun May 24, 2015 3:53 pm

Re: Two Issues about autostart

Postby iabdalkader » Sat Jun 29, 2019 6:09 pm

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.
PKUEcho
Posts: 4
Joined: Sat Jun 29, 2019 11:03 am

Re: Two Issues about autostart

Postby PKUEcho » Sat Jun 29, 2019 6:28 pm

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?
User avatar
iabdalkader
Posts: 912
Joined: Sun May 24, 2015 3:53 pm

Re: Two Issues about autostart

Postby iabdalkader » Sat Jun 29, 2019 7:03 pm

That's true, I confirmed there's an issue with RTC waking up the MCU. It will be fixed in the next release.
PKUEcho
Posts: 4
Joined: Sat Jun 29, 2019 11:03 am

Re: Two Issues about autostart

Postby PKUEcho » Sat Jun 29, 2019 8:29 pm

May I ask when the new release will come? I'm relying on this measurement for my research project. Thanks!
User avatar
iabdalkader
Posts: 912
Joined: Sun May 24, 2015 3:53 pm

Re: Two Issues about autostart

Postby iabdalkader » Mon Jul 01, 2019 11:38 am

It could take a while we have a lot of issues to fix.
otills
Posts: 13
Joined: Fri Aug 09, 2019 4:42 am

Re: Two Issues about autostart

Postby otills » Mon Aug 12, 2019 7:45 am

Has the issue with RTC been resolved as I cannot get rtc.wakeup() working at all?
User avatar
iabdalkader
Posts: 912
Joined: Sun May 24, 2015 3:53 pm

Re: Two Issues about autostart

Postby iabdalkader » Mon Aug 12, 2019 9:30 am

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.
otills
Posts: 13
Joined: Fri Aug 09, 2019 4:42 am

Re: Two Issues about autostart

Postby otills » Mon Aug 12, 2019 9:42 am

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.
User avatar
iabdalkader
Posts: 912
Joined: Sun May 24, 2015 3:53 pm

Re: Two Issues about autostart

Postby iabdalkader » Mon Aug 12, 2019 10:35 am

Not unless you control power to the camera with another board. I'll try to work on this today.
otills
Posts: 13
Joined: Fri Aug 09, 2019 4:42 am

Re: Two Issues about autostart

Postby otills » Mon Aug 12, 2019 2:04 pm

Thanks.

I really appreciate you doing what you can. I have 8 x H7s all requiring this feature ASAP.
User avatar
iabdalkader
Posts: 912
Joined: Sun May 24, 2015 3:53 pm

Re: Two Issues about autostart

Postby iabdalkader » Mon Aug 12, 2019 4:27 pm

Hi, the attached firmware should fix the issue. Note while sleep/stop mode now works, deepsleep is still not supported on the H7.
Attachments
firmware.zip
(955.06 KiB) Downloaded 32 times
otills
Posts: 13
Joined: Fri Aug 09, 2019 4:42 am

Re: Two Issues about autostart

Postby otills » Tue Aug 13, 2019 4:24 am

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".
otills
Posts: 13
Joined: Fri Aug 09, 2019 4:42 am

Re: Two Issues about autostart

Postby otills » Tue Aug 13, 2019 4:57 am

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!!
otills
Posts: 13
Joined: Fri Aug 09, 2019 4:42 am

Re: Two Issues about autostart

Postby otills » Tue Aug 13, 2019 8:50 am

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..

Code: Select all

import pyb

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

Code: Select all

>>> (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.
User avatar
iabdalkader
Posts: 912
Joined: Sun May 24, 2015 3:53 pm

Re: Two Issues about autostart

Postby iabdalkader » Tue Aug 13, 2019 11:45 am

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

Code: Select all

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
otills
Posts: 13
Joined: Fri Aug 09, 2019 4:42 am

Re: Two Issues about autostart

Postby otills » Tue Aug 13, 2019 1:53 pm

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'?
User avatar
iabdalkader
Posts: 912
Joined: Sun May 24, 2015 3:53 pm

Re: Two Issues about autostart

Postby iabdalkader » Tue Aug 13, 2019 2:11 pm

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.
otills
Posts: 13
Joined: Fri Aug 09, 2019 4:42 am

Re: Two Issues about autostart

Postby otills » Tue Aug 13, 2019 5:55 pm

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!
User avatar
kwagyeman
Posts: 3188
Joined: Sun May 24, 2015 2:10 pm

Re: Two Issues about autostart

Postby kwagyeman » Wed Aug 14, 2019 11:50 am

I think Ibrahim put a fix in for this on github.
Nyamekye,
User avatar
iabdalkader
Posts: 912
Joined: Sun May 24, 2015 3:53 pm

Re: Two Issues about autostart

Postby iabdalkader » Wed Aug 14, 2019 12:59 pm

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

Return to “General Topics”

Who is online

Users browsing this forum: No registered users and 1 guest