2010-01-15 01:27 AM
Basic question regarding PWM Input with DMA
2011-05-17 04:38 AM
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, -gene2011-05-17 04:38 AM
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 ]2011-05-17 04:38 AM
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