FlexIO CAMERA + EDMA

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

FlexIO CAMERA + EDMA

907 Views
lacouturepatric
Contributor I

Hello,

 

I try to test the FlexIO Camera Driver from Kinetis SDK 2.0 API Reference Manual. Refer to link http://mcuxpresso.nxp.com/apidoc/2.0/group__flexio__camera.html.

 

In my test, I use 2 GPIO call :

- IDLE_CORTEX (0V /3V3 periodical signal, ref ACQ_DEBUG) that I connect to FLEXIO_pin0 (pclk),

- SHDN_CORTEX (3V) that I connect to FLEXIO_pin1 (hclk),

Original Attachment has been moved to: pin_mux.h.zip

Original Attachment has been moved to: pin_mux.c.zip

Original Attachment has been moved to: clock_config.h.zip

Original Attachment has been moved to: clock_config.c.zip

Original Attachment has been moved to: frontend.c.zip

Original Attachment has been moved to: board.c.zip

Original Attachment has been moved to: MK80FN256xxx15_Project.c.zip

Original Attachment has been moved to: frontend.h.zip

Original Attachment has been moved to: board.h.zip

0 Kudos
Reply
2 Replies

615 Views
lacouturepatric
Contributor I

Hello,

 

I try to test the FlexIO Camera Driver from Kinetis SDK 2.0 API Reference Manual. Refer to link http://mcuxpresso.nxp.com/apidoc/2.0/group__flexio__camera.html.

 

In my test, I use 2 GPIO call :

 

- IDLE_CORTEX (0V /3V3 periodical signal, ref ACQ_DEBUG) that I connect to FLEXIO_pin0 (pclk),

- SHDN_CORTEX (3V3) that I connect to FLEXIO_pin1 (hclk),

 

I try to pass into the callback function (/* A callback function is also needed */), which means that all data are received.

I did not succeed going into the call back function.

Do you have any way to debug or why I can not receive data.

It seems to be a code error. I am sure about my connection (GPIO has the good value, 0V, V3) and about the flexio because I tested with twrk80f150m_driver_examples_flexio_spi_edma_dspi_transfer_slave which works.

I use:

- twrk80f150m,

- TWR_ELV,

- TWR_proto,

My purpose is then to save data (4bits, with 20 Mhz clock) into sd card,

You will find the code source. Thank you in advance for your help.

0 Kudos
Reply

615 Views
lacouturepatric
Contributor I

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;
     }
 }
0 Kudos
Reply