This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How is timing components of OSAL and BLE stack of CC254x is connected?

Other Parts Discussed in Thread: CC2538

How does BLE stack know the next timeout is going to happen? osalTimerUpdate is called but osal_next_timeout is not called from anywhere..

BTW: Why there is no consistency in naming? Even in same module? Such as: osalTimerUpdate osal_next_timeout, two different naming conventions..

  • The relation is through osal_run_system(), osal_pwrmgr_powerconserve() and tasksEvents[idx]

    On the side note: osalTimerUpdate() is not directly related to osal_next_timeout().
    Generally speaking, osal_next_timeout() related to invoking scheduled tasks, while osalTimerUpdate()
    updates system tick which is out of sync after system is brought back from lower power modes.
  • Thank you.. But if you undefine POWER_SAVING, osal_pwrmgr_powerconserve() is dropped.

    I found how it is syncronized.. In osal_run_system() the following exists:

    #ifndef HAL_BOARD_CC2538
    osalTimeUpdate();
    #endif

    I accidentally dropped the block as my board is not CC2538, however it is #ifndef.. This is why I strongly discourage use of macros, and prefer C++ with inline functions..

    osalTimeUpdate calculates passed milliseconds and calls osalTimerUpdate which updates the timers.. I also strongly discourage single character difference in naming.. TI developers need really good lesson on coding standards..

    If sleep is enabled, halSleep is called with calculated timeout..

    What about sleep timer interrupt routine? Is it defined in bluetooth stack?
  • Oh sorry.. I found it as well..

    halSleepTimerIsr in hal_sleep.c handles sleep timer timeout..
  • Glad you found your way through.

    I my self prefer objects, but we both stuck with what we have to work with. Life is tough, we just trying make it a bit easier to deal with ;)