AnsweredAssumed Answered

RT1064 FlexIO Camera Problem

Question asked by 陈 文龙 on Jul 2, 2020
Latest reply on Jul 2, 2020 by Kerry Zhou

Hello,

I am trying to use flexio to connect a camera and using the following configuration. It can enter the CAMERA_VSYNC_IRQHandler, but can't  enter the callback function, it seems that it can't receive the image data. I wonder what the problem is. The attachment is the project.

Thanks!

 

   /* FlexIO管脚初始化 */
    FlexIO_Camera_PinInit();

    /* 配置FlexIO Camera设备 */
#if (CAMERA_FLEXIO_INST == 1U)
    g_FlexioCameraDevice.flexioBase = FLEXIO1; /* 使用FlexIO1 */
#elif (CAMERA_FLEXIO_INST == 2U)
    g_FlexioCameraDevice.flexioBase = FLEXIO2; /* 使用FlexIO1 */
#endif

    g_FlexioCameraDevice.datPinStartIdx = CAMERA_FLEXIO_DATA_PIN_START_INDEX; /* 图像数据起始FlexIO引脚号 */
    g_FlexioCameraDevice.pclkPinIdx = CAMERA_FLEXIO_PCLK_PIN_INDEX;           /* 像素时钟信号FlexIO引脚 */
    g_FlexioCameraDevice.hrefPinIdx = CAMERA_FLEXIO_HREF_PIN_INDEX;           /* 行同步信号FlexIO引脚 */
    g_FlexioCameraDevice.shifterStartIdx = 3U;                                /* FlexIO缓冲区起始编号4 (RT10xx只有四个缓冲区) - 缓冲区数量 */
    g_FlexioCameraDevice.shifterCount = 1U;                                   /* FlexIO缓冲区数量 */
    g_FlexioCameraDevice.timerIdx = 0U;                                       /* 用于FlexIO Camera定时器编号 */

    /* 初始化FlexIO Camera. */
    flexio_camera_config_t cameraConfig;
    FLEXIO_CAMERA_GetDefaultConfig(&cameraConfig);
    FLEXIO_CAMERA_Init(&g_FlexioCameraDevice, &cameraConfig);

    /* 清除所有标志 */
    FLEXIO_CAMERA_ClearStatusFlags(&g_FlexioCameraDevice,
                                   kFLEXIO_CAMERA_RxDataRegFullFlag | kFLEXIO_CAMERA_RxErrorFlag);
    FLEXIO_CAMERA_Enable(&g_FlexioCameraDevice, true);

    /* 配置 DMA */
    DMAMUX_Init(DMAMUX);
#if (CAMERA_FLEXIO_INST == 1U)
    DMAMUX_SetSource(DMAMUX, DMA_CHN_FLEXIO_TO_FRAMEBUFF, kDmaRequestMuxFlexIO1Request2Request3);
#elif (CAMERA_FLEXIO_INST == 2U)
    DMAMUX_SetSource(DMAMUX, DMA_CHN_FLEXIO_TO_FRAMEBUFF, kDmaRequestMuxFlexIO2Request2Request3);
#endif

    DMAMUX_EnableChannel(DMAMUX, DMA_CHN_FLEXIO_TO_FRAMEBUFF);

    /* 初始化 EDMA 模块 */
    edma_config_t edmaConfig;
    EDMA_GetDefaultConfig(&edmaConfig);
    edmaConfig.enableDebugMode = true;
    EDMA_Init(DMA0, &edmaConfig);
    EDMA_CreateHandle(&g_edmaHandle, DMA0, DMA_CHN_FLEXIO_TO_FRAMEBUFF);

    /* 创建相机句柄 */
    FLEXIO_CAMERA_TransferCreateHandleEDMA(&g_FlexioCameraDevice, &g_cameraEdmaHandle, FlexIO_Camera_UserCallback, NULL,
                                           &g_edmaHandle);

    /* 配置FlexIO Camera传输数据结构体 */
    g_cameraTransfer.dataAddress = (uint32_t)g_FlexioCameraFrameBuffer;  /* 图像缓冲区地址 */
    g_cameraTransfer.dataNum = FLEXIO_FRAME_HEIGHT * FLEXIO_FRAME_WIDTH; /* 缓冲区大小 */

    /* 开启dma接收图像数据 */
    FLEXIO_CAMERA_TransferReceiveEDMA(&g_FlexioCameraDevice, &g_cameraEdmaHandle, &g_cameraTransfer);

    /* 初始化场中断 */
    FlexIO_Camera_VsynPinInit();

Outcomes