AnsweredAssumed Answered

Timer Compare Output - How to rearm timer

Question asked by Rob Peck on May 16, 2018
Latest reply on May 17, 2018 by Rob Peck

Board/Processor : STM32L476RG-Nucleo

Example code from: STM32Cube_FW_L4_V1.10.0

ARM IAR compiler V8.

 

I can successfully build and run the TIM_OCActive / TIM_OCInactive examples on the above board, they produce the required output pulses as described in the readme file.

 

I also successfully built a new project from scratch using the cube, to generate a 250mS pulse on the LED PA.5.

 

Unfortunately what I cant do is to generate another pulse ie user presses a button to generate another timed pulse.  I know I could use a basic timer set the pin high, then set the pin low when the timer interrupt fires, however I need a hardware controlled solution such that if the firmware was to fail in some way the output would still be turned off.  Which I understand I can do using the timer compare output once I can figure out how to rearm it.

 

The documentation for the timers and project examples don't describe how to rearm the timer to generate a new timed output pulse.  I have tried re-initialising the timer, I tried stopping and then starting the timer using the HAL functions all have no effect.

 

Has anyone managed to rearm the timer to generate a second or multiple pulses?

Outcomes