2014-12-05 04:46 AM
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.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?Thks2014-12-09 09:21 AM
Does anyone knows how to configure it without Timer 2 trigger just only by software??
2014-12-09 11:35 AM
I don't understand what do you want to achieve. Try to rephrase your question.
JW2014-12-09 12:54 PM
I want to generate a single pulse with a delay, just it
2014-12-09 01:08 PM
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.2014-12-09 01:16 PM
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. JW2014-12-09 01:43 PM
2014-12-09 01:48 PM
Ok, well this would appear to be an ideal time for you to get some practical experience about how the chip behaves.
2014-12-09 02:09 PM
I would like to setup Timer21 channel 2 to generate this kind of feature