cancel
Showing results for 
Search instead for 
Did you mean: 

STM32U585 DCMI Overrun, even if i am 2x away from maximum clock frequency

Linas L
Senior II

Hello,

In my project I need to connect BW 10b camera to STM32U585.

STM32U585 is running at 160MHz, and my MCO for camera is 10-30MHz. At this point I am not even using DMA, just checking DCMI interrupts

And what do you know, first, I get OVR interrupt, and when I get HSCYNC, VSYN IRQ and they do match what camera is trying to output.

void DCMI_Config(void)
{
  DCMI->IER =DCMI_IER_OVR_IE|DCMI_IER_VSYNC_IE;
  DCMI->CR  =DCMI_CR_ENABLE | DCMI_CR_HSPOL |DCMI_CR_PCKPOL| DCMI_CR_VSPOL |    DCMI_CR_DR_SIZE_10b;
 
  NVIC_SetPriority(DCMI_PSSI_IRQn, 1);
  NVIC_EnableIRQ(DCMI_PSSI_IRQn);
 
  DCMI->CR |=DCMI_CR_CAPTURE;
}
void DCMI_Interface_Init(void)
{
  LL_AHB2_GRP1_EnableClock(LL_AHB2_GRP1_PERIPH_GPIOA);
  LL_AHB2_GRP1_EnableClock(LL_AHB2_GRP1_PERIPH_GPIOB);
  LL_AHB2_GRP1_EnableClock(LL_AHB2_GRP1_PERIPH_GPIOC);
  LL_AHB2_GRP1_EnableClock(LL_AHB2_GRP1_PERIPH_GPIOD);
  LL_AHB2_GRP1_EnableClock(LL_AHB2_GRP1_PERIPH_GPIOE);
  LL_AHB2_GRP1_EnableClock(LL_AHB2_GRP1_PERIPH_DCMI_PSSI);
/*
  PB6     ------> DCMI_D5
  PE4     ------> DCMI_D4
  PC12     ------> DCMI_D9
  PC10     ------> DCMI_D8
  PE6     ------> DCMI_D7
  PB8     ------> DCMI_D6
  PB7     ------> DCMI_VSYNC
  PA9     ------> DCMI_D0
  PA10     ------> DCMI_D1
  PC9     ------> DCMI_D3
  PC8     ------> DCMI_D2
  PD9     ------> DCMI_PIXCLK
  PA4     ------> DCMI_HSYNC
  */
  LL_GPIO_InitTypeDef GPIO_InitStruct = {0};
 
  GPIO_InitStruct.Pin = LL_GPIO_PIN_9|LL_GPIO_PIN_10;
  GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
  GPIO_InitStruct.Alternate = LL_GPIO_AF_5;
  GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
  LL_GPIO_Init(GPIOA, &GPIO_InitStruct);
 
  GPIO_InitStruct.Pin = LL_GPIO_PIN_4;
  GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
  GPIO_InitStruct.Alternate = LL_GPIO_AF_10;
  GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
  LL_GPIO_Init(GPIOA, &GPIO_InitStruct);
 
  GPIO_InitStruct.Pin = LL_GPIO_PIN_6|LL_GPIO_PIN_7;
  GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
  GPIO_InitStruct.Alternate = LL_GPIO_AF_10;
  GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
  LL_GPIO_Init(GPIOB, &GPIO_InitStruct);
 
  GPIO_InitStruct.Pin = LL_GPIO_PIN_12|LL_GPIO_PIN_10;
  GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
  GPIO_InitStruct.Alternate = LL_GPIO_AF_10;
  GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
  LL_GPIO_Init(GPIOC, &GPIO_InitStruct);
 
  GPIO_InitStruct.Pin = LL_GPIO_PIN_9;
  GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
  GPIO_InitStruct.Alternate = LL_GPIO_AF_4;
  GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
  LL_GPIO_Init(GPIOC, &GPIO_InitStruct);
 
  GPIO_InitStruct.Pin = LL_GPIO_PIN_9;
  GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
  GPIO_InitStruct.Alternate = LL_GPIO_AF_10;
  GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
  LL_GPIO_Init(GPIOD, &GPIO_InitStruct);
 
  GPIO_InitStruct.Pin = LL_GPIO_PIN_5|LL_GPIO_PIN_4|LL_GPIO_PIN_6|LL_GPIO_PIN_0;
  GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
  GPIO_InitStruct.Alternate = LL_GPIO_AF_10;
  GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
  LL_GPIO_Init(GPIOE, &GPIO_InitStruct);
}

Based on datasheet, DCMI can run at 64MHz (Frequency ratio DCMI_PIXCLK/fHCLK=0.4), while I only do 10-30MHz, and yes, I checked with scope.

Same goes to M33 core frequency, it is 160MHz.

Errata is also not say anything. Porting this code from STM32L4, and it was working like a charm.

1 REPLY 1

> At this point I am not even using DMA

That's why you get overruns. Data are churning in into DCMI's FIFO, you have to pull them out from the mcu side at the same rate.

JW