2024-04-18 03:54 AM
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!
2024-04-18 05:08 AM
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.
2024-04-18 05:40 AM
I tried opening the file with different image viewer software but it says same, file format is not supported.
2024-07-17 02:39 AM
Hello @Majeed ,
Please verify the JPEG Data integrity , ensure the data written to the SD card is not getting corrupted during the transfer process , also verify the buffer used to store the JPEG data is large enough to handle the compressed data. High compression settings can sometimes produce larger-than-expected data chunks and If you are using DMA for data transfer, make sure it is configured correctly to handle the data size and transfer speed.
you can check this 2 examples for STM32H7 that use OV5640 camera Bsp component , it can help you :
Capture mode example : https://github.com/STMicroelectronics/STM32CubeH7/tree/master/Projects/STM32H747I-DISCO/Examples/DCMI/DCMI_CaptureMode
SnapShot mode example : https://github.com/STMicroelectronics/STM32CubeH7/tree/master/Projects/STM32H747I-DISCO/Examples/DCMI/DCMI_SnapshotMode
Thank you
Br