cancel
Showing results for 
Search instead for 
Did you mean: 

One pulse mode configuration

Las1
Associate II

Hello to everyone,

I would like to know more about 'one pulse mode'. 

I'm using a STM32F446RET and I need to generate 1 or more pulses when an event occours.

In my project, channel 1 of TIM9 is the pin chosen to generate the waveforms.
I got that the 'one pulse mode' needs a sort of trigger to start generating the waveforms. I can't use the channel 2 of TIM9 as trigger input because it is already used for another signal. So, I've read that I can use another slave mode to get the same behaviour, but I don't understand how.

Currently, I have set slave mode as External Clock mode 1 and as trigger source ITR1, and according to reference manual, there is an internal connection with TIM3.

Las1_0-1687944025035.png

That means the TIM9 clock is connected to the rising edge of TIM3, but on which signal? 
I would really like to know more.
Thanks to whoever will answer.

9 REPLIES 9
TDK
Guru

It's connected to TRGO. Looks like an omission on that RM, but it's correct in other RMs for that family:

TDK_0-1687971136168.png

TRGO is configurable to be any number of signals in the MMS register.

TDK_1-1687971228481.png

 

If you feel a post has answered your question, please click "Accept as Solution".
TDK
Guru

> I would like to know more about 'one pulse mode'. 

> I'm using a STM32F446RET and I need to generate 1 or more pulses when an event occours.

 

I'm not sure one pulse mode will get you what you want here. If it doesn't, perhaps explain in more detail what you're looking for. TIM9 doesn't have a repitition counter like TIM1/8 do.

If you feel a post has answered your question, please click "Accept as Solution".

> when an event occours

What is "an event", exactly?

> I would like to know more about 'one pulse mode'.

It's nothing less and nothing more, than the timer stopping automatically upon Update (i.e. usually when it rolls over). See description of TIMx_CR1.OPM bit in RM.

JW

Las1
Associate II

Hello TDK,

Thank you for your replies.
Without RCR register, I think it's more beneficial to switch timer and use TIM8. It's is easier to use for what I need.
However, I still have some questions about this master-slave relationship .
Slave:
With the SMS register I can choose the slave mode as I read here:

 

Las1_0-1688034341883.png

If I configure it as External clock mode and if I choose as TS ,'Trigger selection', the value '001' = ITR1, it means that the rising edge of TRGI, in this case the theTRGO set by the MMS register of the master, clocks the counter. So I have to setup a TRGO event to get the clock signal for the slave timer? 

So if that's true, after setting the parameters for the waveform, I should choose an TRGO event to have the clock signal for my slave timer and the same signal is my trigger signal. After that the timer starts counting, until the pulse is complete, right?

 

Hello waclawek, 
thanks for your reply.

>What is "an event", exactly?

The event can be a change state of input or another thing. I wanted indicate that when something happens, I need to generate one or more pulses.

"Something happens" is quite vague.

Start with setting up the timer for PWM (including setting up pin in GPIO for the appropriate AF), set TIMx_CR1.OPM, and when "something happens", set TIMx_CR1.CEN and that will generate you the pulse.

More pulses are more tricky, as TDK said above, only TIM1 and TIM8 allow you to use the TIMx_RCR to automatically generate that in OPM mode.

JW

MHank.1
Associate III

I wrote an article on STM Timers trthat includes an example of One-Shot node.

https://jaxcoder.com/Post/Index?guid=456f6a89-1a93-4a72-bab9-4cf3a9e7f9b6 

To get more than one pulse you se the TIMn->RCR (Repeat) To whatever value you need,.

PartsBin - An Electronic Parts Organizer for Windows

What signal are you looking to get exactly? And what trigger exactly do you want to get that signal? External clock mode doesn't sound helpful here based on your original post.

If you feel a post has answered your question, please click "Accept as Solution".
Las1
Associate II

Hello TDK,

you're right! My idea was based on wrong meaning of that mode:
I thought the 'one pulse mode' was only useable with a trigger, instead I can use it by just activating the timer counter enable when I need it as Waclawek said.

Thank you to everyone!