Hot!What is Direct Memory Access (DMA)?

Author
XJohnny Hoffmann
New Member
  • Total Posts : 17
  • Reward points : 0
  • Joined: 2014/08/24 00:01:41
  • Location: 0
  • Status: offline
2018/02/14 03:02:22 (permalink)
0

What is Direct Memory Access (DMA)?

I'm confused about DMA. Is DMA some sort of communications protocol that allows a microcontroller to access another microcontroller's memory directly.
 
So for example I could have (Microcontroller A) busy multiplexing LEDS while (Microcontroller B) writing to a charactor array which (Microcontroller A) uses to multiplex the LEDS. 
 
If not, what is DMA used for?
Thank You :)
post edited by XJohnny Hoffmann - 2018/02/14 03:08:47
#1

13 Replies Related Threads

    Sobottech
    Super Member
    • Total Posts : 246
    • Reward points : 0
    • Joined: 2015/12/02 03:32:17
    • Location: 0
    • Status: offline
    Re: What is Direct Memory Access (DMA)? 2018/02/14 04:21:30 (permalink)
    0
    Johnny_Hoffmann
    I'm confused about DMA. Is DMA some sort of communications protocol that allows a microcontroller to access another microcontroller's memory directly.
     

    No.
     
    Give the document "Microchip WebSeminars PIC32 DMA Module" a try...
    http://www.microchip.com/...DeviceDoc/en542870.pdf
    #2
    qɥb
    Monolothic Member
    • Total Posts : 3329
    • Reward points : 0
    • Joined: 2017/09/09 05:07:30
    • Location: Jupiter
    • Status: offline
    Re: What is Direct Memory Access (DMA)? 2018/02/14 05:29:34 (permalink)
    0
    Johnny_Hoffmann
    I'm confused about DMA. Is DMA some sort of communications protocol that allows a microcontroller to access another microcontroller's memory directly.
     
    So for example I could have (Microcontroller A) busy multiplexing LEDS while (Microcontroller B) writing to a charactor array which (Microcontroller A) uses to multiplex the LEDS. 

    No.

    If not, what is DMA used for?

    Have you read the DMA chapter of a PIC that has it?
    It is a peripheral that can automatically read from one location and write to another location, in parallel with the main processor.
    It's most useful to regularly transfer data from RAM to a peripheral, or in the opposite direction.
     

    This forum is mis-configured so it only works correctly if you access it via https protocol.
    The Microchip website links to it using http protocol. Will they ever catch on?
    PicForum "it just works"
    #3
    NKurzman
    A Guy on the Net
    • Total Posts : 16440
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: offline
    Re: What is Direct Memory Access (DMA)? 2018/02/14 06:06:25 (permalink)
    0
    It moves data from one place to another inside the PIC without going through the CPU. For the PaiC it is usually between RAM and a peripherial.
    #4
    XJohnny Hoffmann
    New Member
    • Total Posts : 17
    • Reward points : 0
    • Joined: 2014/08/24 00:01:41
    • Location: 0
    • Status: offline
    Re: What is Direct Memory Access (DMA)? 2018/02/14 13:13:12 (permalink)
    0
    Thank You :)
    #5
    Gort2015
    Klaatu Barada Nikto
    • Total Posts : 2660
    • Reward points : 0
    • Joined: 2015/04/30 10:49:57
    • Location: 0
    • Status: offline
    Re: What is Direct Memory Access (DMA)? 2018/02/14 15:57:34 (permalink)
    0
    Used in Double buffering.

    MPLab X playing up, bug in your code? Nevermind, Star Trek:Discovery will be with us soon.
    https://www.youtube.com/watch?v=Iu1qa8N2ID0
    + ST:Continues, "What Ships are Made for", Q's back.
    #6
    XJohnny Hoffmann
    New Member
    • Total Posts : 17
    • Reward points : 0
    • Joined: 2014/08/24 00:01:41
    • Location: 0
    • Status: offline
    Re: What is Direct Memory Access (DMA)? 2018/02/14 23:48:14 (permalink)
    0
    I do believe that DMA is available in PIC18. 
    #7
    jtemples
    Super Member
    • Total Posts : 10955
    • Reward points : 0
    • Joined: 2004/02/13 12:31:19
    • Location: Southern California
    • Status: offline
    Re: What is Direct Memory Access (DMA)? 2018/02/15 00:59:18 (permalink)
    0
    Johnny_Hoffmann
    I do believe that DMA is available in PIC18.



    Some of the newest PIC18s have it, as do many PIC24/dsPIC parts.
    #8
    JPortici
    Super Member
    • Total Posts : 385
    • Reward points : 0
    • Joined: 2012/11/17 06:27:45
    • Location: Grappaland
    • Status: offline
    Re: What is Direct Memory Access (DMA)? 2018/02/15 02:31:03 (permalink)
    0
    I also suggest you read the DMA chapter of the (for example) PIC18F26K42, which is probably what you're interested in, since you asked in the 8 bit PIC section..
     
    There you will find a brief explanation of what DMA is, use cases and why it's used.
     
    For the pros: from the manual i understand that there is NO dual port ram in the PIC18, so the DMA has to operate when the core is not accessing memory and having a single accumulator means almost never (branches, moving literals, nops).. am i correct?
     
    Granted that the bus access priority can be altered so that DMA can stall core operation until it's finished.. but doesn't this mean that the DMA is pretty much useless?
    #9
    qɥb
    Monolothic Member
    • Total Posts : 3329
    • Reward points : 0
    • Joined: 2017/09/09 05:07:30
    • Location: Jupiter
    • Status: offline
    Re: What is Direct Memory Access (DMA)? 2018/02/15 03:38:47 (permalink)
    0
    Jack_M
    Granted that the bus access priority can be altered so that DMA can stall core operation until it's finished.. but doesn't this mean that the DMA is pretty much useless?

    Not at all. It will do in one cycle what it would take the core many cycles to do.

    This forum is mis-configured so it only works correctly if you access it via https protocol.
    The Microchip website links to it using http protocol. Will they ever catch on?
    PicForum "it just works"
    #10
    JPortici
    Super Member
    • Total Posts : 385
    • Reward points : 0
    • Joined: 2012/11/17 06:27:45
    • Location: Grappaland
    • Status: offline
    Re: What is Direct Memory Access (DMA)? 2018/02/15 03:48:11 (permalink)
    0
    I checked one of my usual programs and every couple of instructions the MCU is accessing RAM.
     
    Suppose i'm trying to automate an SPI transfer by using CCP for CS generation + DMA to send data, as i happily do with other devices, with the PIC18 i cannot guarantee that the transfer will be initiated and concluded before x time.
     
    In this case i think i prefer to take advantage of the multi-vectored interrupt with very low latency..
    #11
    jtemples
    Super Member
    • Total Posts : 10955
    • Reward points : 0
    • Joined: 2004/02/13 12:31:19
    • Location: Southern California
    • Status: offline
    Re: What is Direct Memory Access (DMA)? 2018/02/15 10:44:04 (permalink)
    +1 (1)
    It's certainly not as nice as say, the PIC24E with dual-ported RAM and no cycle stealing, but it's probably better than interrupts for most applications.
    #12
    PStechPaul
    Super Member
    • Total Posts : 2042
    • Reward points : 0
    • Joined: 2006/06/27 16:11:32
    • Location: Cockeysville, MD, USA
    • Status: offline
    Re: What is Direct Memory Access (DMA)? 2018/02/15 16:38:35 (permalink)
    0
    USB devices such as the PIC18F4550 have dual-port RAM as well as streaming parallel port (SPP) functions. But itdoes not seem to have DMA.

     
    #13
    Gort2015
    Klaatu Barada Nikto
    • Total Posts : 2660
    • Reward points : 0
    • Joined: 2015/04/30 10:49:57
    • Location: 0
    • Status: offline
    Re: What is Direct Memory Access (DMA)? 2018/02/15 16:44:01 (permalink)
    0
    You can fill a buffer via dma with data from spi while another dma ch. is passing data from the other buffer and sending it to dac/s.  Good for 512 byte sectors from Fat16/32.
     
    Flip buffers and repeat.
    It allows extra free time and avoids any stutter.
     

    MPLab X playing up, bug in your code? Nevermind, Star Trek:Discovery will be with us soon.
    https://www.youtube.com/watch?v=Iu1qa8N2ID0
    + ST:Continues, "What Ships are Made for", Q's back.
    #14
    Jump to:
    © 2018 APG vNext Commercial Version 4.5