本帖最后由 frankstm32f 于 2018-9-7 22:14 编辑 各位前輩/高手 安安: 小弟不才,上來請教大家 1.請問有人有使用過STM32L496的DCMI來接收OV2640相機輸出的JPEG資料嗎?小弟參考了官方文檔AN5020 - Digital camera interface (DCMI) for STM32 MCUs 看的有不太懂 在 DCMI availability and features across STM32 MCUs (P.13) STM32L4x6 - JPEG codec (NO) 可是在 ST的DCMI有支援 Capture of JPEG data: the data is captured in JPEG format to be stored in the SDRAM. (P.56) 因此想問問STM32L496或是stm32L4帶DCMI是否都可以支援Capture of JPEG data呢? 2. 另外小弟有嘗試使用STM32L496來收OV2640 JPEG資料, 但是卻一直進 HAL_DCMI_ErrorCallback HAL_DCMI_ErrorCallback [2018-09-07 22:05:21.456] ErrorCode:0x41 [2018-09-07 22:05:21.456] pBuffPtr:0 [2018-09-07 22:05:21.456] XferSize:0 [2018-09-07 22:05:21.456] pCircularBuffer:0 [2018-09-07 22:05:21.456] HalfCopyLength:0 [2018-09-07 22:05:21.456] 但是缺查部到 ErrorCode:0x41 是什麼意思... 有請各位前輩和高手幫忙解答 附上DCMI配置 與部分程式 #define PIXEL_WIDTH ((uint16_t)240) #define PIXEL_HEIGHT ((uint16_t)320) uint16_t pBuffer[PIXEL_WIDTH*PIXEL_WIDTH]; if(BSP_CAMERA_Init(CAMERA_J320x240) == CAMERA_OK) { printf ("CAMERA_OK \r\n"); #if 1 /* Wait 1s before Camera snapshot */ HAL_Delay(1000); if(HAL_DCMI_Start_DMA(&hdcmi, DCMI_MODE_SNAPSHOT , (uint32_t)pBuffer, PIXEL_WIDTH*PIXEL_WIDTH) != HAL_OK) { printf ("HAL_DCMI_Start_DMA_FAIL \r\n"); } #endif } else { printf ("CAMERA_FAIL \r\n"); } /* DCMI init function */ static void MX_DCMI_Init(void) { hdcmi.Instance = DCMI; hdcmi.Init.SynchroMode = DCMI_SYNCHRO_HARDWARE; hdcmi.Init.PCKPolarity = DCMI_PCKPOLARITY_RISING; hdcmi.Init.VSPolarity = DCMI_VSPOLARITY_LOW; hdcmi.Init.HSPolarity = DCMI_HSPOLARITY_LOW; hdcmi.Init.CaptureRate = DCMI_CR_ALL_FRAME; hdcmi.Init.ExtendedDataMode = DCMI_EXTEND_DATA_8B; hdcmi.Init.JPEGMode = DCMI_JPEG_ENABLE; hdcmi.Init.ByteSelectMode = DCMI_BSM_ALL; hdcmi.Init.ByteSelectStart = DCMI_OEBS_ODD; hdcmi.Init.LineSelectMode = DCMI_LSM_ALL; hdcmi.Init.LineSelectStart = DCMI_OELS_ODD; HAL_DCMI_MspInit(&hdcmi); if (HAL_DCMI_Init(&hdcmi) != HAL_OK) { _Error_Handler(__FILE__, __LINE__); } } /* DMA2D init function */ static void MX_DMA2D_Init(void) { hdma2d.Instance = DMA2D; hdma2d.Init.Mode = DMA2D_M2M; hdma2d.Init.ColorMode = DMA2D_OUTPUT_RGB565; hdma2d.Init.OutputOffset = 0; hdma2d.Init.RedBlueSwap = DMA2D_RB_REGULAR; /* No R&B swap for the output image */ hdma2d.Init.AlphaInverted = DMA2D_REGULAR_ALPHA; /* No alpha inversion for the output image */ /* DMA2D Callbacks Configuration */ hdma2d.XferCpltCallback = TransferComplete; hdma2d.XferErrorCallback = TransferError; hdma2d.LayerCfg[1].InputOffset = 0; hdma2d.LayerCfg[1].InputColorMode = DMA2D_INPUT_RGB565; hdma2d.LayerCfg[1].AlphaMode = DMA2D_NO_MODIF_ALPHA; hdma2d.LayerCfg[1].InputAlpha = 0xFF; hdma2d.LayerCfg[1].AlphaInverted = DMA2D_REGULAR_ALPHA; hdma2d.LayerCfg[1].RedBlueSwap = DMA2D_RB_REGULAR; if (HAL_DMA2D_Init(&hdma2d) != HAL_OK) { _Error_Handler(__FILE__, __LINE__); } if (HAL_DMA2D_ConfigLayer(&hdma2d, 1) != HAL_OK) { _Error_Handler(__FILE__, __LINE__); } } /** * Enable DMA controller clock */ static void MX_DMA_Init(void) { /* DMA controller clock enable */ __HAL_RCC_DMA2_CLK_ENABLE(); /* DMA interrupt init */ /* DMA2_Channel6_IRQn interrupt configuration */ HAL_NVIC_SetPriority(DMA2_Channel6_IRQn, 15, 0); HAL_NVIC_EnableIRQ(DMA2_Channel6_IRQn); } 謝謝 |
评分
查看全部评分