DCMI with DMA interface to AXI_SRAM results in TRANSFER ERROR
Hello
My setup contains an STM32H743 with a camera attached via DCMI interface.
I am trying to acquire single snapshot, but unfortunately experiencing errors.
I declared the following variable on my SRAM
#define BUFF_SIZE (160*120)
ALIGN_32BYTES(uint8_t frame_buff[BUFF_SIZE]);the variable is allocated in the AXI_SRAM region (0x240....)
i also defined the MPU
MPU_InitStruct.Enable = MPU_REGION_ENABLE;
MPU_InitStruct.Number = MPU_REGION_NUMBER0;
MPU_InitStruct.BaseAddress = D1_AXISRAM_BASE; // (0x24000000)
MPU_InitStruct.Size = MPU_REGION_SIZE_512KB;
MPU_InitStruct.SubRegionDisable = 0x0;
MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL0;
MPU_InitStruct.AccessPermission = MPU_REGION_FULL_ACCESS;
MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_ENABLE;
MPU_InitStruct.IsShareable = MPU_ACCESS_NOT_SHAREABLE;
MPU_InitStruct.IsCacheable = MPU_ACCESS_CACHEABLE;
MPU_InitStruct.IsBufferable = MPU_ACCESS_NOT_BUFFERABLE;and the DCMI's DMA intialized with
/* DCMI Init */
hdma_dcmi.Instance = DMA2_Stream1;
hdma_dcmi.Init.Request = DMA_REQUEST_DCMI;
hdma_dcmi.Init.Direction = DMA_PERIPH_TO_MEMORY;
hdma_dcmi.Init.PeriphInc = DMA_PINC_DISABLE;
hdma_dcmi.Init.MemInc = DMA_MINC_ENABLE;
hdma_dcmi.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD;
hdma_dcmi.Init.MemDataAlignment = DMA_MDATAALIGN_WORD;
hdma_dcmi.Init.Mode = DMA_NORMAL;
hdma_dcmi.Init.Priority = DMA_PRIORITY_HIGH;
hdma_dcmi.Init.FIFOMode = DMA_FIFOMODE_ENABLE;
hdma_dcmi.Init.FIFOThreshold = DMA_FIFO_THRESHOLD_FULL;
hdma_dcmi.Init.MemBurst = DMA_MBURST_INC4;
hdma_dcmi.Init.PeriphBurst = DMA_PBURST_SINGLE;
if (HAL_DMA_Init(&hdma_dcmi) != HAL_OK)
{
Error_Handler();
}
__HAL_LINKDMA(dcmiHandle,DMA_Handle,hdma_dcmi);
/* DCMI interrupt Init */
HAL_NVIC_SetPriority(DCMI_IRQn, 15, 0);
HAL_NVIC_EnableIRQ(DCMI_IRQn);then, starting the function
HAL_DCMI_Start_DMA(&hdcmi, DCMI_MODE_SNAPSHOT, (uint32_t)frame_buff, BUFF_SIZE);I found out that my `frame_buff` is empty, and after debugging a while, found out that I keep getting a DMA IRQ which results with the error code
HAL_DMA_ERROR_TEPlease, help me find out the reason for the problem with the data transfer.
Sincerely
Dan
