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?