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

A few questions about getting started with crystals.

Hi to everyone!

It's the first time I use and program clocks in a device. I'm very lost with crystals, power management and this stuff.

I have a custom board with two crystals: one is high frecuency and the other is external low frecuency.

I read SoftDevice must use high frecuency to getting working, but the high frecuency uses a lot of energy, so I want to change the crystal depending on if I'm using SoftDevice or not.

Here I find some code to code the crystals.

And in this two posts (one and two) I found some code to change the crystal, but these are for nRF51 and I don't know if will work with my board.

Also, I have some questions I want to ask you:

  1. Can I use the development board (I have nRF52832DK) to test my programs (for custom boards) even if it hasn't have the same crystals and the same PPM?

  2. Which NRF_CLOCK_LF_XTAL_ACCURACY value should I take If the crystal doesn't fit with anything, the lower or the higher? And should I take the typical or the maximum PPM in the datasheet as value?

  3. What is the difference between RC oscilator and crystal oscilator (both internally and externally)?

Thank you in advance!

    1. Yes, you can. but you have to change the settings to match the board you are using. i.e. if the DK has a 20ppm 32KHz crystal and the custom board has a 40ppm, this needs to be changed.
    2. Use the Higher setting. this is used to determine how early it rx window should start to account for drift. You can use the typical setting if your board will only operate in the typical scenario, if not use the higher setting.
    3. The internal RC requires less external compononents at the cost of increase inaccuracy, so the power consumption will be slightly higer due to a larger listening window and calibration at regular intervals using the HF clock. The external crystal is usually more accurat and does not require calibration. So if you need the lowest power consumption possible you use a crystal, but if cost is more important you can use the internal RC. For the High Frequency clock and external crystal is required for the radio. Note that the Softdevice will turn this on/off when need be.
  • Thank you, run_ar!

    I guess I have to switch the crystal settings every time I change the test board.

    Sorry, but I have a few more questions:

    1. Is the code (which is in the three post I put before) enough to use with crystals (to program and change between them)?

    2. In your last sentence: "Note that the Softdevice will turn this on/off when need be". Does it means I don't have to care to turn off the High Frequency crystal? And, when SoftDevice is used, SoftDevice will turn it on?

    1. If you are using an external crystal you need to change the NRF_SDH_CLOCK_LF_XTAL_ACCURACY in sdk_config.h. to switch between external and rc change NRF_SDH_CLOCK_LF_SRC

    2. When the Softdevice is enabled it will turn the HF xtal on/off, so it is only enabled when it is needed for radio communication.

Related