cancel
Showing results for 
Search instead for 
Did you mean: 

How to preset toggling timer outputs

andywild2
Associate III
Posted on February 09, 2015 at 15:06

Hello to all,

I use a TIM8 of a STM32F2xx to generate a quadrature signal.

This works fine no problem with toggling mode.

I send a sequence of pulses out of the OC-Outputs. (a speed ramp).

When the sequence is over the idle state of the OC-Outputs is unknown.

How can I put the OC-Outputs to a defined state now?

Or toggle them ''manually'' by single instruction?

Thanks for your answers

Andy

3 REPLIES 3
Posted on February 09, 2015 at 18:21

Well you should be able to read the pin state, and generate N, or N+1 toggles to get it to a known end state.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on February 09, 2015 at 21:47

> When the sequence is over the idle state of the OC-Outputs is unknown.

Why would it be unknown? Can't you count the number of updates (e.g. by chaining to another timer), then mod 2?

Nevertheless, see TIM chapter's sub-chapter Forced output mode.

Or, in case of TIM1/TIM8, see the OISx(N) bits in TIMx_CR2 (although, bumps may be ahead).

Or, simply set them as GPIO outputs.

JW

andywild2
Associate III
Posted on February 10, 2015 at 10:31

Dear Jan,

thanks a lot for your hint with forced mode!

It works great!

I thought about the OISxN bits too. And I thought idle state decribes the state when the counter is not enabled.

But I think this not true. Idle state in this regard has got something to do with deadtime insertion and when the MOE bit is 0.

But in my application MOE must always be 1, otherwise the OC-Outputs don´t do anything.

Anyway forced mode is the solution thanks a lot!

Andy