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

Questions About The nRF52840 Automatically Switching HFINT and HFXO On / Off As Needed?

We're trying to minimize power consumption on our custom nRF52840-based board and we have some questions about the behavior of HFINT and HFXO. The specification says this:

"The HFCLK controller will automatically provide the clock(s) requested by the system. If the system does not request any clocks from the HFCLK controller, the controller will enter a power saving mode. The HFINT source will be used when HFCLK is requested and HFXO has not been started."

1) Does this mean that, if HFXO has not been started, the nRF52840 will start HFINT running automatically when when some part of the nRF52840 requires it. For instance, in Section 6.22.6, the specification says "To optimize RTC power consumption, events in the RTC can be individually disabled to prevent PCLK16M and HFCLK being requested when those events are triggered", which suggests that if HFCLK is not running and an RTC event is triggered, HFINT will be automatically started. Is that correct?

2) In the scenario above, where HFXO is not enabled, once HFINT is automatically started by the nRF52840 as requested by part of the MCU, will HFINT ever be automatically stopped to conserve power? Or will it just run forever once it has been started?

3) The specification states that "HCLK64M: 64 MHz CPU clock" is derived from HFCLK. Doesn't this mean that, in practice, HFCLK is always running if code is executing?

4) Does HFINT automatically get disabled when the MCU enters sleep mode? Or does it only get disabled when the MCU enters deep sleep mode?

5) How long does HFINT typically require to start running after it is requested?

6) My understanding is that the SoftDevice will automatically enable HFXO before a RADIO event and release it afterward. And likewise, I see calls to nrf_drv_clock_hfclk_request() and nrf_drv_clock_hfclk_release() in the USBD and NFC components of the nRF5 SDK to dynamically enable and disable the HFXO as needed. HOWEVER, I also see several example projects in the nRF5 SDK (e.g. USBD) that call nrf_drv_clock_hfclk_request() early in main() and leave HFXO enabled all the time. Why is the USBD example program turning on HFXO all the time since the component/libraries/usbd/app_usbd.c component seems to be turning it on dynamically when needed? Shouldn't the USBD component be able to dynamically request HFXO when USB is plugged into the device and then automatically release it when USB is unplugged?

  • Hi

    1) Does this mean that, if HFXO has not been started, the nRF52840 will start HFINT running automatically when when some part of the nRF52840 requires it. For instance, in Section 6.22.6, the specification says "To optimize RTC power consumption, events in the RTC can be individually disabled to prevent PCLK16M and HFCLK being requested when those events are triggered", which suggests that if HFCLK is not running and an RTC event is triggered, HFINT will be automatically started. Is that correct?

    IMHO the description here is not clear. For other peripherals, there's only an INTEN register that forces CPU to wake up by enabled events, but all events are always fire EVENT flag and are routed to PPI subsystem. For RTC, there is an additional register EVTEN, it enables hardware path from an event. For example, you may want to toggle GPIOTE line or start ADC measurement by RTC but don't need to wake up CPU - you can enable that event in EVTEN leaving INTEN cleared. For maximum power consumption, disable unneeded events in both registers.

    2) In the scenario above, where HFXO is not enabled, once HFINT is automatically started by the nRF52840 as requested by part of the MCU, will HFINT ever be automatically stopped to conserve power? Or will it just run forever once it has been started?

    It will run as long as it's needed by CPU or some peripheral, then it will be stopped.

    3) The specification states that "HCLK64M: 64 MHz CPU clock" is derived from HFCLK. Doesn't this mean that, in practice, HFCLK is always running if code is executing?

    Yes.

    4) Does HFINT automatically get disabled when the MCU enters sleep mode? Or does it only get disabled when the MCU enters deep sleep mode?

    It will stop unless some peripheral needs it. AFAIK there's no difference between sleep and deep sleep.

    5) How long does HFINT typically require to start running after it is requested?

    For nRF52832 startup time is 3us according to spec. For 52840 it's not specified, I think it's the same or very close.

    Why is the USBD example program turning on HFXO all the time since the component/libraries/usbd/app_usbd.c component seems to be turning it on dynamically when needed? Shouldn't the USBD component be able to dynamically request HFXO when USB is plugged into the device and then automatically release it when USB is unplugged?

    I found it only in usbd example... really it's not needed for USB driver (it will request HFXO when plugged as you pointed out), rather to provide a stable clock to UART. Anyway, if device is powered from VBUS, power consumption is not an issue. For battery-powered device that is connected to USB host time to time, you'll prefer to remove that line.

Related