AnsweredAssumed Answered

LPSPI EDMA Help - MIMXRT1050 Board

Question asked by Kamal Nasif on Nov 5, 2019
Latest reply on Nov 20, 2019 by Victor Jimenez

Hello,

 

I am using the MIMXRT1050-EVK board with Keilv5 Pro edition. I am working on a project which involves LPSPI. My goal is to use one of the LPSPI ports and EDMA to communicate with an external device. I am having issues getting the LPSPI EDMA set up, I am using an example from the Keil pack which uses LPSPI and FlexSPI for communication.

 

I have successfully got the LPSPI working in which I can transmit and receive bytes, but I don’t understand how to use the LPSPI EDMA.

 

I have found the fsl_lpspi_edma files and do not understand how to use the functions. The ultimate goal is to use the EDMA to send data through LPSPI involving arrays of data. Currently, I am trying to figure out how to use the LPSPI_MasterTransferCreateHandleEDMA function then use the LPSPI_MasterTransferEDMA to send data. The code below is the function which creates the LPSPI EDMA handle but I don't know where to get the correct parameters for my project. Any help is appreciated.

 

/*!
* brief Initializes the LPSPI master eDMA handle.
*
* This function initializes the LPSPI eDMA handle which can be used for other LPSPI transactional APIs. Usually, for a
* specified LPSPI instance, call this API once to get the initialized handle.
*
* Note that the LPSPI eDMA has a separated (Rx and Rx as two sources) or shared (Rx and Tx are the same source) DMA
* request source.
* (1) For a separated DMA request source, enable and set the Rx DMAMUX source for edmaRxRegToRxDataHandle and
* Tx DMAMUX source for edmaIntermediaryToTxRegHandle.
* (2) For a shared DMA request source, enable and set the Rx/Rx DMAMUX source for edmaRxRegToRxDataHandle.
*
* param base LPSPI peripheral base address.
* param handle LPSPI handle pointer to lpspi_master_edma_handle_t.
* param callback LPSPI callback.
* param userData callback function parameter.
* param edmaRxRegToRxDataHandle edmaRxRegToRxDataHandle pointer to edma_handle_t.
* param edmaTxDataToTxRegHandle edmaTxDataToTxRegHandle pointer to edma_handle_t.
*/
void LPSPI_MasterTransferCreateHandleEDMA(LPSPI_Type *base,
lpspi_master_edma_handle_t *handle,
lpspi_master_edma_transfer_callback_t callback,
void *userData,
edma_handle_t *edmaRxRegToRxDataHandle,
edma_handle_t *edmaTxDataToTxRegHandle)
{
   assert(handle);
   assert(edmaRxRegToRxDataHandle);
   assert(edmaTxDataToTxRegHandle);

 

   /* Zero the handle. */
   memset(handle, 0, sizeof(*handle));\

 

   uint32_t instance = LPSPI_GetInstance(base);

 

   s_lpspiMasterEdmaPrivateHandle[instance].base = base;
   s_lpspiMasterEdmaPrivateHandle[instance].handle = handle;

 

   handle->callback = callback;
   handle->userData = userData;

 

   handle->edmaRxRegToRxDataHandle = edmaRxRegToRxDataHandle;
   handle->edmaTxDataToTxRegHandle = edmaTxDataToTxRegHandle;
}

 

 

Best,

Kamal

Outcomes