Running main.py from SD card on OpenMV Cam H7 Plus?

Hi, I’m trying to run main.py from an external SD card on a LiPo powered OpenMV Cam H7 Plus.

From the docs and forum posts it seems that if an SD card is present, containing a file named main.py, the bootloader should run it, however that does not seem to work on my cam.

Here’s what I tried, on MacOS Monterey:

  1. Updated OpenMV IDE today and flashed newest firmware when the IDE prompted me.
  2. Erased the internal flash with OpenMV IDE > Tools > Erase Onboard Data Flash.
  3. Manually deleted the content of the NO NAME drive that shows up when the cam is connected.
  4. Formatted the external SD card with ExFAT (also MS DOS FAT before), named it OPENMV.
  5. Saved your blink example in a file called main.py to the SD card.
  6. Ejected the OPENMV SD card from MacOS.
  7. Inserted the OPENMV SD card to OpenMV cam.
  8. Powered the OpenMV cam (first with USB and later with just a fully charged LiPo battery).
  9. No blinking (!) which probably means the code does not run.

(If I “Save open Script to OpenMV Cam” the exact same code runs as expected, but from flash.)

Did the default bootloader change, or do I miss a file (e.g. boot.py, and if yes, how should it look)?

Kind regards,
Thomas

Hi, after saving the file did you safety remove the hard drive?

Generally, the issue would be because the script either has an error or it was not written.

This should not be complex.

The script should be called main.py.

Thanks for the quick reply.

Yes, the file is called main.py and I did eject the SD card via MacOS.

The content of the script is the same as

OpenMV IDE > File > Examples > OpenMV > Basics > main.py

Might want to try reformatting the SD with exFAT, or trying a different card.

Tried ExFAT and MS-DOS FAT.

Also tried to read the (same) card on a Linux machine, works fine.

Will try to find another card.

Some cards just don’t work with ST SDIO core and/or drivers. I know for sure that Samsung EVO works very well with the cam, but you could try any other card. main.py should run from any available storage (flash or sd).

1 Like

You were right, using a different SD card seems to solve the issue. Thanks a lot.

OK, after further investigation I guess it was my sloppy formatting that caused the issue. MacOS Diskutil shows two entries for a single SD card. Seems to be important to select the “Generic STORAGE DEVICE Media” one (not its child entry) and select “Master Boot Record” in addition to “ExFAT”. Anyway, now both (Kingston 16 GB) cards work fine with the cam.