STM32U5 DCMI DMA is not working as expected.
Hello,
We have developed an image capturing application successfully based on STM32H7xxxx and OV7725 camera. We are now targeting to port the application to target STM32U5xxxx with the same camera. But it looks the DMA doesn't works as expected. The DCMI DMA complete callback is firing with no image data in the target buffer.
Please guide us how to port the application from H7 to U5.
Best regards-
Shubhendu Bikash Banerjee
Attaching here snaps of the configurations we made so far.
DCMI GPIO
DCMI NVIC
DCMI parameters
GPDMA1 channels
GPDMA1 CH0
GPDMA1 security
Code snippet:
#define IMAGE_FRAME_WIDTH 320
#define IMAGE_FRAME_HEIGHT 240
#define IMAGE_BYTES_PER_PIXEL 2
#define IMAGE_BYTES_COUNT (IMAGE_FRAME_HEIGHT * IMAGE_FRAME_WIDTH * IMAGE_BYTES_PER_PIXEL)
static uint32_t gDCMIBuff[IMAGE_BYTES_COUNT / sizeof(uint32_t)] = { 0 };
static volatile bool gWaitForFrame = false;
CaptureFrame{
gWaitForFrame = true;
halReturn = HAL_DCMI_Start_DMA(&hdcmi, (uint32_t) DCMI_MODE_SNAPSHOT,
(uint32_t) gDCMIBuff, (uint32_t) imageSize);
if (HAL_OK != halReturn) {
SERVICE_LOGE(TAG, "DCMI start error: 0x%.8X", HAL_DCMI_GetError(&hdcmi));
exeStatus = ERROR_GEN_FAILURE;
goto label_exitPoint;
}
#if LOG_LEVEL >=LOG_LEVEL_DEBUG
SERVICE_LOGD(TAG, "Frame capture started.");
#endif
while (gWaitForFrame) {
__asm__("nop");
}
HAL_DCMI_Stop(&hdcmi);
SetCameraToSleep(pvCameraSensor);
}
void HAL_DCMI_FrameEventCallback(DCMI_HandleTypeDef *hdcmi) {
HAL_DCMI_Stop(hdcmi);
gWaitForFrame = false;
}
This is for reference:
