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.

Replacement for osal_getClock function in BLE Stack 2.0 on CC2650

Other Parts Discussed in Thread: CC2540, CC2650, CC2640

Hy there,

when porting an application from CC2540 to CC2650 I try to find a replacement for the OSAL function osal_getClock. Is there any implemented way to get the system time? Or do I need to implement my own time base?

Regards

Harald

  • Hi Harald,

    For CC2640, you can use the driverlib AON_RTC functions to access the RTC. See aon_rtc.h.

    Best wishes
  • Thanks for the quick response. Is there any documentation available?
    Apparently, I can call the AONRTCSecGet() function immediately, without any initialisation.
    To get the getClock / setClock functionality I created the following functions:
    static uint32_t rtcTimeCorrection = 0;
    uint32_t getClock(void)
    {
    return AONRTCSecGet() + rtcTimeCorrection ;
    }
    uint32_t setClock(uint32_t now)
    {
    rtcTimeCorrection = now - AONRTCSecGet();
    return rtcTimeCorrection ;
    }
    When I try to manipulate the current RTC time with HWREG(AON_RTC_BASE + AON_RTC_O_SEC) = value my application stops working...
    Best regards
    Harald
  • You should definitely not be manipulating the RTC as this is the clock used for the RTOS. I would recommend using the Clock_getTicks() function which should read from the RTC. This is documented in the SYS/BIOS API Documentation included with the RTOS install at ti->sysbois->knl->clock

    file:///C:/ti/tirtos_simplelink_2_11_01_09/products/bios_6_41_02_41/docs/cdoc/index.html