Skip to main content
CCao.1
Associate II
April 14, 2025
Question

DCMI/GPDMA on stm32u575

  • April 14, 2025
  • 8 replies
  • 664 views

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 */
 }
}
This topic has been closed for replies.

8 replies

mƎALLEm
ST Technical Moderator
April 14, 2025

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.

To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.
KDJEM.1
ST Technical Moderator
April 14, 2025

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 "Best answer" on the reply which solved your issue or answered your question.
CCao.1
CCao.1Author
Associate II
April 15, 2025

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

CCao1_0-1744722423942.png

CCao1_1-1744722432362.png

 

KDJEM.1
ST Technical Moderator
April 15, 2025

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 "Best answer" on the reply which solved your issue or answered your question.
CCao.1
CCao.1Author
Associate II
April 16, 2025

The CR of DCMI is 0x4401, the DCMI is enabled and capture is enabled

the initialization sequence is ok. My initializtion is GPIO->GPDMA->DCMI->ICache, I also tried the sequence as you suggested, it's behavior is same.

 

Chengtao

KDJEM.1
ST Technical Moderator
April 16, 2025

Hello @CCao.1 ;

 

Could you please share the camera sensor datasheet?

 

Thank you.

Kaouthar

To give better visibility on the answered topics, please click on "Best answer" on the reply which solved your issue or answered your question.
Associate III
April 16, 2025

I am noticing that your GPDMA1_Channel0 is initialized inside the DCMI Init instead of GPDMA1 Init function.   Also, DCMI_DR is 32-bit read register, so the SrcDataWidth and DestDataWidth should be WORD, not HALFWORD.

CCao.1
CCao.1Author
Associate II
April 16, 2025

The DR is not related with the GPDMA, the DR will be pushed into 2-word FIFO which will generate the DCMI DMA request.  The DMA supports different trsnfer width

 

thank you

 

Chengtao