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...

2 REPLIES 2
KDJEM.1
ST Employee

Hello @Linas L ,

 

What is the image size? The DMA must be configured according to the image size (color depth and resolution), and to the capture mode. For that I recommend you take a look at AN5020 precisely DMA configuration versus image size and capture mode section may help you.

I hope this help you to solve the issue.

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.

Hello

 

  GPDMA1_CH12_BR1 = (Transfer_size*2) | (Transfer_size<<16);

 

This is for size, in my case 10b 608 pixels * 608 pixels

For some reason, it just started working again. (this was after FPGA recompiling, maybe it was glitching my power supply, and now I can't test this theory)