diff --git a/os/hal/ports/STM32/STM32G0xx/hal_lld.h b/os/hal/ports/STM32/STM32G0xx/hal_lld.h index 9e5587d1f..d7a2403cc 100644 --- a/os/hal/ports/STM32/STM32G0xx/hal_lld.h +++ b/os/hal/ports/STM32/STM32G0xx/hal_lld.h @@ -1514,6 +1514,13 @@ */ #define STM32_TIMCLK2 STM32_TIMPCLK +#if STM32_HAS_TIM1617_ERRATA +/* TIM16 and TIM17 require special handling and checks on some devices, see + the errata: "TIM16 and TIM17 are unduly clocked by SYSCLK".*/ +#define STM32_TIM16CLK hal_lld_get_clock_point(CLK_SYSCLK) +#define STM32_TIM17CLK hal_lld_get_clock_point(CLK_SYSCLK) +#endif + /** * @brief Flash settings. */ diff --git a/os/hal/ports/STM32/STM32G0xx/stm32_registry.h b/os/hal/ports/STM32/STM32G0xx/stm32_registry.h index 0ba9e97df..dfccfce65 100644 --- a/os/hal/ports/STM32/STM32G0xx/stm32_registry.h +++ b/os/hal/ports/STM32/STM32G0xx/stm32_registry.h @@ -90,6 +90,9 @@ #if defined(STM32G070xx) || defined(__DOXYGEN__) +/* Errata attributes.*/ +#define STM32_HAS_TIM1617_ERRATA TRUE + /* ADC attributes.*/ #define STM32_HAS_ADC1 TRUE #define STM32_HAS_ADC2 FALSE @@ -267,6 +270,9 @@ #if defined(STM32G071xx) || defined(STM32G081xx) +/* Errata attributes.*/ +#define STM32_HAS_TIM1617_ERRATA TRUE + /* ADC attributes.*/ #define STM32_HAS_ADC1 TRUE #define STM32_HAS_ADC2 FALSE diff --git a/readme.txt b/readme.txt index 9d14267ef..b5ad982a5 100644 --- a/readme.txt +++ b/readme.txt @@ -76,6 +76,7 @@ *** 20.3.5 *** - FIX: Some MISRA-related fixes. - FIX: Re-opened and fixed bug #1100. +- FIX: Fixed missing TIM16/17 errata handling for STM32G0xx (bug #1226). - FIX: Fixed missing ADC errata handling for STM32G0xx (bug #1225). - FIX: Fixed problem in the HAL I2C fallback driver (bug #1224). - FIX: Fixed GPIOH clock not enabled on STM32L432 (bug #1223).