cancel
Showing results for 
Search instead for 
Did you mean: 

General question about DMA

arganasss
Associate II
Posted on March 18, 2014 at 22:45

Hello everyone, i have a few general questions about DMA and i will appreciate the help if someone could answer to my questions. I know it is used to transfer data at high speeds between memory and peripherals, or memory to memory. I'm interested on how long these DMA transfers take, i mean how much time i can loose if i don't use DMA? When it is appropriated to use DMA? For example, in my application i am capturing timer values one hundrend times, and then i am calculating an average value. Is it good idea to use DMA if i am putting some data to buffer, ant when i need to do some calculations, would it help me to do it faster? OR if you could give some good links which would explain general ussage of DMA, i would highly appreciate that. Thanks everyone in advance.

2 REPLIES 2
Posted on March 19, 2014 at 01:20

DMA off loads busy work from the processor, allowing operations to occur autonomously.

If something happens at a rate, say >100KHz it would be better to let hardware service it, than generate an interrupt and waste hundreds of clock cycles to service each event. DMA may take a dozen, but these are not billed to the processor and your task.

If you have to make a hundred measurements, you can set up the DMA to do ALL of them, and then interrupt when it's complete. This reduces further the loading of the processor.

Some times the processor and DMA may fight over the same resource, this is called contention, one device will be held off to allow the other with high priority to complete, or allow the current device to complete if it is the middle of it's transaction. The delays may depend on the speed of the buses involved in the transaction. The processor may be stalled very briefly, but still significantly less time than an interrupt would, with all it's diversion of current execution, and pushing of registers, etc.

A good book on Computer Architecture, or CPU/System Design may cover the use of DMA.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
arganasss
Associate II
Posted on March 19, 2014 at 21:09

Thank you very much Clive. You are very helpful, as always.