Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

When does the SoftDevice enable the external 32MHz crystal oscillator?

I'm doing some electrical investigation on my design, and I'm wondering when the SoftDevice turns on/off the external 32MHz crystal oscillator. Our application is a Bluetooth device based on the nRF52832, using nRF5 SDK v17.1.0 and s132 v7.3.0.

I've tried printing the state of the oscillator using sd_clock_hfclk_is_running(). I was expecting to see the oscillator disabled while Advertising is disabled, and then enabled when Advertising is enabled, however, the function outputs "0" before and after.

I suspect that the system is using the internal oscillator most of the time (or else the program would not run) and the SoftDevice uses the external oscillator only for the relatively infrequent Bluetooth events, e.g. transmitting an Advertising packet. The discussion in this question leads me to believe that the clock-switching is something that's done automatically by the SoftDevice.

Is it correct to say that if advertising is disabled and there's no active connection, the external oscillator is not running?

  • Hello,

    Yes, HFINT is the default clock source and is used most of the time. Unless the application specifically requests the crystal oscillator (HFXO), the Softdevice will start and stop the crystal oscillator for each protocol event since keeping the crystal oscillator running significantly increases idle current (from 2-3uA to ~200uA). 

    For example, this is what a typical advertisment event look like ( Online Power Profiler for Bluetooth LE )

    I've tried printing the state of the oscillator using sd_clock_hfclk_is_running(). I was expecting to see the oscillator disabled while Advertising is disabled, and then enabled when Advertising is enabled, however, the function outputs "0" before and after.

    The crystal oscillator will only be enabled during the advertisment events.

    Is it correct to say that if advertising is disabled and there's no active connection, the external oscillator is not running?

    The HFXO is also used for periodic calibration when the LFRC oscillator is selected as the 32KHz clock source. But it will only be kept on during the calibration event.

    Best regards,

    Vidar

Related