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

nRF51822: Stop HFCLK while it is starting but before started?

My program doesn't use SoftDevice.

In Reference Manual 3.0 page 52: "A HFCLKSTOP task will stop the HFCLK oscillator. However the HFCLKSTOP task can only be sent after the STATE field in the HFCLKSTAT register indicates a 'HFCLK running' state." Does it mean the stop task can only be triggered when XOSC is running, or either of XOSC and RC is running?

  1. If the former is TRUE (that is, XOSC must be running before triggering a stop task), what will happen if it is stopped, or it is starting but before started?
  2. If the latter is TRUE, I think either of the TWO sources must be running when CPU is running, so there is nothing to check before stopping XOSC.
  3. For "HFCLKRUN", I think it is set immediately after XOSC start task is triggered. And event "HFCLKSTARTED" means the XOSC is stable. Do I understand them correctly?

I want my program to do this:

  1. After powerup, turn on XOSC HFCLK, but don't wait until it is started (event HFCLKSTARTED).
  2. Before WFI, stop HFCLK.
  3. Next thing of WFI is start XOSC again, but still don't wait for its being ready.
  4. In other part of the program where XOSC HFCLK is mandatory (such as Radio), check and wait XOSC to be ready.
  5. In this way, I don't have to wait for XOSC to be ready every time an interrupt is issued, and thus a lot of time could be saved.

So it is possible stop task is triggered while XOSC is starting but before it is ready. And I would like to know if it is safe to do so.

Related