SD Card Troubles

I just received an OpenMV Cam 2 and my initial goal is to read/write images to the SD card.

Plugging the board into my PC (Ubuntu 14.04) with no SD card attached displays as a 49 KB volume - which I assume is the internal flash acting as the default file system. I get a cascade of LEDs and then a couple red blinks and then no LED output. I am able to use the OpenMV successfully with the IDE and without the IDE. Nice!

However, when I try to use the SD card - I run into troubles. My SD card is 28 GB and formatted as FAT32. When I insert it into the connector and then attach to my PC, the board is not recognized at all by the PC and a different LED sequence occurs: a blue/white blink infinitely.

So my questions are:
-What does this LED pattern mean?
-Are there any other steps needed to using the SD card? Do I need to write the firmware to the SD card before trying to use it?
-Is it possible to use both the internal flash and SD card simultaneously? Can I run a script out of the internal flash and just use the SD card as bulk storage?
-Could these issues be due to the size of the SD card? I’ve read that smaller is recommended.

Thanks for any help anyone can provide.


Hi, the blue led blinking is the heart beat script running. The red LED turning on is the computer accessing the flash drive.

As for the the blue and white LED flashing. That’s an error. Can you try to reformat your SD card? The system probably can’t read it. We have tested the system with 32GB SD cards without issue.

As for using the internal flash and the SD card simultaneously, with the default firmware no. Ibrahim wrote the firmware such that only the SD card appears if it is plugged in. I personally think it should work like the pyboard and allow access to both file systems but I haven’t tried to change this since there are other more pressing problems to attend to. The reason it’s like this is that the OpenMV project was started a quite a while back when MicroPython was brand new and things with MicroPython were much more in flux back then. The code the controls this just hasn’t been updated.

Anyway, reformatting the SD card or trying a different one should fix your problems.

With the pyboard, you can only access the sdcard or the internal flash via USB Mass Storage (not both at the same time).
You can access both at the same time from within MicroPython itself.

Thanks for the replies.

It was an SD formatting problem. For some reason, trying to format the SD card on Ubuntu with GParted wasn’t cutting it. Switching to Windows and formatting the card with the format tool released by worked.

So just to double check my understanding with using both SD card and internal flash…MicroPython does support this (probably via the mount/unmount commands?) but these commands have not been implemented on the OpenMV board?

This conclusion would make sense based on the fact that mount/unmount are shown here:

But not here

It looks like the openmv only has either the internal flash (as 0:/) or the sdcard (as 1:/) exposed. So it really is either or. MicroPython on the pyboard exposes them as /flash and /sd.

The os.mount() command can be used for mounting an sdcard via the SPI bus, or using a serial flash to store a filesystem. I’m not sure that there is enough functionality available to access the internal filesystem while the sdcard is mounted.

The main.c file for OpenMV which controls this mounts one of or the other file systems. It hasn’t been a priority to fix currently. So… the OpenMV Cam either exposes the SD card or the flash file system if the SD card isn’t inserted.

I personally think this should work like the pyboard. But, Ibrahim changed it to work this way to match up with what happens when you plug the OpenMV Cam into a PC. That is, the PC only sees one file system or the other. This is because the PC needs block level access to the file system making the trick to have /flash and /sd not work anymore.

What would be the best is if it were possible to show the PC a virtual file system that had both /flash and /sd. But, that will require a lot of FAT file system hacking. This might be something to look into though.

Personally, I have a strong dislike for the way the current USB Mass Storage is implemented in the pyboard. It can and will corrupt files (because the PC doesn’t really have exclusive access).

Implementing MTP would provide a filesystem that allows the PC and upy to access simultaneously, but it isn’t well supported under OSX.