diff --git a/targets/TARGET_Freescale/TARGET_KLXX/us_ticker.c b/targets/TARGET_Freescale/TARGET_KLXX/us_ticker.c index c29c624552..80137b5f1b 100644 --- a/targets/TARGET_Freescale/TARGET_KLXX/us_ticker.c +++ b/targets/TARGET_Freescale/TARGET_KLXX/us_ticker.c @@ -185,13 +185,14 @@ static void lptmr_isr(void) { } void us_ticker_set_interrupt(timestamp_t timestamp) { - int delta = (int)((uint32_t)timestamp - us_ticker_read()); + uint32_t tcur = us_ticker_read(); + int delta = (int)((uint32_t)timestamp - tcur); if (delta <= 0) { - // This event was in the past: - us_ticker_irq_handler(); - return; - } - + // This event was in the past. Force it into the very near + // future instead. + timestamp = tcur + 2; + } + us_ticker_int_counter = (uint32_t)(delta >> 16); us_ticker_int_remainder = (uint16_t)(0xFFFF & delta); if (us_ticker_int_counter > 0) {