Electronic – What’s the point of DMA in embedded CPU’s

dmambedmicrocontroller

I was doing a project recently with the mbed (LPC1768), using the DAC to output various waves. I read parts of the datasheet, and it talked about how it had DMA for a lot of the peripherals. This seemed like it would be useful, but on further reading, I found that the DMA used the same data bus as the cpu (which I guess is normal). Does this mean that the CPU cant interact with any of the memories while the DAC is getting data? Also, since the DAC didn't have a buffer (as far as i could tell) and therefore has to DMA very often, whats the point of DMA? If the CPU can't do memory transactions, can it do anything?

Best Answer

The LPC1768 datasheet I found has the following quotes (emphasis mine):

Eight channel General Purpose DMA controller (GPDMA) on the AHB multilayer matrix that can be used with SSP, I2S-bus, UART, Analog-to-Digital and Digital-to-Analog converter peripherals, timer match signals, and for memory-to-memory transfers.

Split APB bus allows high throughput with few stalls between the CPU and DMA

The block diagram on page 6 shows SRAM with multiple channels between the AHB matrix and the following quote backs this up:

The LPC17xx contain a total of 64 kB on-chip static RAM memory. This includes the main 32 kB SRAM, accessible by the CPU and DMA controller on a higher-speed bus, and two additional 16 kB each SRAM blocks situated on a separate slave port on the AHB multilayer matrix. This architecture allows CPU and DMA accesses to be spread over three separate RAMs that can be accessed simultaneously

And this is reinforced by the following quote:

The GPDMA enables peripheral-to-memory, memory-to-peripheral, peripheral-to-peripheral, and memory-to-memory transactions.

Therefore you could stream data to your DAC from one of the separate SRAM blocks or from a different peripheral, whilst using the main SRAM for other functions.

This kind of peripheral-peripheral DMA is common in smaller parts where the memory interface is quite simple (compared to say a modern Intel processor).

Related Topic