cancel
Showing results for 
Search instead for 
Did you mean: 

configuration of DMA for DCMI

matthiaspfister9
Associate II
Posted on June 22, 2012 at 13:14

Hello,

I am trying to transfer image data from the DCMI data register via DMA to RAM memory. For this purpose I configure DMA2 as follows:

RCC_AHB2PeriphClockCmd(RCC_AHB1Periph_DMA2, ENABLE);

DMA_InitTypeDef   DMA_InitStruct;

 

DMA_DeInit(DMA2_Stream1);

 

DMA_StructInit(&DMA_InitStruct);

 

DMA_InitStruct.DMA_Channel            = DMA_Channel_1;

DMA_InitStruct.DMA_PeripheralBaseAddr = (uint32_t)(DCMI_BASE + 0x28);

DMA_InitStruct.DMA_Memory0BaseAddr    = (uint32_t)(&(Raw_Image_Data.Data[0]));

DMA_InitStruct.DMA_DIR                = DMA_DIR_PeripheralToMemory;

DMA_InitStruct.DMA_BufferSize         = 0xFFFF;

DMA_InitStruct.DMA_PeripheralInc      = DMA_PeripheralInc_Disable;

DMA_InitStruct.DMA_MemoryInc          = DMA_MemoryInc_Enable;

DMA_InitStruct.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Word; // word = 32 bit

DMA_InitStruct.DMA_MemoryDataSize     = DMA_MemoryDataSize_Word;     // word = 32 bit

DMA_InitStruct.DMA_Mode               = DMA_Mode_Normal;             // not circular

DMA_InitStruct.DMA_Priority           = DMA_Priority_Medium;

DMA_InitStruct.DMA_FIFOMode           = DMA_FIFOMode_Disable;        // direct mode

DMA_InitStruct.DMA_FIFOThreshold      = DMA_FIFOThreshold_Full;

DMA_InitStruct.DMA_MemoryBurst        = DMA_MemoryBurst_INC4;

DMA_InitStruct.DMA_PeripheralBurst    = DMA_PeripheralBurst_INC4;

   

DMA_Init(DMA2_Stream1, &DMA_InitStruct);

 

DMA_Cmd(DMA2_Stream1, ENABLE);

When I execute that code, the values in the register DMA2_S1CR do not change. Why?

Do I have to tell the DCMI somehow that it should connect with the DMA, e.g. using a similar command to SPI_I2S_DMACmd() ?

Please can anybody tell me what I am missing here?

#dma #dcmi
2 REPLIES 2
matthiaspfister9
Associate II
Posted on June 22, 2012 at 13:51

Some additional information:

 - I am using IAR Embedded Workbench for ARM 6.30.7.3447

 - No interrupts are enabled (I think it's not necessary)

When I step into the function DMA_Init(), I can see that the following command is executed:

DMAy_Streamx->CR = tmpreg;

The pointer DMAy_Streamx->CR references to 0x4002 6428 (which is correct in my opinion) and the variable tmpreg is not zero. Once this command is executed, the memory at 0x4002 6428 is however still at zero. What's wrong here?

matthiaspfister9
Associate II
Posted on June 25, 2012 at 11:35

I have found the error:

I should be

RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_DMA2, ENABLE);

instead of

RCC_AHB2PeriphClockCmd(RCC_AHB1Periph_DMA2, ENABLE);