cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4 Discovery - DCMI does not call HAL_DCMI_FrameEventCallback Camera : ov9655 I am using CubeMX to generate the code

Junaid
Associate II

Hello There,

I am trying to connect OV9655 camera (WaveShare) module with STm32f4 discovery board. After generating files from CubeMX and importing ov9655 drivers (ov9655.h & ov9655.c) I am able to get HAL_DCMI_LineEventCallback and HAL_DCMI_VsyncEventCallback event but not able to get HAL_DCMI_FrameEventCallback.

I am using Snapshot mode

 BSP_CAMERA_Init(RESOLUTION_R320x240);

 HAL_Delay(1000);

HAL_DCMI_Start_DMA(&hdcmi, DCMI_MODE_SNAPSHOT, (uint32_t)CAMERA_FRAME_BUFFER, GetSize((uint8_t *)RESOLUTION_R320x240));

Please suggest where I am making mistake. Also please let me if any further info needed.

DMA Initialization

/** 

 * Enable DMA controller clock

 */

static void MX_DMA_Init(void) 

{

 /* DMA controller clock enable */

 __HAL_RCC_DMA2_CLK_ENABLE();

 /* DMA interrupt init */

 /* DMA2_Stream1_IRQn interrupt configuration */

 HAL_NVIC_SetPriority(DMA2_Stream1_IRQn, 0, 0);

 HAL_NVIC_EnableIRQ(DMA2_Stream1_IRQn);

}

/**

 * @brief DCMI Initialization Function

 * @param None

 * @retval None

 */

static void MX_DCMI_Init(void)

{

 /* USER CODE BEGIN DCMI_Init 0 */

 /* USER CODE END DCMI_Init 0 */

 /* USER CODE BEGIN DCMI_Init 1 */

 /* USER CODE END DCMI_Init 1 */

 hdcmi.Instance = DCMI;

 hdcmi.Init.SynchroMode = DCMI_SYNCHRO_HARDWARE;

 hdcmi.Init.PCKPolarity = DCMI_PCKPOLARITY_FALLING;

 hdcmi.Init.VSPolarity = DCMI_VSPOLARITY_LOW;

 hdcmi.Init.HSPolarity = DCMI_HSPOLARITY_LOW;

 hdcmi.Init.CaptureRate = DCMI_CR_ALL_FRAME;

 hdcmi.Init.ExtendedDataMode = DCMI_EXTEND_DATA_8B;

 hdcmi.Init.JPEGMode = DCMI_JPEG_DISABLE;

 if (HAL_DCMI_Init(&hdcmi) != HAL_OK)

 {

  Error_Handler();

 }

16 REPLIES 16
Junaid
Associate II

I do not have any external RAM. Would you please suggest what should be the correct Memory location ? During my experiment I also tried with 0x50050028. But with that also there was no difference. Please suggest.

CAMERA_FRAME_BUFFER must be located in some RAM (internal or external). STM32F407 has only 128KB of SRAM accessible by DMA. Only 160x120 resolution can be supported. For 320x240 need 150KB (320*240*2, RGB565 or YCrCb4:2:2).

Try set resolution to 160x120 and CAMERA_FRAME_BUFFER  to 0x20000000.

Junaid
Associate II

Thank you very much. I will change the setting accordingly and revert.

Junaid
Associate II

Hi,

Even with above changes, there are no impact. I also observed, there are no call happening to DCMI_DMAXferCplt.

Junaid
Associate II

Attaching full project

Check return code of HAL_DCMI_Start_DMA.

Put breakpoint to "void DMA2_Stream1_IRQHandler(void)" and find out what interrupt generated (error or transfer complete).

Junaid
Associate II

return code of HAL_DCMI_Start_DMA is HAL_OK but there is no call to void DMA2_Stream1_IRQHandler(void). Coding is not coming till break point at DMA2_Stream1_IRQHandler.