How to use DMA communication for S32k144 LPSPI module?

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

How to use DMA communication for S32k144 LPSPI module?

684 Views
ev-workzhang
Contributor I

I used the LPSPI module to read the position information of the position sensor. When the clock reached 8Mhz, Freemaster showed that it still took 8us to complete.
LPSPI module can only wait when reading or writing?
Will the eDMA module save me time? How to do?
Based on MBDT 2018R1
Best wishes

0 Kudos
1 Reply

640 Views
constantinrazva
NXP Employee
NXP Employee

Hello ev-workzhang@163.com ,

Can you let me know how you are measuring in FreeMASTER the time?

The 8us you are seeing from the profiler (I assume) is most likely due to the function calls for starting an SPI transfer. If you want to go lower than this, I'm not sure using eDMA would do the trick, as you will still have some overhead with function calls. If you were to see the signal on an oscilloscope or logic analyzer, you'll see that the actual transfer takes 1us per 8bits with the baud rate you have set-up.

If you'd like to come close to 1us per 8 bits, you'll have to insert custom code instead of using the SPI Transfer block, so you won't use the same SDK function, to avoid the overhead. But beware - this 'overhead'  I'm talking about does more than just start a transfer - various checks will not be done anymore, in order to gain some performance. That is up to you to decide. As for the SPI Configuration block, you can still use that with no impact on performance.

If you want to go for using custom code insertion for the transfer block, I can lend you a hand in dealing with it.

Kind regards,

Razvan.

0 Kudos