Skip to content

Commit 2454dc5

Browse files
committed
Merge pull request ARMmbed#1646 from c1728p9/fix_timer
Prevent recursive processing of us_ticker in FSL
2 parents 47c580b + 9fd3e09 commit 2454dc5

File tree

1 file changed

+5
-2
lines changed
  • libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KPSDK_MCUS

1 file changed

+5
-2
lines changed

libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KPSDK_MCUS/us_ticker.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,11 @@ void us_ticker_clear_interrupt(void) {
6868
void us_ticker_set_interrupt(timestamp_t timestamp) {
6969
int delta = (int)(timestamp - us_ticker_read());
7070
if (delta <= 0) {
71-
// This event was in the past:
72-
us_ticker_irq_handler();
71+
// This event was in the past.
72+
// Set the interrupt as pending, but don't process it here.
73+
// This prevents a recurive loop under heavy load
74+
// which can lead to a stack overflow.
75+
NVIC_SetPendingIRQ(PIT3_IRQn);
7376
return;
7477
}
7578

0 commit comments

Comments
 (0)