Showing results for 
Search instead for 
Did you mean: 

Saving images from CMOS sensor on SD card

Posted on June 07, 2015 at 22:14


I'm looking for a way to transfer 5MP images from OmniVision OV5640 camera sensor to SD card. OV5640 have 8-bit parallel interface. It also features compression engine so the output could be in JPEG format. Is the transfer possible with any of the STM32 microcontrollers? Shall I look at the models equipped with DCMI interface? Maybe if transfer would happend through DMA bus every STM32 model would be suitable to handle the transfer of JPEG images through GPIO ports?


#dma #jpeg #dcmi #cmos
Posted on June 08, 2015 at 01:21

How much do you know about the requirements and interfacing of the sensor?

The STM32 is generally going to have issues with the amount of data, based on the size of the internal SRAM, and the limits of the internal DMA controller wrt transfer length.

Some how I expect the sensor to provide data at a rate that exceeds your ability to write it to the SD Card.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on June 08, 2015 at 17:26

I have the full datasheet of the sensor. It's not too descriptive about JPEG compression though. The only pixel clock data is provided for the RAW output.

I've seen a project in which PIC32 was handling OV5640 sensor. It was able to transfer JPEG pictures in full resolution of 2592x1944 to microSD card. Whats even more impressive it could save 1080p video in 30 fps! Of course there wasn't any additional compression added, just the sequence of JPEG images transferred directly from a sensor.

Based on this project I suppose that built into OV5640 JPEG compression engine is effective enough to provide data at a rate suitable for class 10 microSD card. With 8 bit interface pixel clock would be 10 MHz at most.

What I'am trying to figure out right now is whether or not the full frame have to fit in SRAM memory. Each frame would be transferred by portions limited by 16 bit DMA counter. First DMA channel would transfer 65536 bytes of an image to the memory. After that second DMA channel would transfer part of an image from memory to microSD card. At the same time first DMA channel would be transferring next part of an image to a memory. All in the loop, until whole frame is done. Is that doable?

Posted on May 08, 2017 at 14:49


I have the STM32F479I-Eval Board and OV5640 Camera Module running with a modify code of STM32469I_EVAL\Applications\Camera\Camera_To_USBDisk. I can save pictures in JPG format at 640x480,1280x720,1280x960,1920x1080, but when i try save pictures in 2592x1944 it doesn't work.

I read [RM0386(16.6.1)] -> maximum input size is 2048 × 2048.

Could this be the cause?

Any idea how to fix it?

Someone has this camera working in JPG format at 5 Megapixels?

Best Regards,


Posted on May 08, 2017 at 17:19

>> it doesn't work

Perhaps quantify that a little better? Doesn't work how, does any data get written at all? Does the pattern of the data suggest what the failure mode or limitations might be?

I'm streaming quite significant volumes of data to MicroSD cards, so I don't see them as a constraining factor here.

Assume there are not an overwhelming number of people here with specific and salient experience here. For commercial applications seek support from your distributor and FAE.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..