Cycle-stealing DMA on K22F to be used for SPI transfers?

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

Cycle-stealing DMA on K22F to be used for SPI transfers?

817 Views
abdullahkahrama
Contributor IV

I am using FRDM-K22F board and want to read some data from an SPI flash using DMA. I've accomplished this using FRDM-KL25Z board but the maximum SPI frequency was not enough for me so I've upgraded to K22F.

However, I cannot find cycle-stealing function or something similar that will allow me asynchronously do DMA transfers.

I want to be able to send a dummy byte to SPI flash, something like 0x00, then read the response and save it. I need two channels for that, one for SPI Tx and one for SPI Rx. But, I cannot make them work the way I want without cycle-stealing mode.

Is there a way out here?

Tags (3)
0 Kudos
3 Replies

544 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Abdullah,

Regarding your question, as you know that the Kl25 and K22 are different processor in Kinetis family, they use different SPI module, and DMA module.

The KL25 is a low cost processor, it's SPI and DMA module are simpler than that of K22. The K22 use eDMA, the Kl25 uses DMA, they are totally different DMA IP. The SPI of KL25 is different from that of K22, the "cycle-stealing mode" is only valid for KL25 DMA.

For the SPI plus DMA transfer based on SDK, we have example, pls build/download SDK2.0 for K22 from the website:

http://www.nxp.com/ksdk

after you download SDK2.0, pls refer to the directory:

C:\DriverE\Freescale\SDK_2.0_Mk12DN512xxx5\boards\twrk21d50m\driver_examples\dspi\edma_transfer\kds

Hope it can help you.

BR

Xiangjun Rong

544 Views
abdullahkahrama
Contributor IV

Hello Xiangjun Rong,

Thank you for your answer.

I have checked the source code in the examples directory for my board and found out this line on the non-blocking eDMA example for DSPI:

/*******************************************************************************

* Code

******************************************************************************/

/*!

* @brief DSPI master EDMA - non_blocking.

*

* Thid function uses DSPI master to send an array to slave

* and receive the array back from slave,

* thencompare whether the two buffers are the same.

*/

        // Receive the data.

        dspiResult = DSPI_DRV_EdmaMasterTransfer(DSPI_MASTER_INSTANCE,

                                             NULL,

                                             NULL,

                                             receiveBuffer,

                                             TRANSFER_SIZE);

I don't want to use SDK's functions, instead I want to create my code. I've checked the source code and it is way too complicated for a novice like me to understand.

Could you tell me the logic behind it so I can do my own implementation?

0 Kudos

544 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Adbullah,

If you do not want to project based on SDK platform, it is okay, you can write the SPI/DMA/DMAMUX module register directly, the code will be straightforward

BR

Xiangjun Rong

0 Kudos