Hi everyone,
I read the IDF documentation on SPI Master and I was confused about the use of DMA.
Under Speed and timing consideration, both Non-DMA Interrupt and Polling are faster than DMA driven Interrupt and Polling. So what is really the purpose of DMA in this context? Doesn't DMA free the CPU to handle other tasks?
"When the DMA is enabled, it needs about 2us per transaction to setup the linked list. When the master is transferring, it automatically read data from the linked list. If the DMA is not enabled, CPU has to write/read each byte to/from the FIFO by itself. Usually this is faster than 2us, but the transaction length is limited to 64 bytes for both write and read."
If my data transfer is less than 64 bytes, then DMA is actually worse than no-DMA, am I correct?
Thanks.
DMA vs NO-DMA for SPI Communication
-
- Posts: 9766
- Joined: Thu Nov 26, 2015 4:08 am
Re: DMA vs NO-DMA for SPI Communication
The issue is that it takes longer to set up a transfer with DMA than one without. DMA, however, allows you to do transfers >64 bytes without CPU interference, so if you can do large transfers, DMA is better.
Re: DMA vs NO-DMA for SPI Communication
Thank you for your reply. In my case, since I have to mux through each channel of the ADC using SPI commands, and each time I only collect 4 bytes (24 bits to be exact) and the sampling rate is 500Hz, I guess DMA will not be useful for me.
-
- Posts: 9766
- Joined: Thu Nov 26, 2015 4:08 am
Re: DMA vs NO-DMA for SPI Communication
I would agree on that.
Who is online
Users browsing this forum: Baidu [Spider], Google [Bot] and 56 guests