cancel
Showing results for 
Search instead for 
Did you mean: 

CubeMX DCMI Problem

dave_sid
Associate II
Posted on July 04, 2015 at 19:07

4 REPLIES 4
chrif
Associate II
Posted on July 06, 2015 at 15:59

Hi Sid,

I don' think that the problem is related to CubeMx generated code. Maybe you have a suspicious behaviour in your code.

Also, make sure that you enable interruption on VSYNC_IE bit of interrupt enbale register(DCMI_IER).

Have a look at examples (capture and snapshot modes) under STM324xG_EVAL/Examples/DCMI/

Regards

dave_sid
Associate II
Posted on July 07, 2015 at 00:33

Thank you for your comments. 

I do have VSYNC interrupts enabled, and I now notice that I get 2 VSYNC interrupts as soon as the camera is enabled and starts producing VSYNC pulses. 

I'll accept that CubeMX code is not the problem, but my program is simply a series of a few  CubeMX calls to initialize and then one call to 

HAL_DCMI_Start_DMA to acquire an image. Then nothing happens. No interrupts or requests.

What my code is doing is copied from the example that you referenced.

Right now I'm stumped.

Thanks,

Sid

chrif
Associate II
Posted on July 07, 2015 at 15:56

Hi,

I think you have to chack the driver of your camera. the example of ST is based on another driver.

Regards
dave_sid
Associate II
Posted on July 08, 2015 at 03:25

Well you are right, the solution was in my driver, but I'm still not sure where the problem is. Let me explain.

Many Omnivision image sensors have a register called COM10 which, among other things, determines whether the pixel clock will be gated be HREF or not. If bit 5 of this register is set, PCLK does not run during the horizontal blanking period.

 This is a very useful option for the case where PCLK is being used as a DMA request, as with it DMA is only requested for valid pixels. This is the way my driver was set up. And with this setup, DCMI was essentially dead. 

Now why DCMI would not work if PCLK is off during vertical blanking is a mystery to me, but then a lot a about DCMI is a mystery because the documentation is so scanty. A state diagram would be nice.

As an aside, I've seen a number of forum and blog posts that say that VSYNC interrupts only occur at the end of a frame, not at the start. I see VSYNC ints for every VSYNC as long as they are turned on.

Another minor point with HAL_DCMI_DeInit. The documentation states:

  * @brief  Deinitializes the DCMI peripheral registers to their default reset

  *         values.

Well DCMI is a peripheral and I took that comment to mean the DCMI registers were set to their reset value. What really happens is that the DCMI clock is turned off, and all I/O used by DCMI is set to their reset states. 

The DCMI registers themselves are never reset and if the clock is turned back on they revert to the values they had when HAL_DCMI_DeInit was called.

Again, thanks for your comments.

Sid