cancel
Showing results for 
Search instead for 
Did you mean: 

DMA Issue for STM32F427 and OV5642

pohua
Associate II
Posted on November 16, 2016 at 06:27

Hello!Sir:

I have a project which is the MCU(STM32F427) to drive the camera module(OV5642) and referenced the arduino web site (https://github.com/ArduCAM/Arduino/tree/master/ArduCAM) to setup the register value for the VGA_preview_setting, Video_setting...etc.

My firmware has a error which is the ''DCMI_DR_ADDRESS'' undefined after compiling.

#define QVGA_resolution 320*240

uint32_t frame_buffer[QVGA_resolution];

void OV5642_Config_DCMI_DMA(ImageFormat_TypeDef ImageFormat)

{

  DCMI_InitTypeDef DCMI_InitStructure;

  DMA_InitTypeDef  DMA_InitStructure;

/*** Configures the DCMI to interface with the OV5642 camera module ***/

  /* Enable DCMI clock */

  RCC_AHB2PeriphClockCmd(RCC_AHB2Periph_DCMI, ENABLE);

  /* DCMI configuration */ 

  DCMI_InitStructure.DCMI_CaptureMode = DCMI_CaptureMode_Continuous;

  DCMI_InitStructure.DCMI_SynchroMode = DCMI_SynchroMode_Hardware;

  DCMI_InitStructure.DCMI_PCKPolarity = DCMI_PCKPolarity_Rising;

  DCMI_InitStructure.DCMI_VSPolarity = DCMI_VSPolarity_Low;

  DCMI_InitStructure.DCMI_HSPolarity = DCMI_HSPolarity_Low;

  DCMI_InitStructure.DCMI_CaptureRate = DCMI_CaptureRate_All_Frame;

  DCMI_InitStructure.DCMI_ExtendedDataMode = DCMI_ExtendedDataMode_10b;//data =8b/10b?

/* Configures the DMA2 to transfer Data from DCMI */

  /* Enable DMA2 clock */

  RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_DMA2, ENABLE);

  

  /* DMA2 Stream1 Configuration */  

  DMA_DeInit(DMA2_Stream1);

  DMA_InitStructure.DMA_Channel = DMA_Channel_1;  

  DMA_InitStructure.DMA_PeripheralBaseAddr = DCMI_DR_ADDRESS;

  DMA_InitStructure.DMA_Memory0BaseAddr = (uint32_t) frame_buffer;

  DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralToMemory;

  DMA_InitStructure.DMA_BufferSize = 1;

//DMA_InitStructure.DMA_BufferSize = 320;

  DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;

  DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Disable;

  DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Word;

  DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_HalfWord;

  DMA_InitStructure.DMA_Mode = DMA_Mode_Circular;

  DMA_InitStructure.DMA_Priority = DMA_Priority_High;

  DMA_InitStructure.DMA_FIFOMode = DMA_FIFOMode_Enable;

  DMA_InitStructure.DMA_FIFOThreshold = DMA_FIFOThreshold_Full;

  DMA_InitStructure.DMA_MemoryBurst = DMA_MemoryBurst_Single;

  DMA_InitStructure.DMA_PeripheralBurst = DMA_PeripheralBurst_Single;

}

1.How to solve the error message?

2.Does the parallel data is 8 bits or 10bits for OV5642?

3.Who can support the OV5642 sample code for me referenced?

4.DMA_BufferSize=pixel /4 ?

5.DMA_Memory0BaseAddr= frame_buffer array address?
2 REPLIES 2
Posted on November 16, 2016 at 16:39

Do you define DCMI_DR_ADDRESS anywhere in your code, or where you took it from?

Would &DCMI->DR suffice to get the address?

The size of the DMA buffer is in Transfer units, and you'd likely want the memory address to increment to fill the buffer. You'd probably want to decide on Word or Half-Word.

Not sure there are a wealth of people here supporting ArduCAM or DCMI, you might want to thoroughly review the manual, and the examples within the SPL.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
pohua
Associate II
Posted on November 17, 2016 at 03:21

Hi!Clive1:

I have fixed this error message yesterday as the blow shown that the item 1 and 2

1.#define DCMI_DR_ADDRESS       0x50050028

  DMA_InitStructure.DMA_PeripheralBaseAddr = DCMI_DR_Address;

2.DMA_InitStructure.DMA_PeripheralBaseAddr =(uint32_t)(DCMI_BASE + 0x28); 

But I have the below questions are that I don't understand.

2.Does the parallel data is 8 bits or 10bits for OV5642?

3.Who can support the OV5642 sample code for me referenced?

4.DMA_BufferSize=pixel /4 ?

5.DMA_Memory0BaseAddr= frame_buffer array address?