2020-02-12 11:09 PM
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();
}
2020-02-13 04:43 AM
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.
2020-02-13 04:54 AM
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.
2020-02-13 04:59 AM
Thank you very much. I will change the setting accordingly and revert.
2020-02-13 06:47 AM
Hi,
Even with above changes, there are no impact. I also observed, there are no call happening to DCMI_DMAXferCplt.
2020-02-13 06:56 AM
2020-02-14 12:28 AM
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).
2020-02-14 04:16 AM
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.