summaryrefslogtreecommitdiff
path: root/ports/stm32/timer.c
diff options
context:
space:
mode:
authorHerwin Grobben <h.grobben@aemics.nl>2025-02-05 13:58:57 +0100
committerDamien George <damien@micropython.org>2025-04-03 16:10:06 +1100
commit91386b3d56b4ef3bb27af89846c1cc2712f6065f (patch)
tree6f7cdc51cacf76f87e1704cfc02173f24eb133d7 /ports/stm32/timer.c
parent3b948893d827c39c967b0ca17da3e8159eaef176 (diff)
stm32/timer: Use APB2 to calculate timer 20 source frequency.
Signed-off-by: Herwin Grobben <h.grobben@aemics.nl>
Diffstat (limited to 'ports/stm32/timer.c')
-rw-r--r--ports/stm32/timer.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ports/stm32/timer.c b/ports/stm32/timer.c
index acfdbd84e..5c333eb94 100644
--- a/ports/stm32/timer.c
+++ b/ports/stm32/timer.c
@@ -264,8 +264,8 @@ uint32_t timer_get_source_freq(uint32_t tim_id) {
#else
uint32_t source, clk_div;
- if (tim_id == 1 || (8 <= tim_id && tim_id <= 11)) {
- // TIM{1,8,9,10,11} are on APB2
+ if (tim_id == 1 || (8 <= tim_id && tim_id <= 11) || tim_id == 20) {
+ // TIM{1,8,9,10,11,20} are on APB2
#if defined(STM32F0) || defined(STM32G0)
source = HAL_RCC_GetPCLK1Freq();
clk_div = RCC->CFGR & RCC_CFGR_PPRE;