ClockP_usleep() getting into infinite loop due to timer wraparound

XMLWordPrintable

    • Type: Bug
    • Resolution: Unresolved
    • Priority: High
    • SITSW-9089
    • 11.02.00
    • 11.02.00
    • Hide
      am62xx-sk
      am62a-sk
      am62p-sk
      am62d-evm
      am62l-evm
      am275x-evm
      Show
      am62xx-sk am62a-sk am62p-sk am62d-evm am62l-evm am275x-evm

      • `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

            Assignee:
            TI User
            Reporter:
            TI User
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:

                Connection: Intermediate to External PROD System
                EXTSYNC-6146 - ClockP_usleep() getting into infini...
                SYNCHRONIZED
                • Last Sync Date: