-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
High
-
SITSW-9089
-
11.02.00
-
11.02.00
-
- `ClockP_usleep()` uses `ClockP_getTimeUsec()` to fetch the current time for
implementing microsecond delays. - `ClockP_getTimeUsec()` returns the sum of elapsed ticks (multiplied by `usec_per_tick`) and the current timer count converted to microseconds.
- Before the FreeRTOS scheduler starts, `ClockP_timerTickIsr` does not run, so
`gClockCtrl.ticks` remains zero. - In this state, `ClockP_getTimeUsec()` only reflects the timer count, which wraps around within a limited range (e.g., 0–1000 usec for a 1ms tick).
- If `ClockP_usleep()` is called with a `curTime` near the wrap boundary
(e.g., `curTime=900`, `usec=200`), the computed `endTime = curTime + usec`
(e.g., 1100) exceeds the timer's maximum range. - After the timer wraps, `curTime` becomes less than `endTime`, causing the
busy-wait loop (`while (curTime < endTime)`) to never exit, resulting in an infinite loop