DMA Not Working

20 Feb 2011

Hello everybody. I have been working on a code using the LPCXpresso IDE and the LPC1768 board from Embedded Artists and now I want to port it to the online compiler and run it on mbed.

The truth is that, the program compiled with LPCXpresso IDE runs great on the mbed!! But when I import my code to the online compiler it doesn't work anymore :(

I've been debugging it for a while and all I can say is that the DMA interrupt is not working. I mean, or the DMA Interrupt routine is not being called or the DMA is not running.

In my configuration I have a timer running and the DMA requests are being produced by the MAT0.0 match register. I know this is working fine because I've tested.

So, the DMA requests are being sent. The DMA interrupt should be called sometime but It is not happening.

This is my code: http://mbed.org/users/Gonzakpo/programs/KaossPad/lmvg06

The DMA configuration is in the main.c (just the interruption configuration) and in dma.c

If you find the error, I would really appreciate it!!.

Thank you in advance. Gonzalo.

20 Feb 2011

Sorry, I can't read the comments, I don't speak your language. However, your code does talk :)

I haven't used the LPCXpresso IDE so not sure if the CMSIS is available but on Mbed (and LPC17xx) but your code like this:-

  NVIC->ISER[0] = (0x1 << 26);

we'ed normally use:-

  NVIC_EnableIRQ(DMA_IRQn);

(see http://mbed.org/projects/libraries/svn/mbed/trunk/LPC1768/core_cm3.h and http://mbed.org/projects/libraries/svn/mbed/trunk/LPC1768/LPC17xx.h)

You may like to look at MODDMA which makes using the GPDMA pretty simple.

20 Feb 2011

Andy K wrote:

Sorry, I can't read the comments, I don't speak your language. However, your code does talk :)

I haven't used the LPCXpresso IDE so not sure if the CMSIS is available but on Mbed (and LPC17xx) but your code like this:-

  NVIC->ISER[0] = (0x1 << 26);

we'ed normally use:-

  NVIC_EnableIRQ(DMA_IRQn);

(see http://mbed.org/projects/libraries/svn/mbed/trunk/LPC1768/core_cm3.h and http://mbed.org/projects/libraries/svn/mbed/trunk/LPC1768/LPC17xx.h)

You may like to look at MODDMA which makes using the GPDMA pretty simple.

Yes, I've tried using NVIC_EnableIRQ(DMA_IRQn); but nothing changed. The interrupt isn't being called. I have serious doubt if the DMA request are reaching the DMA. Originally I have selected the DMA request trough the register LPC_SC->DMAREQSEL (It lets you select between timer or UART DMA requests). But now I see "someone" move that register to another structure. For mbed, this register is in LPC_UART0->DMAREQSEL. Are them the same register?.

Thank you for your help. Gonzalo.

20 Feb 2011

I've been looking at your library for a while and I can truly say that "I don't fully understand it" :P

In my application, the DMA is transfering from the ADC to the Memory (p2m) but looking at the MAT0.0 for the DMA request. Can I do that with your library?. I'm a bit confused. Your library needs lots of documentation ;)

Thank you!

20 Feb 2011

For god sake!!! Who would know that LPC_SC->DMAREQSEL (as in the CMSIS) is now LPC_SC->RESERVED9 for the mbed online compiler!!! And using LPC_UART0->DMAREQSEL doesn't work either (I don't know what that register is then).

So, after using LPC_SC->RESERVED9 my code started to work fine!!.

Thank you for your library. I figured it out looking at the setup.cpp code!!.

Regards, Gonzalo.

20 Feb 2011

Hi Gonzalo,

Sounds like there could be a potential bug in the CMSIS file; you shouldn't need to be using "reserved" entires! I've raised a ticket and will see if there has been an update we can pull in that can fix this problem.

Simon

20 Feb 2011

@Gonzalo, look at example2.cpp that shows how to get two ADC channels into a memory buffer.

@Simon, I noticed that, the "official" NXP Software Team's own library uses reserved9 !

20 Feb 2011

Simon Ford wrote:

Hi Gonzalo,

Sounds like there could be a potential bug in the CMSIS file; you shouldn't need to be using "reserved" entires! I've raised a ticket and will see if there has been an update we can pull in that can fix this problem.

Simon

Great to hear I'm not getting crazy haha. I hope you can correct the bug soon. I would really appreciate if you assign that registry to LPC_SC->DMAREQSEL as in the CMSIS from LPCXpresso (or at least the version I'm using which is 1.30). Just to keep consistency.

Thank you in advance. Gonzalo.