Electrical – What’s the advantage of DMA in byte I/O

dmaembeddedfirmwaremicrocontrollerspi

I have a A/D where signals CPU(Analog Devices Blackfin 706) whenever it has new sample, and CPU reads that through a SPI, which is few bytes. Then waits for new smaple signal again.

My question is, can we use DMA here? Who and how should tell DMA to transfer new data? I can't tell DMA to watch for the signal itself, so somebody has to do it.

Does it make sense to use DMA? This is basically like an interrupt I/O. Everytime A/D signals new sample, main software tells DMA to transfer it. So there is no improvement in efficiency. main is still involved continuously in I/O.

Best Answer

The idea is you can use an interrupt to set up a transfer, then let the transfer run in the background. If you have more than 1 byte to transfer, using DMA would probably reduce the number of interrupts required. I presume that if the DMA and SPI modules are sufficiently powerful and interact correctly, you should be able to get away with 1 or 2 interrupts per sample (one to set up the transfer and possibly one more to deal with the sample after the transfer). Whether this is an advantage or not would depend on many things - what else the CPU is doing, the ADC sample rate, the SPI clock rate, etc.