2022-06-10 08:16 AM
I have timer8's one-time-pulse working however when the CNT reaches ARR and is set back to 0, the output pin goes high again. ( since CNT < CCR1 )
How do I ensure the output pins remains low after the one time pulse?
2022-06-10 08:23 AM
Perhaps have a high ARR and repetition count, and then stop it?
I thought single-shot mode just gave you one pulse..
2022-06-10 08:30 AM
The only solution I can think of so far is to use the updateEvent interrupt to turn off MOE or set CCR1 = 0 but it somewhat defeats the purpose of using hardware timer.
2022-06-10 03:55 PM
Use Toggle, or Clear on match mode in TIMx_CCMRx.OCxM, instead of PWM.
JW
2022-06-11 06:05 AM
I should have mentioned I use TIM3 as a master trigger output to trigger TIM8. Where would I set the pin high if I use toggle or clear mode? I'm sure I'm missing something obvious...
I was thinking of using ARR preload somehow so that it sets ARR to 0 on the next updateEvent. So I would set ARR = 2000, trigger the UG, run the timers, and then have the updateEvent set ARR to 0 on the next interrupt.
2022-06-11 06:13 AM
Perhaps forget about Toggle mode for now, that would be just confusing.
You can forcibly set the pin any time "manually" from software, by setting TIMx_CCMRx.OCxM to 0b101: Force active level.
Read the TIM chapter and description of its registers in RM.
Maybe try to draw a diagram, indicating what do you want to achieve.
JW
2022-06-11 06:19 AM
I had looked into forcing the pin high ( or low in my case ), but was hoping to do this in hardware and avoid using software interrupt. I guess it is not possible. I read another post and there is seemingly no hardware based solution to accomplish this.
2022-06-11 06:32 AM
I still don't understand what are you trying to accomplish.
Try to draw a timing diagram.
JW
2022-06-11 06:41 AM
I have TIM3 triggering TIM8. I need TIM8 to output 1 pulse on a pin. It all works, but the pin is set back to high at the very end of the process, when CNT reaches ARR and CNT wraps back to 0. ( Since CNT < CCR1 )
I need to output pin to remain low.
2022-06-11 08:09 AM
Here is part of the OneTimePulse doc which seems to indicate that the output pin will not be set high when the CNT is set back to 0. I understand it to say that if the CNT starts at an initial value of 0, and then wraps back to zero after sending the pulse, the pin will not be set to high since the CNT is back to the CNT value when the timer was started:
"Starting the counter can be controlled through the slave mode controller. Generating the waveform can be done in output compare mode or PWM mode. Select One-pulse mode by setting the OPM bit in the TIMx_CR1 register. This makes the counter stop automatically at the next update event UEV. A pulse can be correctly generated only if the compare value is different from the counter initial value"
Update: It seems like the output pin will end up low if I do a delay then a pulse, but end up high if I do a pulse then a delay.