Page 1 of 1

STM32F303K8 and SysTick timer

Posted: Sun Jan 31, 2021 6:50 pm
by Apache
Hello,

I need to use something else than TIM1, 2 or 3 as a SysTick timer, but the timers i have are not supported in hal_st_lld.h . Is there as specific reason why I can't use the other timers on my chip or are they just not implemented?

Re: STM32F303K8 and SysTick timer

Posted: Sun Jan 31, 2021 7:14 pm
by Giovanni
Hi,

Which version are you using? timers should be all supported now.

You can use SysTick as system timer by putting the "delta" parameter to zero in chconf.h (this disables the tick-less mode), in this case make sure to not exceed 1000Hz as system tick frequency.

Giovanni

Re: STM32F303K8 and SysTick timer

Posted: Sun Jan 31, 2021 8:05 pm
by Apache
I use the 20.3.X branch on the github repo.

The defines STM_ST_USE_TIMX are available for timers 2 to 5, 9 to 14, 21 and 22. On my MCU I have timers 1 to 3, 6, 7 and1 5 to 17, and I already use timers 1 to 3.

Thanks for the fast answer and the tip about tickless mode!

Re: STM32F303K8 and SysTick timer

Posted: Sun Jan 31, 2021 8:10 pm
by Giovanni
Only timers 2 and 5 are 32 bits wide, which is convenient for tick-less mode. In ticked mode all timers are free to use.

Giovanni

Re: STM32F303K8 and SysTick timer

Posted: Fri Feb 05, 2021 8:59 pm
by Apache
Using ticked mode worked fine! :D

Just to clarify, why are some 16 bits timers available and others aren't in tickless mode?

Re: STM32F303K8 and SysTick timer

Posted: Fri Feb 05, 2021 9:02 pm
by Giovanni
Because the driver is not necessarily complete, if I remember well some more timers have been added in repository code.

Giovanni

Re: STM32F303K8 and SysTick timer

Posted: Sat Feb 06, 2021 1:56 am
by FXCoder
Hi,
As Giovanni noted if you use trunk it has TIM15-17 implemented.
Porting the extra TIM updates back into 20.3.x can be done.
There is also a bug fix needed in 20.3.x for ALARMS handling (wrong indexing of callbacks) which is already fixed in trunk.
--
Bob

Re: STM32F303K8 and SysTick timer

Posted: Thu Feb 18, 2021 7:23 am
by FXCoder
Hi Giovanni,
Patch for 20.3.x hal_st_lld
1. Include TIM-15-17
2. Update use of STM32_ST_OVERRIDE_ALARMS
For your review - not tested ATM.
--
Bob