cancel
Showing results for 
Search instead for 
Did you mean: 

STM324xG_EVAL Camera_to_USBDisk example - changing the resolution?

Steve H
Associate III
Posted on April 14, 2014 at 23:08

I've been working with the STM3240G_EVAL board's onboard camera and the Camera_To_USBDisk sample application. This application normally displays and records images at 320x200 (the resolution of the onboard LCD); I wanted to grab and record images at VGA (640x480) resolution without bothering to display on the LCD. This is within the camera module's specs and the size of the external SRAM on the eval board, so it should be possible. Moreover, the library driver ov2640.c has config settings for VGA resolution, so someone has done at least some work on that.

Naturally, the task required significantly refactoring of the code in main.c to optimize memory usage (in this case, at the expense of processing time, which is fine for me). I've successfully operated the modified program at 320x200, and have generated and verified fixed-pattern test images at 320x200 and 640x400, proving out the correctness of the data pipeline *after* the camera. (The BMP headers were a particular adventure...)

My code is attached for your amusement.

However, when I try to capture images at 640x480, the result is random snow rather than an image or image fragments. Having extensively tested the rest of my code, I suspect that the initialization of the camera and DCMI for 640x480 may be faulty.

Has anyone succeeded in operating this or a similar camera at 640x480 resolution on an eval module?

Thanks,

Steve Hersey

#camera-stm3240g_eval-dcmi
3 REPLIES 3
Steve H
Associate III
Posted on April 15, 2014 at 15:54

Further digging tells me that the camera driver is raggedly incomplete. There are definitions in ov2640.c for 640x480 resolution, but the function ''GetSize()'' in stm324xg_eval_camera.c that sets the DMA transfer size per resolution at camera startup is only implemented for 160x120 and 320x240 resolutions. This is turning into an adventure and an education all in one! 😉

Posted on April 15, 2014 at 16:00

The maximum capability for the STM32 DMA at 16-bit is just shy of 128KB, for 32-bit shy of 256KB. You'd basically have to manage multiple buffers, or do it in a circular fashion.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Steve H
Associate III
Posted on April 17, 2014 at 19:39

Indeed it does. Fortunately, the stm32f4xx_hal_dcmi.c module handles this transparently by setting up multibuffer DMA if the camera frame size exceeds 0xffff items.

Unfortunately, I'm still unable to avoid image tearing at 640x480 when I suspend and resume the camera around image display and export. (320x200 is fine, indicating that multibuffer DMA is involved here.) The BSP_CAMERA_Suspend() and BSP_CAMERA_Resume() functions in stm324xg_eval_camera.c don't handle this case well, so I'll need to dig into it deeper.

Thanks for the tip.