你好
我的设置包含一个
STM32H743,带有一个通过 DCMI 接口连接的摄像头。
我正在尝试获取单个快照,但不幸的是遇到了错误。
我在我的 SRAM 上声明了以下变量
- #define BUFF_SIZE (160*120)
- ALIGN_32BYTES(uint8_t frame_buff[BUFF_SIZE]);
该变量分配在 AXI_SRAM 区域(0x240 ....)
我还定义了 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;
DCMI 的 DMA 初始化为
- /* 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);
然后,启动功能
- HAL_DCMI_Start_DMA(&hdcmi, DCMI_MODE_SNAPSHOT, (uint32_t)frame_buff, BUFF_SIZE);
我发现我的 `frame_buff` 是空的,调试了一段时间后,我发现我一直收到 DMA IRQ,结果是错误代码
请帮我找出数据传输问题的原因。