Skip to main content
gds2
Associate II
January 15, 2010
Question

Basic question regarding PWM Input with DMA

  • January 15, 2010
  • 3 replies
  • 965 views
Posted on January 15, 2010 at 10:27

Basic question regarding PWM Input with DMA

    This topic has been closed for replies.

    3 replies

    chikos33
    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 13:38

    Hi gds,

    That's right:

    You just need to enable both DMA channels (for TIM2_CH1 and TIM2_CH2 that means: DMA1_Channel5 and DMA1_Channel7), to choose the CCRx register as CPARx register base address, to choose the relative trigger for each DMA channel and finally to enable DMA. Each DMA channel will give series of values from one CCR register.

    I hope it's what you needed to know ?

    [ This message was edited by: chikos33 on 15-01-2010 14:45 ]

    gds2
    gds2Author
    Associate II
    May 17, 2011
    Posted on May 17, 2011 at 13:38

    If the PWM input (PWMI) example were extended to use DMA instead of just interrupts, would this require two DMA channels since two CCR registers are read (CCR1 and CCR2) although only 1 timer input channel is used (e.g., TIM2_CH1 or TIM2_CH2)?

    If so, assuming TIM2 used, would this require DMA1 channel 5 and 7 (see Table 40, pg 137 of manual RM0008)?

    Thanks,

    -gene

    gds2
    gds2Author
    Associate II
    May 17, 2011
    Posted on May 17, 2011 at 13:38

    Thanks for verifying that. Unfortunately, I am already using DMA Channel 5 for USART1_RX and according to the manual I would have to disable it while waiting for the TIM2_CH1 DMA. Since I never know when serial RX will occur and I can't miss messages, I probably should not use the channel for TIM2 also. Therefore, it seems, I need to just use an ISR to read the captured values of the PWM signal.

    -gene