cancel
Showing results for 
Search instead for 
Did you mean: 

DMA and DCMI

nakulrao
Associate II
Posted on February 21, 2013 at 15:21

Hi

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


void Capture(void)

{

/* Disable any old interrupts before enabling DMA 

WARNING: This is not specified in the reference manual,

but MUST be done before enabling stream. */

DMA_ClearITPendingBit ( DMA2_Stream1, DMA_IT_TCIF1 |

DMA_IT_HTIF1 |

DMA_IT_TEIF1 |

DMA_IT_DMEIF1 |

DMA_IT_FEIF1 );


DMA2_Stream1->M0AR = Bank1_SRAM2_ADDR;

DMA_DoubleBufferModeConfig(DMA2_Stream1, Bank1_SRAM2_ADDR + ( 0xffff * 4 ), DMA_Memory_0);


/* Enable DMA transfer */

DMA_Cmd(DMA2_Stream1, ENABLE);


/* Wait for DMA to start up */

while ( DISABLE == DMA_GetCmdStatus ( DMA2_Stream1 ) );



/* Enable DCMI interface */

DCMI_Cmd ( ENABLE ); 

DCMI_ITConfig ( DCMI_IT_FRAME, ENABLE ); 


/* Start Image capture */

DCMI_CaptureCmd ( ENABLE );


while ( 0 == DCMI_GetFlagStatus ( DCMI_FLAG_FRAMERI ) );


DCMI_CaptureCmd ( DISABLE ); 

DCMI_Cmd ( DISABLE );



DMA2_Stream1->M0AR = Bank1_SRAM2_ADDR;

DMA_DoubleBufferModeConfig(DMA2_Stream1, Bank1_SRAM2_ADDR + ( 0xffff * 4 ), DMA_Memory_0);



DMA_Cmd ( DMA2_Stream1, DISABLE );



/* Wait for DMA to stop */

while ( ENABLE == DMA_GetCmdStatus ( DMA2_Stream1 ) );


LCD_DisplayStringLine(LINE(4), ''Capture function completed '');

return;

}

The next is the IRQ for DMA.


void DMA2_Stream1_IRQHandler(void)

{

static uint8_t ucCount = 0;

LCD_DisplayStringLine(LINE(11), ''DMA Interrupt'');

DMA_ClearITPendingBit ( DMA2_Stream1, DMA_IT_TCIF1 );

ucCount++;

// The first interrupt moves the initial buffer out by 0x7fff8

if ( 1 == ucCount )

{

DMA2_Stream1->M0AR = Bank1_SRAM2_ADDR + ( 0xFFFF * 8 );

}

// The third interrupt

else if ( 3 == ucCount )

{

DMA2_Stream1->M0AR = Bank1_SRAM2_ADDR;

DMA2_Stream1->M1AR = Bank1_SRAM2_ADDR + ( 0xFFFF * 4 );

ucCount = 0;

}

}

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.
0 REPLIES 0