This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

DMA with GPTimer in PWM mode

Hey all,

I'm currently working on the EK-LM4F232. I'm trying to get a DMA transfer triggered by a Timer PWM Signal. I've modified the LM3S udma_timer.c code and got it to run on the LM4F successfully. I tried integrating my PWM code into there and failed. I then tried modifying the LM3S udma_timer_cpp.c code and got the DMA transfer working with the timer in capture mode. When I switched the timer to PWM mode, the DMA transfer does not trigger. If I were to remove the DMA code, I can get the processor interrupt triggered by the PWM.

Anyone has tried doing this? Any help would be much appreciated! 

  • Hi Kelvin,

        Nothing stands out as to why this is not working.  We are looking into this and will get back to you soon.

    -Ken

  • I'm sorry but the timer will not generate DMA requests in PWM mode.

  • We now know what doesn't work - perhaps you can employ a "sacrificial/dummy" 2nd timer - duplicating the "timings/triggering" of your PWM mode timer - (& operating in parallel with it) and have this 2nd timer then generate your DMA requests?  A wealth of timers are available w/in 4F232.  (pure theory - have neither tried nor implemented...)

  • Hi,

    Is this documented anywhere in the datasheet or errata? Anything else that I should watch out when using DMA?

    Thanks.

  • Hi cb1,

    Thanks for the alternative, it should work well if Timer Sync is used, making sure the other non-PWM timer fires at the exact right time as desired on the PWM mode timer.

  • @Kelvin,

    Way better description (timer sync) than mine.  Give it a try and let us know - (sometimes indirection/imagination pays off) - good luck...

  • Kelvin Tang said:

    Is this documented anywhere in the datasheet or errata? Anything else that I should watch out when using DMA?

    No, I had to go research it in order to give you that definitive answer.  Thank you for pointing out the problem.  We will update the documentation.

  • @Stellaris Joe-

    Hi there - would you be so good as to comment upon my admitted "swag" - in the attempt to "back-door" Kelvin's desired capability?  (several posts above)   Thanks...

  • @cb1 I have not tried it but it sounds like that should work.  You set up a second timer with the same period as the PWM timer and use it to make DMA requests.  Since a timer peripheral has no "data" to transfer, the DMA from/to can be anything.

  • Thank you Joe.  Trust that op will try & report...

  • Hey all,

    I tried working around this issue and bumped across another one.

    First, I think its best I explain what I'm trying to do. I'm actually trying the get the PWM signal to trigger an SSI transaction. Essentially, I'm using DMA to send junk data to the SSI transmit FIFO to initiate the transaction.

    I used Timer0A for my PWM signals and Timer0B to trigger the DMA transfers. On timer B, I used the match register to ensure that the DMA shall be triggered at the same time as my PWM signal toggles. I soon began noticing that there are 2 DMA transfers (2 SSI transactions) in 1 PWM cycle.

    I then integrated my code into the udma_timer example and found that the same thing occurs (2 transactions in 1 cycle). I then removed the match instruction and found that now only 1 transaction occurred in a cycle. Upon further investigation, I found that the 2 transactions occur due to the Match and Timeout event of the timer.

    I can't find any way that I can mask the Timeout event from triggering a DMA transfer. Is there anyone who has succeeded in doing the same thing as me ? Should I look into using Ping Pong to essentially use the timeout event to DMA nothing useful ? 

  • Hi Ken, Joe and cb1,


    I am still figuring out ways for the above, appreciate if you all can provide your insights on this.

    Thanks.

  • Hi Kelvin,

    Answered 2 easy ones earlier tonight - just noted yours.  (sorry)  Used DMA in somewhat similar manner w/enemy ARM MCU.  (often insights can be gleaned externally)  Will search/find past work - see if anything may aid...

    Real longshot - if the 1st DMA works ok can your ping-pong effect disable/enable or "alter" DMA to defeat the negative effect of the 2nd DMA operation?