2015-01-29 03:19 PM
I'm setting up a PWM1 timer output on PC6. It configures and operates OK. However, at the end of the duration I run it for, I disable it, either by direct register, or the function call:
TIM_Cmd(TIM3, DISABLE); However, the output pin insists on staying high. Even if I do this: GPIOC->BSRRL = GPIO_Pin_6; it still remains high. No matter how I configure it: PU, PD, or NoPUPD. What's going on? How do i get this pin to stay low? I can run another channel and it behaves just fine, and stays low after running the timer disable function. thanks... #stm32f4-timer-output2015-01-29 04:13 PM
2015-01-30 12:11 AM
TIMx_CR1.CEN does not influence the outputs, it only gates the clock into the counting element. The output simply stays in its last state - it must behave in the same way for other channels/timers too.
JW2015-01-30 03:16 PM
This timer output is still giving me grief...
I've tried configuring the pin pulled up, pulled down, and neither. Attached is a scope shot to see what it appears like. The yellow trace is PC6 (timer 3), the green is PD (timer 4) No matter what I do with PC6, it wants to transition high at the last cycle. Here's some code: /* Output Compare PWM1 Mode configuration: Channel 1 */ TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM1; TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable; TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_High; //create pulse width for both channels the same uint16_t onTime = (uint16_t) (timerPeriod * dutyCycle); TIM_OCInitStructure.TIM_Pulse = onTime; TIM_OC1Init(TIM3, &TIM_OCInitStructure); TIM_OC1Init(TIM4, &TIM_OCInitStructure); At the end of the number of counts (12) it matters not what I do: I can directly write the timer registers or use the timer disable function. This: TIM_Cmd(TIM3, DISABLE); or this: TIM3->CNT = 0; TIM3->CCR1 = 0; TIM3->CCR2 = 0; How can I get this to stay low neatly as PD12 is doing? In fact, why does that output look like it's slewing so badly? I realize that PD12 is feeding the LED and pullup on the Discovery board, but I also tried physically connecting PC6 to a pullup resistor to Vcc, and it makes no difference. Help....please.... ________________ Attachments : 20150130_154651.jpg : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HzYY&d=%2Fa%2F0X0000000bNY%2FgcggVnUvNu3tjP9dH0DzQFDbuyLUcGWXhc.wDDLXoY8&asPdf=false2015-02-02 03:51 AM
> How can I get this to stay low neatly as PD12 is doing?
Post how do you set up both timers. Can you spot the differences?> In fact, why does that output look like it's slewing so badly?
Because you set the input on your scope to AC... JW2015-02-02 05:10 PM