cancel
Showing results for 
Search instead for 
Did you mean: 

STM32U585 GPDMA with DCMI error

Linas L
Senior II

Hello,
I am developing project where I need to do some image processing on BW image. All was great, but I started having problems with DMA (maybe I always had, don't recall)

Idea is that I simply load data to internal SRAM with DMA, and when I get TC, i do some processing.

No, where is no memory access while DCMI is loading data (or any work at all)
Yes, PCLK is lower that specified by datasheet ( reducing by 2-4x does not help)

This is my initialization:

 

 

#define GPDMA1_CH12_TR1       *(uint32_t *) 0x40020690
#define GPDMA1_CH12_TR2       *(uint32_t *) 0x40020694
#define GPDMA1_CH12_TR3       *(uint32_t *) 0x400206A4
#define GPDMA1_CH12_BR1       *(uint32_t *) 0x40020698
#define GPDMA1_CH12_SAR       *(uint32_t *) 0x4002069C
#define GPDMA1_CH12_DAR       *(uint32_t *) 0x400206A0


LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPDMA1);
  LL_DMA_EnableIT_DTE(GPDMA1, LL_DMA_CHANNEL_12);
  LL_DMA_EnableIT_TC (GPDMA1, LL_DMA_CHANNEL_12);
  NVIC_SetPriority(GPDMA1_Channel12_IRQn,0);
  NVIC_EnableIRQ(GPDMA1_Channel12_IRQn);


  DCMI->CR = 0;
  DCMI->IER =DCMI_IER_OVR_IE | DCMI_IER_VSYNC_IE;
  DCMI->CR  =DCMI_CR_ENABLE  | DCMI_CR_DR_SIZE_10b| DCMI_CR_PCKPOL;

  NVIC_SetPriority(DCMI_PSSI_IRQn, 1);
  NVIC_EnableIRQ(DCMI_PSSI_IRQn);

  NVIC_SetPriority(DCMI_PSSI_IRQn, 1);
  NVIC_EnableIRQ(DCMI_PSSI_IRQn);

  DCMI->CR |=DCMI_CR_CAPTURE;

//Init or reinit after image downloaded
  LL_DMA_DisableChannel(GPDMA1,LL_DMA_CHANNEL_12);
  LL_DMA_ResetChannel(GPDMA1,LL_DMA_CHANNEL_12);

  LL_DMA_SetChannelPriorityLevel(GPDMA1,LL_DMA_CHANNEL_12,LL_DMA_HIGH_PRIORITY);

  GPDMA1_CH12_TR1 = LL_DMA_SRC_ALLOCATED_PORT1|LL_DMA_DEST_ALLOCATED_PORT0|LL_DMA_DEST_INCREMENT|LL_DMA_DEST_DATAWIDTH_WORD|LL_DMA_SRC_DATAWIDTH_WORD;
  GPDMA1_CH12_TR2 = LL_DMA_DIRECTION_PERIPH_TO_MEMORY|LL_GPDMA1_REQUEST_DCMI_PSSI|LL_DMA_HWREQUEST_SINGLEBURST;
  GPDMA1_CH12_BR1 = (Transfer_size*2) | (Transfer_size<<16);
  GPDMA1_CH12_SAR = (uint32_t)&(DCMI->DR);
  GPDMA1_CH12_DAR = 0x2000B800;//DCMI_BASE(uint32_t)&(DCMI_DATA);
  GPDMA1_CH12_TR3 = 0;
  LL_DMA_EnableChannel(GPDMA1, LL_DMA_CHANNEL_12);

 

 

So whats wrong ? Well from time to time I get erros even with static data from camera. It looks like whole frame is been shifted. it it happens 1/1000 frame or even less.

After more programing I traced that every time I get error in image processing, I get DMA DTE error (data transfer error) Image processing is triggered by DMA_TC interrupt.

I try everything I know, but I have no idea where this error comes from. also disabling I and D cache did not help...

Any one have idea how to track down this problem ? Already spend a week with no results...

0 REPLIES 0