Two Issues about autostart
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!
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!
Re: Two Issues about autostart
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.
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,
Re: Two Issues about autostart
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:
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...
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
Re: Two Issues about autostart
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.
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,
Re: Two Issues about autostart
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,
- iabdalkader
- Posts: 1042
- Joined: Sun May 24, 2015 3:53 pm
Re: Two Issues about autostart
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.
EDIT: You should open an issue on github to make sure we don't forget to fix this.
Re: Two Issues about autostart
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?
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?
- iabdalkader
- Posts: 1042
- Joined: Sun May 24, 2015 3:53 pm
Re: Two Issues about autostart
That's true, I confirmed there's an issue with RTC waking up the MCU. It will be fixed in the next release.
Re: Two Issues about autostart
May I ask when the new release will come? I'm relying on this measurement for my research project. Thanks!
- iabdalkader
- Posts: 1042
- Joined: Sun May 24, 2015 3:53 pm
Re: Two Issues about autostart
It could take a while we have a lot of issues to fix.
Re: Two Issues about autostart
Has the issue with RTC been resolved as I cannot get rtc.wakeup() working at all?
- iabdalkader
- Posts: 1042
- Joined: Sun May 24, 2015 3:53 pm
Re: Two Issues about autostart
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.
Re: Two Issues about autostart
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.
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.
- iabdalkader
- Posts: 1042
- Joined: Sun May 24, 2015 3:53 pm
Re: Two Issues about autostart
Not unless you control power to the camera with another board. I'll try to work on this today.
Re: Two Issues about autostart
Thanks.
I really appreciate you doing what you can. I have 8 x H7s all requiring this feature ASAP.
I really appreciate you doing what you can. I have 8 x H7s all requiring this feature ASAP.
- iabdalkader
- Posts: 1042
- Joined: Sun May 24, 2015 3:53 pm
Re: Two Issues about autostart
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 531 times
Re: Two Issues about autostart
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".
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".
Re: Two Issues about autostart
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!!
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!!
Re: Two Issues about autostart
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..
Returns:
Any ideas? This is using the firmware provided by iabdalkader yesterday.
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())
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.
- iabdalkader
- Posts: 1042
- Joined: Sun May 24, 2015 3:53 pm
Re: Two Issues about autostart
You need to disable the sensor shutdown, before another reset:
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
Code: Select all
sensor.shutdown(False)
Re: 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'?
- iabdalkader
- Posts: 1042
- Joined: Sun May 24, 2015 3:53 pm
Re: Two Issues about autostart
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.
Re: Two Issues about autostart
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!
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!
- iabdalkader
- Posts: 1042
- Joined: Sun May 24, 2015 3:53 pm
Re: Two Issues about autostart
Okay I'll have more time to work on this in the weekend.
- iabdalkader
- Posts: 1042
- Joined: Sun May 24, 2015 3:53 pm
Re: Two Issues about autostart
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...
It prints:
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.
This test prints the right datetime:No matter what I do with rtc.datetime, I get the date time (2000, 1, 1, 1, 0, 0, 0, 0) returned
Code: Select all
import pyb
rtc = pyb.RTC()
rtc.datetime((2019, 8, 12, 1, 11, 10, 10, 10))
print(rtc.datetime())
>>> (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
I used this to test RTC wakeup calls, and changing the wakeup time changes the LED frequency as expected:Changes to the time appear to have no effect on the sleep duration - which is only a few seconds..
Code: Select all
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.
Re: Two Issues about autostart
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?
- iabdalkader
- Posts: 1042
- Joined: Sun May 24, 2015 3:53 pm
Re: Two Issues about autostart
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.
- iabdalkader
- Posts: 1042
- Joined: Sun May 24, 2015 3:53 pm
Re: Two Issues about autostart
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:
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.
Code: Select all
# 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)
- Attachments
-
- firmware.zip
- (955.71 KiB) Downloaded 281 times
- iabdalkader
- Posts: 1042
- Joined: Sun May 24, 2015 3:53 pm
Re: Two Issues about autostart
deepsleep is now supported on the H7 in the latest development firmware on github:
https://github.com/openmv/openmv/tree/master/firmware
https://github.com/openmv/openmv/tree/master/firmware
Re: Two Issues about autostart
Perfect!! Many thanks.
Sleep is working well for me now with the most recent firmware you shared posted.
Sleep is working well for me now with the most recent firmware you shared posted.
Who is online
Users browsing this forum: MSN [Bot] and 0 guests