STM32U585 DCMI+DMA problem
Hello, I am facing problems with DMA and DCMI . Since DMA has ability to generate multiple block transfers with single configuration, it means i can transfer image larger that 0xFFFF.
So I writen code that would repat my DMA transfer for as much line as I have in my image, and transfer size would be one line pixel count.
I configured sensor for 304x304 image, and with DMA i get transfered exactly 304*304 of u16 data ( I prealod array with 0xFFFF and see where tranfer is ended)
What is strange, what data alignment is completely incorrect, while with FPGA, image is perfect and looks as expected ( i have one big light source in the middle)
This is my DMA code in LL
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPDMA1);
LL_DMA_SetChannelPriorityLevel(GPDMA1,LL_DMA_CHANNEL_12,LL_DMA_HIGH_PRIORITY);
DMA1_TR1 = LL_DMA_DEST_ALLOCATED_PORT0|LL_DMA_DEST_HALFWORD_PRESERVE|LL_DMA_DEST_BYTE_PRESERVE|LL_DMA_SRC_BYTE_PRESERVE|LL_DMA_DEST_INCREMENT|LL_DMA_DEST_DATAWIDTH_WORD|LL_DMA_SRC_ALLOCATED_PORT0|LL_DMA_DATA_ALIGN_ZEROPADD|LL_DMA_SRC_FIXED|LL_DMA_SRC_DATAWIDTH_WORD;
LL_DMA_ConfigTransfer(GPDMA1,LL_DMA_CHANNEL_12,DMA1_TR1);
DMA1_TR2=LL_DMA_TCEM_BLK_TRANSFER|LL_DMA_DIRECTION_PERIPH_TO_MEMORY|LL_GPDMA1_REQUEST_DCMI_PSSI;
LL_DMA_ConfigChannelTransfer(GPDMA1,LL_DMA_CHANNEL_12,DMA1_TR2);
DMA1_BR1 =LL_DMA_BLKRPT_DEST_ADDR_INCREMENT ;
LL_DMA_ConfigBlkRptAddrUpdate(GPDMA1,LL_DMA_CHANNEL_12,DMA1_BR1);
LL_DMA_ConfigBlkCounters(GPDMA1,LL_DMA_CHANNEL_12,304*2,304-1);
DMA1_SAR =(uint32_t)&DCMI->DR;
DMA1_DAR =(uint32_t)&DCMI_DATA;
LL_DMA_ConfigAddresses(GPDMA1,LL_DMA_CHANNEL_12,DMA1_SAR,DMA1_DAR);
LL_DMA_EnableIT_USE(GPDMA1, LL_DMA_CHANNEL_12);
LL_DMA_EnableIT_ULE(GPDMA1, LL_DMA_CHANNEL_12);
LL_DMA_EnableIT_DTE(GPDMA1, LL_DMA_CHANNEL_12);
LL_DMA_EnableIT_TC (GPDMA1, LL_DMA_CHANNEL_12);
NVIC_SetPriority(GPDMA1_Channel12_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0));
NVIC_EnableIRQ(GPDMA1_Channel12_IRQn);
LL_DMA_EnableChannel(GPDMA1, LL_DMA_CHANNEL_12);And downloaded image from SRAM3 memory looks like this:
Dows any one knows what could be wrong ? I spend so much time changing parameters for a transfer with not much luck...
