2025-04-14 5:23 AM - last edited on 2025-04-14 6:19 AM by mƎALLEm
Hi, there;
I am migrating the DCMI from stm32h743 to stm32u575, on the stm32h743 chip, I can make the dcmi work perfectly, but on the stm32u575 chip, I cannot make the DCMI work, neither the GPDMA for DCMI. Anyone met the same issues?
The codes are generated from stm32cubemx 6.12, stm32u575 packege 1.5
I use the HAL_DCMI_Start_DMA(&hdcmi,DCMI_MODE_CONTINUOUS,dest,len); to start the dcmi
here I tried:
1: enabled the DCMI line/vsync interrupt, the software can get the valid signals
2: I checked the HSYNC/VSYNC/PIXSELCLK, all are available
3:I checked the hardware connection, make sure there is no issue
4: referred the example DCMI_ContinousCAp_embeddedSynch, I cannot find the differernce with the excelption the the linked dma
void MX_GPDMA1_Init(void)
{
/* USER CODE BEGIN GPDMA1_Init 0 */
/* USER CODE END GPDMA1_Init 0 */
/* Peripheral clock enable */
__HAL_RCC_GPDMA1_CLK_ENABLE();
/* GPDMA1 interrupt Init */
HAL_NVIC_SetPriority(GPDMA1_Channel0_IRQn, 1, 0);
HAL_NVIC_EnableIRQ(GPDMA1_Channel0_IRQn);
HAL_NVIC_SetPriority(GPDMA1_Channel11_IRQn, 2, 0);
HAL_NVIC_EnableIRQ(GPDMA1_Channel11_IRQn);
/* USER CODE BEGIN GPDMA1_Init 1 */
/* USER CODE END GPDMA1_Init 1 */
/* USER CODE BEGIN GPDMA1_Init 2 */
/* USER CODE END GPDMA1_Init 2 */
}
/* DCMI init function */
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_10B;
hdcmi.Init.JPEGMode = DCMI_JPEG_DISABLE;
hdcmi.Init.ByteSelectMode = DCMI_BSM_ALL;
hdcmi.Init.ByteSelectStart = DCMI_OEBS_ODD;
hdcmi.Init.LineSelectMode = DCMI_LSM_ALL;
hdcmi.Init.LineSelectStart = DCMI_OELS_ODD;
if (HAL_DCMI_Init(&hdcmi) != HAL_OK)
{
Error_Handler();
}
/* USER CODE BEGIN DCMI_Init 2 */
__HAL_DCMI_DISABLE_IT(&hdcmi, DCMI_IT_LINE | DCMI_IT_VSYNC | DCMI_IT_ERR | DCMI_IT_OVR);
/* USER CODE END DCMI_Init 2 */
}
void HAL_DCMI_MspInit(DCMI_HandleTypeDef* dcmiHandle)
{
GPIO_InitTypeDef GPIO_InitStruct = {0};
if(dcmiHandle->Instance==DCMI)
{
/* USER CODE BEGIN DCMI_MspInit 0 */
/* USER CODE END DCMI_MspInit 0 */
/* DCMI clock enable */
__HAL_RCC_DCMI_PSSI_CLK_ENABLE();
__HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_GPIOC_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
/**DCMI GPIO Configuration
PA4 ------> DCMI_HSYNC
PA6 ------> DCMI_PIXCLK
PC6 ------> DCMI_D0
PC7 ------> DCMI_D1
PC8 ------> DCMI_D2
PC9 ------> DCMI_D3
PC10 ------> DCMI_D8
PC11 ------> DCMI_D4
PC12 ------> DCMI_D9
PB6 ------> DCMI_D5
PB7 ------> DCMI_VSYNC
PB8 ------> DCMI_D6
PB9 ------> DCMI_D7
*/
GPIO_InitStruct.Pin = GPIO_PIN_4;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF10_DCMI;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
GPIO_InitStruct.Pin = GPIO_PIN_6;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF4_DCMI;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
GPIO_InitStruct.Pin = GPIO_PIN_6|GPIO_PIN_7|GPIO_PIN_8|GPIO_PIN_10
|GPIO_PIN_11|GPIO_PIN_12;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF10_DCMI;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
GPIO_InitStruct.Pin = GPIO_PIN_9;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF4_DCMI;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
GPIO_InitStruct.Pin = GPIO_PIN_6|GPIO_PIN_7|GPIO_PIN_8|GPIO_PIN_9;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF10_DCMI;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
/* DCMI DMA Init */
/* GPDMA1_REQUEST_DCMI_PSSI Init */
handle_GPDMA1_Channel0.Instance = GPDMA1_Channel0;
handle_GPDMA1_Channel0.Init.Request = GPDMA1_REQUEST_DCMI_PSSI;
handle_GPDMA1_Channel0.Init.BlkHWRequest = DMA_BREQ_SINGLE_BURST;
handle_GPDMA1_Channel0.Init.Direction = DMA_PERIPH_TO_MEMORY;
handle_GPDMA1_Channel0.Init.SrcInc = DMA_SINC_FIXED;
handle_GPDMA1_Channel0.Init.DestInc = DMA_DINC_INCREMENTED;
handle_GPDMA1_Channel0.Init.SrcDataWidth = DMA_SRC_DATAWIDTH_HALFWORD;
handle_GPDMA1_Channel0.Init.DestDataWidth = DMA_DEST_DATAWIDTH_HALFWORD;
handle_GPDMA1_Channel0.Init.Priority = DMA_LOW_PRIORITY_HIGH_WEIGHT;
handle_GPDMA1_Channel0.Init.SrcBurstLength = 1;
handle_GPDMA1_Channel0.Init.DestBurstLength = 1;
handle_GPDMA1_Channel0.Init.TransferAllocatedPort = DMA_SRC_ALLOCATED_PORT0|DMA_DEST_ALLOCATED_PORT1;
handle_GPDMA1_Channel0.Init.TransferEventMode = DMA_TCEM_BLOCK_TRANSFER;
handle_GPDMA1_Channel0.Init.Mode = DMA_NORMAL;
if (HAL_DMA_Init(&handle_GPDMA1_Channel0) != HAL_OK)
{
Error_Handler();
}
__HAL_LINKDMA(dcmiHandle, DMA_Handle, handle_GPDMA1_Channel0);
if (HAL_DMA_ConfigChannelAttributes(&handle_GPDMA1_Channel0, DMA_CHANNEL_NPRIV) != HAL_OK)
{
Error_Handler();
}
/* DCMI interrupt Init */
HAL_NVIC_SetPriority(DCMI_PSSI_IRQn, 2, 0);
HAL_NVIC_EnableIRQ(DCMI_PSSI_IRQn);
/* USER CODE BEGIN DCMI_MspInit 1 */
HAL_NVIC_SetPriority(GPDMA1_Channel0_IRQn, 1, 0);
HAL_NVIC_EnableIRQ(GPDMA1_Channel0_IRQn);
/* USER CODE END DCMI_MspInit 1 */
}
}
2025-04-14 6:20 AM - edited 2025-04-14 6:21 AM
Hello,
In next time please kindly use </> button to paste your code. see this post. I've edited your post then ..
Thank you for your understanding.
2025-04-14 7:18 AM - edited 2025-04-14 7:19 AM
Hello @CCao.1;
I cannot make the DCMI work, neither the GPDMA for DCMI.
Could you give more details about the issue. Did you get a hard fault?
What are the status of the DCMI and GPDMA registers?
Could you please use the latest STM32CubeMX 6.14.1 version.
Thank you.
Kaouthar
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2025-04-15 6:11 AM
Hello, @KDJEM.1
I did try to update to the stcubemx 6.14, but had lots of issues in my codes, so I have to roll back to 6.12 (6.11 had the bugs on stm32u575 configurations)
Actually, it seems that the DCMI does not capture the data so there is no DCMI DMA request. I used the DMA on QSPI interface, it runs perfectly.
Here is the screenshot of the DCMI and DMA registers
Any idea?
thank you
Chengtao
2025-04-15 7:15 AM
Hello @CCao.1;
I noted that the DCMI is not started. The DCMI enable bit is not set in the screenshot of the DCMI. Could you please check the DMA init order is set correctly:
MX_GPIO_Init();
MX_GPDMA1_Init();
MX_ICACHE_Init();
MX_DCMI_Init();
Thank you.
Kaouthar
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.