Skip to content

Commit 4a1ebfa

Browse files
ioannisgnashif
authored andcommitted
drivers: timer: SysTick: revert clearing pending events
Clearing the pending IRQs when resetting the timeout fixes the forward time drifting, but the change needs more investigation until we are sure this won't break kernel time management. Reverting the change to get 1.14 release out. This reverts commit 2895da0. Signed-off-by: Ioannis Glaropoulos <[email protected]>
1 parent 34f3837 commit 4a1ebfa

File tree

1 file changed

+0
-16
lines changed

1 file changed

+0
-16
lines changed

drivers/timer/cortex_m_systick.c

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -147,22 +147,6 @@ void z_clock_set_timeout(s32_t ticks, bool idle)
147147
SysTick->LOAD = last_load - 1;
148148
SysTick->VAL = 0; /* resets timer to last_load */
149149

150-
/*
151-
* In the unlucky scenario of a SysTick event (wrap) occurring
152-
* while we re-program the last_load value, the SysTick ISR
153-
* will run immediately after we unlock interrupts. In that
154-
* case the timeout we have just configured will expire
155-
* instantaneously, leading to operations being executed
156-
* much earlier than expected. Avoid this by clearing possibly
157-
* pending SysTick exceptions (writing 1 to ICSR.PENDSTCLR).
158-
*
159-
* Side effect: any operations that were scheduled to execute
160-
* upon the expiration of the timeout we may be canceling (by
161-
* writing PENDSTCLR to 1) will be postponed, until the new
162-
* timeout (i.e. the one we are programming now) expires.
163-
*/
164-
SCB->ICSR |= SCB_ICSR_PENDSTCLR_Msk;
165-
166150
k_spin_unlock(&lock, key);
167151
#endif
168152
}

0 commit comments

Comments
 (0)