AnsweredAssumed Answered

DMA and DCMI

Question asked by rao.nakul on Feb 21, 2013
Hi


I am using the stm3240G eval board. The DMA works fine for an image resolution of 300x200. But when I increase the resolution I do not get any image. I am using DMA in circular buffer mode and have tweaked the codes I have got from this forum. There are two function I have doubts on.

01.void Capture(void)
02.{
03.    /* Disable any old interrupts before enabling DMA
04.       WARNING: This is not specified in the reference manual,
05.                but MUST be done before enabling stream.       */
06.    DMA_ClearITPendingBit ( DMA2_Stream1, DMA_IT_TCIF1  |
07.                                             DMA_IT_HTIF1  |
08.                                             DMA_IT_TEIF1  |
09.                                             DMA_IT_DMEIF1 |
10.                                             DMA_IT_FEIF1  );
11.  
12.    DMA2_Stream1->M0AR = Bank1_SRAM2_ADDR;
13.    DMA_DoubleBufferModeConfig(DMA2_Stream1, Bank1_SRAM2_ADDR + ( 0xffff * 4 ), DMA_Memory_0);
14.  
15.    /* Enable DMA transfer */
16.    DMA_Cmd(DMA2_Stream1, ENABLE);
17.    
18.    /* Wait for DMA to start up */
19.    while ( DISABLE == DMA_GetCmdStatus ( DMA2_Stream1 ) );
20. 
21. 
22.    /* Enable DCMI interface */
23.    DCMI_Cmd ( ENABLE );   
24.    DCMI_ITConfig ( DCMI_IT_FRAME, ENABLE ); 
25.    
26.    /* Start Image capture */
27.    DCMI_CaptureCmd ( ENABLE );
28.    
29.    while ( 0 == DCMI_GetFlagStatus ( DCMI_FLAG_FRAMERI ) );
30.    
31.    DCMI_CaptureCmd ( DISABLE );  
32.    DCMI_Cmd ( DISABLE );
33. 
34. 
35.    DMA2_Stream1->M0AR = Bank1_SRAM2_ADDR;
36.    DMA_DoubleBufferModeConfig(DMA2_Stream1, Bank1_SRAM2_ADDR + ( 0xffff * 4 ), DMA_Memory_0);
37. 
38. 
39.    DMA_Cmd ( DMA2_Stream1, DISABLE );
40. 
41. 
42.    /* Wait for DMA to stop */
43.    while ( ENABLE == DMA_GetCmdStatus ( DMA2_Stream1 ) );
44.     
45.        LCD_DisplayStringLine(LINE(4), "Capture function completed  ");
46.    return;
47.}


The next is the IRQ for DMA.


01.void DMA2_Stream1_IRQHandler(void)
02.{
03.    static uint8_t ucCount = 0;
04.    LCD_DisplayStringLine(LINE(11), "DMA Interrupt");
05.      DMA_ClearITPendingBit ( DMA2_Stream1, DMA_IT_TCIF1 );
06.    ucCount++;
07.    // The first interrupt moves the initial buffer out by 0x7fff8
08.    if ( 1 == ucCount )
09.    {
10.        DMA2_Stream1->M0AR = Bank1_SRAM2_ADDR + ( 0xFFFF * 8 );
11.    }
12.    // The third interrupt
13.   else if ( 3 == ucCount )
14.   {
15.       DMA2_Stream1->M0AR = Bank1_SRAM2_ADDR;
16.       DMA2_Stream1->M1AR = Bank1_SRAM2_ADDR + ( 0xFFFF * 4 );
17.       ucCount = 0;
18.   }
19.}


The above functions work alright for a image resolution of 300x200 but fails for higher 
resolutions. One important thing is that the DMA interrupt is never called. I can understand
this for 200x300 image but for higher resolution I was expexting the interrupt to occur. But 
it never happened. By higher resolution I mean 1000x1000.


I would be really obliged if someone could take a look and point out to me where I am going
wrong.
Thanks in advance. 

Outcomes