Page 2 of 2

Re: PWM and OneShot on TIM2 and TIM3"SOLVED"

Posted: Tue Sep 28, 2021 7:32 am
by altEnergy
I used three timers in the end (2,3 and 4) so 1 is free should i need it! I just used the same code or similar as I used on timer2 thanks!

Re: PWM and OneShot on TIM2 and TIM3"SOLVED"

Posted: Tue Sep 28, 2021 7:59 am
by altEnergy
Also because I was not patient enough to understand how to sync all the timers so they run together at the same count, I used getcount on timer 2 then set count when all timers were paused so when i start them all they all start near each other no noticable differance at my lower speeds, but this might not be a good idea at higher speeds. Its got me moving for now hope it helps someone.

Re: PWM and OneShot on TIM2 and TIM3"SOLVED"

Posted: Tue Sep 28, 2021 8:22 am
by altEnergy
ag123 thankyou for making my post less lonely Hats off to you Sir :D

Re: PWM and OneShot on TIM2 and TIM3"SOLVED"

Posted: Mon Nov 01, 2021 7:51 pm
by mikeklien
I think generally the HardwareTimer API is modelled after generic 'square waves' signal train, flexibly with PWM and interrupts etc.

I've not dug into 'oneshot' mode as, more commonly,

I used the timer interrupt call back to simply drive my codes. e.g. blink a led in a simple case.

I did notice that while i'm trying to write some 'oscilloscope' codes,

the max i can get out of a h/w timer interrupt callback to read the ADC data register is 500 kHz on stm32f103.

Any higher sample rates, and it stalls, give unpredictable results etc.

I'd guess if you try to interface real external signals,

this is just going to be harder/worse.