cancel
Showing results for 
Search instead for 
Did you mean: 

Basic question regarding PWM Input with DMA

gds2
Associate II
Posted on January 15, 2010 at 10:27

Basic question regarding PWM Input with DMA

3 REPLIES 3
gds2
Associate II
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

chikos33
Associate II
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
Associate II
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