lpcware

[SOLVED] LPC4337: Couldn't get DMA started.

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware

Content originally posted in LPCWare by Pacman on Mon Nov 04 01:35:27 MST 2013
I had difficulties getting the DMA started and got stuck.

 

It seemed I tried everything I could possibly think of, but after sleeping on the problem, I woke up and was reminded:
"The AHB Master 0 can only access memory."

 

So I got up and changed the code that I posted here, now I changed my question to an answer for those who also get stuck.

 

Attached is a file called DMA-Transfer.c...
I've made it quite minimalistic and put everything in one file for an easy overview.
-So it should be possible to compile and test it on most setups.

 

The following is basically what I'm doing:

 

  [*]Set all GPIO port 2 pins to output
  [*]Output a dummy value 0xc3, so I can see if it changes.
  [*]Turn on BASE_M4_CLK if it's not on already (it would be)
  [*]Disable DMA interrupts in NVIC (I don't use any)
  [*]Connect DMA branch clock to BASE_M4_CLK (should be on after reset anyway)
  [*]Stop/disable DMA Channel 0
  [*]Enable DMA
  [*]Clear pending bits and error bits.
  [*]Set up a source address, destination address and transfer size
  [*]Set up transfer type (Destination transfer must use AHB Master 0, not AHB Master 1)
  [*]Start the DMA
  [*]See that the 8 LEDs connected to GPIO port 2 changed.
  [*]See that the 2 leds toggle in the main-loop, to confirm that the main loop is running.

Original Attachment has been moved to: DMA-Transfer.c.zip

Outcomes