PWM and OneShot on TIM2 and TIM3"SOLVED"

Post here first, or if you can't find a relevant section!
altEnergy
Posts: 10
Joined: Sat Sep 25, 2021 1:02 pm

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

Post 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!
altEnergy
Posts: 10
Joined: Sat Sep 25, 2021 1:02 pm

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

Post 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.
altEnergy
Posts: 10
Joined: Sat Sep 25, 2021 1:02 pm

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

Post by altEnergy »

ag123 thankyou for making my post less lonely Hats off to you Sir :D
mikeklien
Posts: 1
Joined: Mon Nov 01, 2021 7:16 pm

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

Post 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.
Post Reply

Return to “General discussion”