Skip to content

Commit bc5c945

Browse files
mmahadevan1080xc0170
authored andcommitted
MCUXpresso: Fix LPTimer issue when using multiple timeout objects
Fix for Issue #5150 Signed-off-by: Mahadevan Mahesh <[email protected]>
1 parent e1090ca commit bc5c945

File tree

1 file changed

+10
-0
lines changed
  • targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/api

1 file changed

+10
-0
lines changed

targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/api/lp_ticker.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,11 @@ void lp_ticker_set_interrupt(timestamp_t timestamp)
139139

140140
/* Checking if LPTRM can handle this sleep */
141141
delta_ticks = USEC_TO_COUNT(delta_us, CLOCK_GetFreq(kCLOCK_Er32kClk));
142+
if (delta_ticks == 0) {
143+
/* The requested delay is less than the minimum resolution of this counter */
144+
delta_ticks = 1;
145+
}
146+
142147
if (delta_ticks > MAX_LPTMR_SLEEP) {
143148
/* Using RTC if wait time is over 16b (2s @32kHz) */
144149
uint32_t delta_sec;
@@ -154,6 +159,11 @@ void lp_ticker_set_interrupt(timestamp_t timestamp)
154159
/* Set aditional, subsecond, sleep time */
155160
if (delta_us) {
156161
lptmr_schedule = USEC_TO_COUNT(delta_us, CLOCK_GetFreq(kCLOCK_Er32kClk));
162+
if (lptmr_schedule == 0) {
163+
/* The requested delay is less than the minimum resolution of this counter */
164+
lptmr_schedule = 1;
165+
}
166+
157167
}
158168
} else {
159169
/* Below RTC resolution using LPTMR */

0 commit comments

Comments
 (0)