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

How to monitor softdevice internal rc recalibration

To the kind attention of Nordic support team,

I was reading this paragraph from https://infocenter.nordicsemi.com/pdf/S132_SDS_v6.2.pdf

"Extended RC calibration is enabled by default when the RC oscillator is used. In this feature, the SoftDevice as a peripheral can detect if the clock has drifted and then calibrate the RC oscillator if necessary. This calibration is in addition to the periodic calibration. If using only peripheral connections, the periodic calibration can then be configured with a much longer interval as the peripheral will be able to detect and adjust automatically to clock drift and calibrate when required. When the Extended RC calibration is enabled, the SoftDevice as a peripheral will try to increase the receive window if two consecutive packets are not received. If it turns out that the packets were missed due to clock drift, the RC oscillator calibration is started. Extended RC calibration can be disabled using the BLE option API."

I'd be very interested in understanding "how many times" softdevice does detect the clock has drifted. Is there a way I can use somehow a softdevice routine to get an idea about that?

How many times softdevice takes action to re calibrate? Maybe this analysis could give some feedback about the quality of the hardware, and could be interesting to give a look at it.

Is there also an event from the softdevice teling the application, "ok the re calibration has been done"? Is the re calibration effect visible measuring the lfclk? What is a pattern we could expect to see if measuring lfclk during our application running? I have been reading that RC internal needs to be re calibrated about every 8 seconds. Is there a way to stop the re calibration and start it again to compare measurements in different time intervals?

Thank you for your support,

Best regards

Parents
  • Hi

    When using the internal RC oscillator you can edit these defines in sdk_config.h in order to decide how often to calibrate, and what should trig these calibrations. 

    // <o> NRF_SDH_CLOCK_LF_RC_CTIV - SoftDevice calibration timer interval.
    #ifndef NRF_SDH_CLOCK_LF_RC_CTIV
    #define NRF_SDH_CLOCK_LF_RC_CTIV 16
    #endif
    
    // <o> NRF_SDH_CLOCK_LF_RC_TEMP_CTIV - SoftDevice calibration timer interval under constant temperature.
    // <i> How often (in number of calibration intervals) the RC oscillator shall be calibrated
    // <i> if the temperature has not changed.
    
    #ifndef NRF_SDH_CLOCK_LF_RC_TEMP_CTIV
    #define NRF_SDH_CLOCK_LF_RC_TEMP_CTIV 2
    #endif
    
    // <o> NRF_SDH_CLOCK_LF_ACCURACY - External clock accuracy used in the LL to compute timing.
    
    // <0=> NRF_CLOCK_LF_ACCURACY_250_PPM
    // <1=> NRF_CLOCK_LF_ACCURACY_500_PPM
    // <2=> NRF_CLOCK_LF_ACCURACY_150_PPM
    // <3=> NRF_CLOCK_LF_ACCURACY_100_PPM
    // <4=> NRF_CLOCK_LF_ACCURACY_75_PPM
    // <5=> NRF_CLOCK_LF_ACCURACY_50_PPM
    // <6=> NRF_CLOCK_LF_ACCURACY_30_PPM
    // <7=> NRF_CLOCK_LF_ACCURACY_20_PPM
    // <8=> NRF_CLOCK_LF_ACCURACY_10_PPM
    // <9=> NRF_CLOCK_LF_ACCURACY_5_PPM
    // <10=> NRF_CLOCK_LF_ACCURACY_2_PPM
    // <11=> NRF_CLOCK_LF_ACCURACY_1_PPM
    
    #ifndef NRF_SDH_CLOCK_LF_ACCURACY
    #define NRF_SDH_CLOCK_LF_ACCURACY 1
    #endif

    These are the default values used by the RC oscillator, but you can edit them yourself if you'd like to calibrate more often.

    Best regards,

    Simon

  • Hi Simon thank you very much for your suggestion; but is there possible to enable EVENTS_DONE event when the softdevice is running? As Dmitry was suggesting. I'd like to get an idea about softdevice behaviour, also to get a feedback about the quality of the hardware. Seems very interesting to know how many times softdevice is dealing with clock drifts

Reply Children
No Data
Related