Showing results for 
Search instead for 
Did you mean: 

OV5640 JPEG Compression Issue When Storing Images on SD Card with STM32

Associate II

Hello Community,

I'm working with an OV5640 camera module interfaced to an STM32 microcontroller, capturing JPEG images to store on an SD card. I'm facing a peculiar issue where JPEG images with (quality settings lower than 0x0C in the OV5640's JPEG CTRL07 register) cannot be opened after storage; they appear corrupted or unsupported.

The datasheet for OV5640 indicates that we should be able to set the quality control register (JPEG CTRL07) to values as low as 0x02 to increase compression. However, when I use values between 0x02 and 0x0B, the stored images cannot be opened, suggesting file corruption. It's noteworthy that images are stored and accessed without any issues at less compressed settings (0x0C or higher).

I suspect this might be related to the file handling system on the SD card, or buffered during writing.

How might one tackle this discrepancy between the datasheet specifications and practical outcomes? Insights into buffer management, SD card file system intricacies, or firmware adjustments that might help handle high compression JPEG files would be highly valuable.

Thank you in advance for your insights and assistance!


Perhaps use other tools to check and determine the integrity of the images. For this sort of work you should be able to build your own tools to walk the file and data structures. You should be able to demonstrate integrity of your data paths from the camera to the file, and what's in the file when it gets to the PC.

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

I tried opening the file with different image viewer software but it says same, file format is not supported.