This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

working with s132 and app_timer but timing is not always good

hello Nordic 

i am working with nrf52832, sdk 16.0 s132

1. i see when i use the app_time i have to initialize it using this line of code :

static void lfclk_request(void)
{
    ret_code_t err_code = nrf_drv_clock_init();
    APP_ERROR_CHECK(err_code);
    nrf_drv_clock_lfclk_request(NULL);
}

though i thought and read that the softdevice activates the LFCLK

so why do i need to use this lines of code (if i don't then the timer does not work and the handler is not called ), why is that ?

2. when i use the handler just to toggle a led each second APP_TIMER_TICKS(1000) i see that when ble scan is not working the timing looks like one second but when i use the code with the ble scan the blinking is not right it blinks but week and not in intervals of 1 second, why is that ? 

3. how can i set scan to scan all the time, like its interval is = 0 ? i use the central app_ble_blinky example and i could not find yet what veritable controls this ?

best regards

Ziv

Parents
  • Hello,

    1. As you say, it shouldn't be necessary to activate the LFCLK as the Softdevice should do that already. Are you testing this on a custom or third-party board? In that case, make sure you have selected an appropriate clock source in sdk_config.h (see NRF_SDH_CLOCK_LF_SRC). Not all boards have the optional 32 KHz crystal mounted.

    2. Is there anything else in your application that might try to control the same LED? The BSP maybe (BSP indication states)?

    3. Scanning will be active 100% of the time if you set SCAN_WINDOW=SCAN_INTERVAL

    Best regards,

    Vidar

  • hi Vidar

    1. the NRF_SDH_CLOCK_LF_SRC is set to -> 0 (if i understand correct it means i am using the nrf52832's LFCLK)

    and also on the same board i run another app that also had s132 and app_timer and i did not need to add this lines of code (maybe it is done by some other module )

    2. no there is no other change for the ble pin in the code

    best regards

    Ziv 

Reply Children
Related