diff --git a/os/hal/platforms/STM32/gpt_lld.c b/os/hal/platforms/STM32/gpt_lld.c index 8acaa71d4..e9a879124 100644 --- a/os/hal/platforms/STM32/gpt_lld.c +++ b/os/hal/platforms/STM32/gpt_lld.c @@ -203,7 +203,7 @@ CH_IRQ_HANDLER(TIM5_IRQHandler) { * * @isr */ -CH_IRQ_HANDLER(TIM8_IRQHandler) { +CH_IRQ_HANDLER(TIM8_UP_IRQHandler) { CH_IRQ_PROLOGUE(); diff --git a/os/hal/platforms/STM32/icu_lld.c b/os/hal/platforms/STM32/icu_lld.c index 37390253c..4767c493a 100644 --- a/os/hal/platforms/STM32/icu_lld.c +++ b/os/hal/platforms/STM32/icu_lld.c @@ -135,11 +135,28 @@ CH_IRQ_HANDLER(TIM1_CC_IRQHandler) { CH_IRQ_EPILOGUE(); } + +/** + * @brief TIM1 compare interrupt handler. + * @note It is assumed that the various sources are only activated if the + * associated callback pointer is not equal to @p NULL in order to not + * perform an extra check in a potentially critical interrupt handler. + * + * @isr + */ +CH_IRQ_HANDLER(TIM1_UP_IRQHandler) { + + CH_IRQ_PROLOGUE(); + + icu_lld_serve_interrupt(&ICUD1); + + CH_IRQ_EPILOGUE(); +} #endif /* STM32_ICU_USE_TIM1 */ #if STM32_ICU_USE_TIM2 /** - * @brief TIM2 compare interrupt handler. + * @brief TIM2 interrupt handler. * @note It is assumed that the various sources are only activated if the * associated callback pointer is not equal to @p NULL in order to not * perform an extra check in a potentially critical interrupt handler. @@ -158,7 +175,7 @@ CH_IRQ_HANDLER(TIM2_IRQHandler) { #if STM32_ICU_USE_TIM3 /** - * @brief TIM3 compare interrupt handler. + * @brief TIM3 interrupt handler. * @note It is assumed that the various sources are only activated if the * associated callback pointer is not equal to @p NULL in order to not * perform an extra check in a potentially critical interrupt handler. @@ -177,7 +194,7 @@ CH_IRQ_HANDLER(TIM3_IRQHandler) { #if STM32_ICU_USE_TIM4 /** - * @brief TIM4 compare interrupt handler. + * @brief TIM4 interrupt handler. * @note It is assumed that the various sources are only activated if the * associated callback pointer is not equal to @p NULL in order to not * perform an extra check in a potentially critical interrupt handler. @@ -196,7 +213,7 @@ CH_IRQ_HANDLER(TIM4_IRQHandler) { #if STM32_ICU_USE_TIM5 /** - * @brief TIM5 compare interrupt handler. + * @brief TIM5 interrupt handler. * @note It is assumed that the various sources are only activated if the * associated callback pointer is not equal to @p NULL in order to not * perform an extra check in a potentially critical interrupt handler. @@ -230,6 +247,23 @@ CH_IRQ_HANDLER(TIM8_CC_IRQHandler) { CH_IRQ_EPILOGUE(); } + +/** + * @brief TIM8 compare interrupt handler. + * @note It is assumed that the various sources are only activated if the + * associated callback pointer is not equal to @p NULL in order to not + * perform an extra check in a potentially critical interrupt handler. + * + * @isr + */ +CH_IRQ_HANDLER(TIM8_UP_IRQHandler) { + + CH_IRQ_PROLOGUE(); + + icu_lld_serve_interrupt(&ICUD8); + + CH_IRQ_EPILOGUE(); +} #endif /* STM32_ICU_USE_TIM8 */ /*===========================================================================*/ @@ -298,6 +332,8 @@ void icu_lld_start(ICUDriver *icup) { rccResetTIM1(); nvicEnableVector(TIM1_CC_IRQn, CORTEX_PRIORITY_MASK(STM32_ICU_TIM1_IRQ_PRIORITY)); + nvicEnableVector(TIM1_UP_IRQn, + CORTEX_PRIORITY_MASK(STM32_ICU_TIM1_IRQ_PRIORITY)); icup->clock = STM32_TIMCLK2; } #endif @@ -344,6 +380,8 @@ void icu_lld_start(ICUDriver *icup) { rccResetTIM8(); nvicEnableVector(TIM8_CC_IRQn, CORTEX_PRIORITY_MASK(STM32_ICU_TIM8_IRQ_PRIORITY)); + nvicEnableVector(TIM8_UP_IRQn, + CORTEX_PRIORITY_MASK(STM32_ICU_TIM1_IRQ_PRIORITY)); icup->clock = STM32_TIMCLK2; } #endif @@ -403,6 +441,7 @@ void icu_lld_stop(ICUDriver *icup) { #if STM32_ICU_USE_TIM1 if (&ICUD1 == icup) { nvicDisableVector(TIM1_CC_IRQn); + nvicDisableVector(TIM1_UP_IRQn); rccDisableTIM1(FALSE); } #endif @@ -434,6 +473,7 @@ void icu_lld_stop(ICUDriver *icup) { #if STM32_ICU_USE_TIM8 if (&ICUD8 == icup) { nvicDisableVector(TIM8_CC_IRQn); + nvicDisableVector(TIM8_UP_IRQn); rccDisableTIM8(FALSE); } #endif diff --git a/os/hal/platforms/STM32/stm32.h b/os/hal/platforms/STM32/stm32.h index 8d571554e..eaa8ba866 100644 --- a/os/hal/platforms/STM32/stm32.h +++ b/os/hal/platforms/STM32/stm32.h @@ -56,18 +56,37 @@ defined(STM32F10X_XL) || defined(STM32F10X_CL) || \ defined(__DOXYGEN__) #include "stm32f10x.h" + +/* Resolving naming anomalies related to the STM32F1xx sub-family.*/ +#define CAN1_TX_IRQn USB_HP_CAN1_TX_IRQn +#define CAN1_RX0_IRQn USB_LP_CAN1_RX0_IRQn +#if defined(STM32F10X_XL) +#define TIM1_UP_IRQn TIM1_UP_TIM16_IRQn +#define TIM8_UP_IRQn TIM8_UP_TIM13_IRQn +#elif defined(STM32F10X_LD_VL) || defined(STM32F10X_MD_VL) || \ + defined(STM32F10X_HD_VL) +#define TIM1_UP_IRQn TIM1_UP_TIM16_IRQn #endif -#if defined(STM32F2XX) || defined(__DOXYGEN__) +#elif defined(STM32F2XX) #include "stm32f2xx.h" -#endif -#if defined(STM32F4XX) || defined(__DOXYGEN__) +/* Resolving naming anomalies related to the STM32F2xx sub-family.*/ +#define TIM1_UP_IRQn TIM1_UP_TIM10_IRQn +#define TIM8_UP_IRQn TIM8_UP_TIM13_IRQn + +#elif defined(STM32F4XX) #include "stm32f4xx.h" -#endif -#if defined(STM32L1XX_MD) || defined(__DOXYGEN__) +/* Resolving naming anomalies related to the STM32F4xx sub-family.*/ +#define TIM1_UP_IRQn TIM1_UP_TIM10_IRQn +#define TIM8_UP_IRQn TIM8_UP_TIM13_IRQn + +#elif defined(STM32L1XX_MD) #include "stm32l1xx.h" + +#else +#error "STM32 device not specified" #endif /*===========================================================================*/ diff --git a/readme.txt b/readme.txt index ac8ca767f..005e9dc72 100644 --- a/readme.txt +++ b/readme.txt @@ -79,6 +79,9 @@ ***************************************************************************** *** 2.4.2 *** +- FIX: Fixed TIM8 not working in STM32 GPT driver (bug 3536523). +- FIX: Fixed timer overflow not working in STM32 ICU driver for TIM1/TIM8 (bug + 3536522). - FIX: Fixed wrong DMA channels on USART2 in STM32F10X_MD_VL devices (bug 3536070). - FIX: Fixed issue with DMA channel init in STM32 ADC and SPI drivers (bug