cancel
Showing results for 
Search instead for 
Did you mean: 

One pulse generator on STM32L052

gerardo
Associate II
Posted on December 05, 2014 at 13:46

Hi family,

I am trying to generate a determined width pulse in one GPIO pin with STM32L052C uC and I am thinking to do this with One pulse mode timer.

0690X00000602z5QAA.jpg

Is it possible to do that?

Detecting the pulse Tp with the timer2 input capture mode I have to wait Td [256uS] and then generate or not depending the case with Tc [256uS] in one single pulse.

Is it possible to do that with TIMERx One pulse mode?? Any other solution?

Thks
8 REPLIES 8
gerardo
Associate II
Posted on December 09, 2014 at 18:21

Does anyone knows how to configure it without Timer 2 trigger just only by software??

Posted on December 09, 2014 at 20:35

I don't understand what do you want to achieve. Try to rephrase your question.

JW

gerardo
Associate II
Posted on December 09, 2014 at 21:54

I want to generate a single pulse with a delay, just it

Posted on December 09, 2014 at 22:08

With a delay, or with a width? You're not explaining this very well, and I'm not sure how the input capture sees the negative pulse, or how you'd know what state it's going to be before it happens.

You can use Input Capture to catch the phase of an edge, you can use another CCRx compare setting to get to the 175+256us point, interrupt, get the state, drive the pin, and advance the CCRx to the 175+256+256us point.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on December 09, 2014 at 22:16

Stop or reset the timer if not after system reset, set it for the required output channel to appropriate PWM mode (the one which sets output high when timer value is higher than compare value), enable the output of that channel, set compare value to the required delay, set autoreload value to sum of delay and pulse length, set one-pulse mode; and then simply enable the timer when the starting event happened.

If you want to start autmatically on a capture event on different channel of the same timer (or, more precisely, when the pin corresponding to that channel goes to active level), then set that channel as source for slave trigger (in TIMx->SMCR.TS, only channels 1 or 2 as TI1FP1 or TI1FP2 (or TI1F_ED), in TIMx->SMCR.SMS set Trigger mode and *don't* enable the timer.

JW

gerardo
Associate II
Posted on December 09, 2014 at 22:43

0690X00000602sQQAQ.jpg

Posted on December 09, 2014 at 22:48

Ok, well this would appear to be an ideal time for you to get some practical experience about how the chip behaves.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
gerardo
Associate II
Posted on December 09, 2014 at 23:09

I would like to setup Timer21 channel 2 to generate this kind of feature