Hello,
I just want to acquire any data thanks to the flexio + edma by using the Kinetis SDK 2.0 API (FLEXIO CAMERA Receive in EDMA way), refer to code bellow (frontend.c).
I can not pass in the call back function (FLEXIO_CAMERA_UserCallback). I have drived the FLEXIO_pin0 as a clock and FLEXIO_pin1 as a trig. I have no idea why it does not work. Thank you for your help.
Regards,
Patrice
void CAMERA_Init(void)
{
flexio_camera_transfer_t cameraTransfer;
uint32_t u16CameraFrameBuffer[256];
edma_handle_t g_edmaHandle;
flexio_camera_edma_handle_t g_cameraEdmaHandle;
edma_config_t edmaConfig;
FLEXIO_CAMERA_Type g_FlexioCameraDevice = {.flexioBase = FLEXIO0,
.datPinStartIdx = 4U, /* fxio_pin 4 -11 are used. */
.pclkPinIdx = 0U, /* fxio_pin 0 is used as pclk pin. */
.hrefPinIdx = 1U, /* flexio_pin 1 is used as href pin. */
.shifterStartIdx = 0U, /* Shifter 0 = 7 are used. */
.shifterCount = 8U,
.timerIdx = 0U};
flexio_camera_config_t cameraConfig;
/* Configure DMAMUX */
DMAMUX_Init(DMAMUX0);
/* Configure DMA */
EDMA_GetDefaultConfig(&edmaConfig);
EDMA_Init(DMA0, &edmaConfig);
DMAMUX_SetSource(DMAMUX0, DMA_CHN_FLEXIO_TO_FRAMEBUFF, (g_FlexioCameraDevice.shifterStartIdx + 1U));
DMAMUX_EnableChannel(DMAMUX0, DMA_CHN_FLEXIO_TO_FRAMEBUFF);
EDMA_CreateHandle(&g_edmaHandle, DMA0, DMA_CHN_FLEXIO_TO_FRAMEBUFF);
FLEXIO_CAMERA_GetDefaultConfig(&cameraConfig);
FLEXIO_CAMERA_Init(&g_FlexioCameraDevice, &cameraConfig);
/* Clear all the flag. */
FLEXIO_CAMERA_ClearStatusFlags(&g_FlexioCameraDevice,
kFLEXIO_CAMERA_RxDataRegFullFlag | kFLEXIO_CAMERA_RxErrorFlag);
FLEXIO_ClearTimerStatusFlags(FLEXIO0, 0xFF);
FLEXIO_CAMERA_TransferCreateHandleEDMA(&g_FlexioCameraDevice, &g_cameraEdmaHandle, FLEXIO_CAMERA_UserCallback, NULL,
&g_edmaHandle);
cameraTransfer.dataAddress = (uint32_t)u16CameraFrameBuffer;
cameraTransfer.dataNum = sizeof(u16CameraFrameBuffer);
FLEXIO_CAMERA_TransferReceiveEDMA(&g_FlexioCameraDevice, &g_cameraEdmaHandle, &cameraTransfer);
PRINTF("Start ACQ \n\r");
while (!(isEDMAGetOnePictureFinish))
{
ACQ_DEBUG(); // GPIO used for sending the clock and the trig to the flexio 0 and flexio 1
}
PRINTF("ACQ OK\n\r");
}
/* A callback function is also needed */
void FLEXIO_CAMERA_UserCallback(FLEXIO_CAMERA_Type *base,
flexio_camera_edma_handle_t *handle,
status_t status,
void *userData)
{
userData = userData;
/* EDMA Transfer finished */
if (kStatus_FLEXIO_CAMERA_RxIdle == status)
{
isEDMAGetOnePictureFinish = true;
}
}