2015-02-18 09:51 AM
I've been running around in circles all morning trying to figure out how to set up PWM capture on this thing... STM32CubeMX doesn't have any options for doing it on TIM21, but I see it mentioned in the reference manual for this chip/timer. I can't make heads or tails of what the example setup in the reference manual is actually doing, either.
What I have is a single pin, PA2(Which is TIM21_CH1), that I need to capture both the high and low active time on. Can I do this with TIM21, or do I need to look into rearranging things to get this on TIM2? #stm32l0 #pwm-input #tim212015-02-18 10:10 AM
> I've been running around in circles all morning trying to figure out how to set up PWM capture on this thing... STM32CubeMX doesn't have any options for doing it on TIM21,
Then dump CubeMX and do it in the old fashioned way, setting up the registers directly. > I can't make heads or tails of what the example setup in the reference manual is actually doing, either. It can't really be more detailed - do exactly what the step-by-step description says. Have a look at the ''snippets'' example, in [STM32L0xx_Snippets_Package_V1.0.0]\Projects\TIMERS\04_PWM_Input\ . Incidentally, it uses TIM21 as the default timer, although on PB13. JW2015-02-18 10:16 AM
>> I can't make heads or tails of what the example setup in the reference manual is actually doing, either.
>It can't really be more detailed - do exactly what the step-by-step description says. It's too-detailed, I think. The timers on these things are really complicated compared to what I've worked with in the past(Zilog MCUs), and it hasn't ''clicked'' yet how everything fits together. I'll go look at that example, thanks.2015-02-18 10:28 AM
Also, I just figured out how to set it up in CubeMX. Disable the individual channels and select your PWM Input mode in the now-enabled Combined Channels dropdown.
2015-02-18 11:03 AM
OK, but then you'll be bound to the clickey stuff whole your life.... ;)
JW