Skip to content

Commit 72de85c

Browse files
authored
Merge pull request #4417 from monkiineko/master
STM32: Fix 32-bit us ticker interrupt scheduling
2 parents 3c3e35d + 260378e commit 72de85c

File tree

49 files changed

+52
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+52
-0
lines changed

targets/TARGET_STM/TARGET_STM32F0/TARGET_DISCO_F051R8/device/hal_tick.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#endif
4141

4242
#include "stm32f0xx.h"
43+
#include "stm32f0xx_ll_tim.h"
4344
#include "cmsis_nvic.h"
4445

4546
#define TIM_MST TIM1

targets/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F030R8/device/hal_tick.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#endif
4141

4242
#include "stm32f0xx.h"
43+
#include "stm32f0xx_ll_tim.h"
4344
#include "cmsis_nvic.h"
4445

4546
#define TIM_MST TIM1

targets/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F031K6/device/hal_tick.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ extern "C" {
4040
#endif
4141

4242
#include "stm32f0xx.h"
43+
#include "stm32f0xx_ll_tim.h"
4344
#include "cmsis_nvic.h"
4445

4546
#define TIM_MST TIM2

targets/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F042K6/device/hal_tick.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ extern "C" {
4040
#endif
4141

4242
#include "stm32f0xx.h"
43+
#include "stm32f0xx_ll_tim.h":
4344
#include "cmsis_nvic.h"
4445

4546
#define TIM_MST TIM2

targets/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F070RB/device/hal_tick.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#endif
4141

4242
#include "stm32f0xx.h"
43+
#include "stm32f0xx_ll_tim.h"
4344
#include "cmsis_nvic.h"
4445

4546
#define TIM_MST TIM1

targets/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F072RB/device/hal_tick.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#endif
4141

4242
#include "stm32f0xx.h"
43+
#include "stm32f0xx_ll_tim.h"
4344
#include "cmsis_nvic.h"
4445

4546
#define TIM_MST TIM2

targets/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F091RC/device/hal_tick.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#endif
4141

4242
#include "stm32f0xx.h"
43+
#include "stm32f0xx_ll_tim.h"
4344
#include "cmsis_nvic.h"
4445

4546
#define TIM_MST TIM2

targets/TARGET_STM/TARGET_STM32F1/TARGET_BLUEPILL_F103C8/device/hal_tick.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#endif
4141

4242
#include "stm32f1xx.h"
43+
#include "stm32f1xx_ll_tim.h"
4344
#include "cmsis_nvic.h"
4445

4546
#define TIM_MST TIM4

targets/TARGET_STM/TARGET_STM32F1/TARGET_DISCO_F100RB/device/hal_tick.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#endif
4141

4242
#include "stm32f1xx.h"
43+
#include "stm32f1xx_ll_tim.h"
4344
#include "cmsis_nvic.h"
4445

4546
#define TIM_MST TIM4

targets/TARGET_STM/TARGET_STM32F1/TARGET_NUCLEO_F103RB/device/hal_tick.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#endif
4141

4242
#include "stm32f1xx.h"
43+
#include "stm32f1xx_ll_tim.h"
4344
#include "cmsis_nvic.h"
4445

4546
#define TIM_MST TIM4

targets/TARGET_STM/TARGET_STM32F2/TARGET_NUCLEO_F207ZG/device/hal_tick.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ extern "C" {
4040
#endif
4141

4242
#include "stm32f2xx.h"
43+
#include "stm32f2xx_ll_tim.h"
4344
#include "cmsis_nvic.h"
4445

4546
#define TIM_MST TIM5

targets/TARGET_STM/TARGET_STM32F3/TARGET_STM32F302x8/device/hal_tick.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#endif
4141

4242
#include "stm32f3xx.h"
43+
#include "stm32f3xx_ll_tim.h"
4344
#include "cmsis_nvic.h"
4445

4546
#define TIM_MST TIM2

targets/TARGET_STM/TARGET_STM32F3/TARGET_STM32F303x8/device/hal_tick.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#endif
4141

4242
#include "stm32f3xx.h"
43+
#include "stm32f3xx_ll_tim.h"
4344
#include "cmsis_nvic.h"
4445

4546
#define TIM_MST TIM2

targets/TARGET_STM/TARGET_STM32F3/TARGET_STM32F303xC/device/hal_tick.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#endif
4141

4242
#include "stm32f3xx.h"
43+
#include "stm32f3xx_ll_tim.h"
4344
#include "cmsis_nvic.h"
4445

4546
#define TIM_MST TIM2

targets/TARGET_STM/TARGET_STM32F3/TARGET_STM32F303xE/device/hal_tick.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#endif
4141

4242
#include "stm32f3xx.h"
43+
#include "stm32f3xx_ll_tim.h"
4344
#include "cmsis_nvic.h"
4445

4546
#define TIM_MST TIM2

targets/TARGET_STM/TARGET_STM32F3/TARGET_STM32F334x8/device/hal_tick.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#endif
4141

4242
#include "stm32f3xx.h"
43+
#include "stm32f3xx_ll_tim.h"
4344
#include "cmsis_nvic.h"
4445

4546
#define TIM_MST TIM2

targets/TARGET_STM/TARGET_STM32F4/TARGET_MTS_DRAGONFLY_F411RE/device/hal_tick.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#endif
4141

4242
#include "stm32f4xx.h"
43+
#include "stm32f4xx_ll_tim.h"
4344
#include "cmsis_nvic.h"
4445

4546
#define TIM_MST TIM5

targets/TARGET_STM/TARGET_STM32F4/TARGET_MTS_MDOT_F405RG/device/hal_tick.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#endif
4141

4242
#include "stm32f4xx.h"
43+
#include "stm32f4xx_ll_tim.h"
4344
#include "cmsis_nvic.h"
4445

4546
#define TIM_MST TIM5

targets/TARGET_STM/TARGET_STM32F4/TARGET_MTS_MDOT_F411RE/device/hal_tick.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#endif
4141

4242
#include "stm32f4xx.h"
43+
#include "stm32f4xx_ll_tim.h"
4344
#include "cmsis_nvic.h"
4445

4546
#define TIM_MST TIM5

targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F401xC/device/hal_tick.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#endif
4141

4242
#include "stm32f4xx.h"
43+
#include "stm32f4xx_ll_tim.h"
4344
#include "cmsis_nvic.h"
4445

4546
#define TIM_MST TIM5

targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F401xE/device/hal_tick.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#endif
4141

4242
#include "stm32f4xx.h"
43+
#include "stm32f4xx_ll_tim.h"
4344
#include "cmsis_nvic.h"
4445

4546
#define TIM_MST TIM5

targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F407xG/device/hal_tick.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#endif
4141

4242
#include "stm32f4xx.h"
43+
#include "stm32f4xx_ll_tim.h"
4344
#include "cmsis_nvic.h"
4445

4546
#define TIM_MST TIM5

targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F410xB/device/hal_tick.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#endif
4141

4242
#include "stm32f4xx.h"
43+
#include "stm32f4xx_ll_tim.h"
4344
#include "cmsis_nvic.h"
4445

4546
#define TIM_MST TIM5

targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F411xE/device/hal_tick.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#endif
4141

4242
#include "stm32f4xx.h"
43+
#include "stm32f4xx_ll_tim.h"
4344
#include "cmsis_nvic.h"
4445

4546
#define TIM_MST TIM5

targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F412xG/device/hal_tick.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#endif
4141

4242
#include "stm32f4xx.h"
43+
#include "stm32f4xx_ll_tim.h"
4344
#include "cmsis_nvic.h"
4445

4546
#define TIM_MST TIM5

targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F429xI/device/hal_tick.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#endif
4141

4242
#include "stm32f4xx.h"
43+
#include "stm32f4xx_ll_tim.h"
4344
#include "cmsis_nvic.h"
4445

4546
#define TIM_MST TIM5

targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F437xG/device/hal_tick.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#endif
4141

4242
#include "stm32f4xx.h"
43+
#include "stm32f4xx_ll_tim.h"
4344
#include "cmsis_nvic.h"
4445

4546
#define TIM_MST TIM5

targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F439xI/device/hal_tick.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#endif
4141

4242
#include "stm32f4xx.h"
43+
#include "stm32f4xx_ll_tim.h"
4344
#include "cmsis_nvic.h"
4445

4546
#define TIM_MST TIM5

targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F446xE/device/hal_tick.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#endif
4141

4242
#include "stm32f4xx.h"
43+
#include "stm32f4xx_ll_tim.h"
4344
#include "cmsis_nvic.h"
4445

4546
#define TIM_MST TIM5

targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F469xI/device/hal_tick.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#endif
4141

4242
#include "stm32f4xx.h"
43+
#include "stm32f4xx_ll_tim.h"
4344
#include "cmsis_nvic.h"
4445

4546
#define TIM_MST TIM2

targets/TARGET_STM/TARGET_STM32F4/TARGET_UBLOX_EVK_ODIN_W2/device/hal_tick.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#endif
4141

4242
#include "stm32f4xx.h"
43+
#include "stm32f4xx_ll_tim.h"
4344
#include "cmsis_nvic.h"
4445

4546
#define TIM_MST TIM5

targets/TARGET_STM/TARGET_STM32F7/TARGET_STM32F746xG/device/hal_tick.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#endif
4141

4242
#include "stm32f7xx.h"
43+
#include "stm32f7xx_ll_tim.h"
4344
#include "cmsis_nvic.h"
4445

4546
#define TIM_MST TIM5

targets/TARGET_STM/TARGET_STM32F7/TARGET_STM32F756xG/device/hal_tick.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#endif
4141

4242
#include "stm32f7xx.h"
43+
#include "stm32f7xx_ll_tim.h"
4344
#include "cmsis_nvic.h"
4445

4546
#define TIM_MST TIM5

targets/TARGET_STM/TARGET_STM32F7/TARGET_STM32F767xI/device/hal_tick.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#endif
4141

4242
#include "stm32f7xx.h"
43+
#include "stm32f7xx_ll_tim.h"
4344
#include "cmsis_nvic.h"
4445

4546
#define TIM_MST TIM5

targets/TARGET_STM/TARGET_STM32F7/TARGET_STM32F769xI/device/hal_tick.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#endif
4141

4242
#include "stm32f7xx.h"
43+
#include "stm32f7xx_ll_tim.h"
4344
#include "cmsis_nvic.h"
4445

4546
#define TIM_MST TIM5

targets/TARGET_STM/TARGET_STM32L0/TARGET_DISCO_L053C8/device/hal_tick.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#endif
4141

4242
#include "stm32l0xx.h"
43+
#include "stm32l0xx_ll_tim.h"
4344
#include "cmsis_nvic.h"
4445

4546
#define TIM_MST TIM21

targets/TARGET_STM/TARGET_STM32L0/TARGET_DISCO_L072CZ_LRWAN1/device/hal_tick.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#endif
4141

4242
#include "stm32l0xx.h"
43+
#include "stm32l0xx_ll_tim.h"
4344
#include "cmsis_nvic.h"
4445

4546
#define TIM_MST TIM21

targets/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L011K4/device/hal_tick.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#endif
4141

4242
#include "stm32l0xx.h"
43+
#include "stm32l0xx_ll_tim.h"
4344
#include "cmsis_nvic.h"
4445

4546
#define TIM_MST TIM21

targets/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L031K6/device/hal_tick.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#endif
4141

4242
#include "stm32l0xx.h"
43+
#include "stm32l0xx_ll_tim.h"
4344
#include "cmsis_nvic.h"
4445

4546
#define TIM_MST TIM21

targets/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L053R8/device/hal_tick.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#endif
4141

4242
#include "stm32l0xx.h"
43+
#include "stm32l0xx_ll_tim.h"
4344
#include "cmsis_nvic.h"
4445

4546
#define TIM_MST TIM21

targets/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L073RZ/device/hal_tick.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#endif
4141

4242
#include "stm32l0xx.h"
43+
#include "stm32l0xx_ll_tim.h"
4344
#include "cmsis_nvic.h"
4445

4546
#define TIM_MST TIM21

targets/TARGET_STM/TARGET_STM32L1/TARGET_MOTE_L152RC/device/hal_tick.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#endif
4141

4242
#include "stm32l1xx.h"
43+
#include "stm32l1xx_ll_tim.h"
4344
#include "cmsis_nvic.h"
4445

4546
#define TIM_MST TIM5

targets/TARGET_STM/TARGET_STM32L1/TARGET_NUCLEO_L152RE/device/hal_tick.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#endif
4141

4242
#include "stm32l1xx.h"
43+
#include "stm32l1xx_ll_tim.h"
4344
#include "cmsis_nvic.h"
4445

4546
#define TIM_MST TIM5

targets/TARGET_STM/TARGET_STM32L1/TARGET_NZ32_SC151/device/hal_tick.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#endif
4141

4242
#include "stm32l1xx.h"
43+
#include "stm32l1xx_ll_tim.h"
4344
#include "cmsis_nvic.h"
4445

4546
#define TIM_MST TIM5

targets/TARGET_STM/TARGET_STM32L1/TARGET_XDOT_L151CC/device/hal_tick.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#endif
4141

4242
#include "stm32l1xx.h"
43+
#include "stm32l1xx_ll_tim.h"
4344
#include "cmsis_nvic.h"
4445

4546
#define TIM_MST TIM5

targets/TARGET_STM/TARGET_STM32L4/TARGET_STM32L432xC/device/hal_tick.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#endif
4141

4242
#include "stm32l4xx.h"
43+
#include "stm32l4xx_ll_tim.h"
4344
#include "cmsis_nvic.h"
4445

4546
#define TIM_MST TIM2

targets/TARGET_STM/TARGET_STM32L4/TARGET_STM32L476xG/device/hal_tick.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#endif
4141

4242
#include "stm32l4xx.h"
43+
#include "stm32l4xx_ll_tim.h"
4344
#include "cmsis_nvic.h"
4445

4546
#define TIM_MST TIM5

targets/TARGET_STM/TARGET_STM32L4/TARGET_STM32L486xG/device/hal_tick.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#endif
4141

4242
#include "stm32l4xx.h"
43+
#include "stm32l4xx_ll_tim.h"
4344
#include "cmsis_nvic.h"
4445

4546
#define TIM_MST TIM5

targets/TARGET_STM/us_ticker_32b.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ void us_ticker_set_interrupt(timestamp_t timestamp)
4848
__HAL_TIM_SET_COMPARE(&TimMasterHandle, TIM_CHANNEL_1, (uint32_t)timestamp);
4949
// Enable IT
5050
__HAL_TIM_ENABLE_IT(&TimMasterHandle, TIM_IT_CC1);
51+
// Check if timestamp has already passed, and if so, set the event immediately
52+
if ((int32_t)(timestamp - TIM_MST->CNT) <= 0) {
53+
LL_TIM_GenerateEvent_CC1(TimMasterHandle.Instance);
54+
}
5155
}
5256

5357
void us_ticker_disable_interrupt(void)

0 commit comments

Comments
 (0)