OpenMV Cam H7 Files Disappeared (Auto Reset to Factory Settings?)

Hello,

I would like to ask if there is any mechanism that could cause the internal files on OpenMV to be automatically erased.

Environment:

  • Devices: OpenMV Cam H7 Plus (4.5.8 firmware), OpenMV Cam H7 R2(4.7.0 firmware)

  • IDE: OpenMV IDE 4.7.0

Issue description:
While I was in the middle of development, I connected the OpenMV to my computer and opened main.py. To my surprise, its contents had been replaced with the default startup code:

# main.py -- put your code here!
import pyb, time
led = pyb.LED(3)
usb = pyb.USB_VCP()
while(usb.isconnected()==False):
    led.on()
    time.sleep_ms(150)
    led.off()
    time.sleep_ms(100)
    led.on()
    time.sleep_ms(150)
    led.off()
    time.sleep_ms(600)

This happened once on my H7 Plus and once on my H7 R2. In both cases, all my previous files were gone as if the device had been reset.

I also encountered some anomalies, but I am not sure if they are related. For example, when main.py grew too large (43KB), I received this error:

Unable to write file E:\main.py.autosave: Not enough disk space

Question:

Could this error or other conditions cause OpenMV to erase or overwrite its internal files automatically?

Thanks in advance.

Hi, the onboard flash on the H7 is extremely small. You can get the not enough disk space error if other applications are saving temp files to it when you are editing the script onboard. I do not recommend opening and editing the script directly on device. You should do so from your desktop and then save the script to the camera. The IDE has a feature to do this and it can also strip out all comments and spaces to minimize the script size.

As for why your script was deleted, all OpenMV Cams format their FATFS if they can’t mount it on startup and write a new main.py to blink the LED. This means the FAT drive was corrupted. This typically happens if you are trying to save files to it.

We highly recommend if you are doing any log file writing to use an SD card. The internal FATFS is really only safe to use as a readonly file system with the MCU in non-development use cases. Our more serious customers typically go a step further and bake their main.py into the firmware to ensure it can never be erased.