STM32F303K8 and SysTick timer

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderators: RoccoMarco, barthess

Apache
Posts: 11
Joined: Sat Jan 30, 2021 7:31 pm
Has thanked: 1 time
Been thanked: 1 time

STM32F303K8 and SysTick timer

Postby Apache » Sun Jan 31, 2021 6:50 pm

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?

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: STM32F303K8 and SysTick timer

Postby Giovanni » Sun Jan 31, 2021 7:14 pm

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

Apache
Posts: 11
Joined: Sat Jan 30, 2021 7:31 pm
Has thanked: 1 time
Been thanked: 1 time

Re: STM32F303K8 and SysTick timer

Postby Apache » Sun Jan 31, 2021 8:05 pm

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!

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: STM32F303K8 and SysTick timer

Postby Giovanni » Sun Jan 31, 2021 8:10 pm

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

Apache
Posts: 11
Joined: Sat Jan 30, 2021 7:31 pm
Has thanked: 1 time
Been thanked: 1 time

Re: STM32F303K8 and SysTick timer

Postby Apache » Fri Feb 05, 2021 8:59 pm

Using ticked mode worked fine! :D

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

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: STM32F303K8 and SysTick timer

Postby Giovanni » Fri Feb 05, 2021 9:02 pm

Because the driver is not necessarily complete, if I remember well some more timers have been added in repository code.

Giovanni

User avatar
FXCoder
Posts: 384
Joined: Sun Jun 12, 2016 4:10 am
Location: Sydney, Australia
Has thanked: 180 times
Been thanked: 130 times

Re: STM32F303K8 and SysTick timer

Postby FXCoder » Sat Feb 06, 2021 1:56 am

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

User avatar
FXCoder
Posts: 384
Joined: Sun Jun 12, 2016 4:10 am
Location: Sydney, Australia
Has thanked: 180 times
Been thanked: 130 times

Re: STM32F303K8 and SysTick timer

Postby FXCoder » Thu Feb 18, 2021 7:23 am

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
Attachments
20_3_x_hal_st_lld_patch.zip
(2.23 KiB) Downloaded 133 times


Return to “STM32 Support”

Who is online

Users browsing this forum: No registered users and 18 guests