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

What is the equivalent of S110's enum "NRF_CLOCK_LFCLKSRCS" in S140?

Hello, in S110 device's nrf_sdm.h, there is this enum "NRF_CLOCK_LFCLKSRCS" which is defined as:

enum NRF_CLOCK_LFCLKSRCS
{
  NRF_CLOCK_LFCLKSRC_SYNTH_250_PPM,                       /**< LFCLK Synthesized from HFCLK.                            */
  NRF_CLOCK_LFCLKSRC_XTAL_500_PPM,                        /**< LFCLK crystal oscillator 500 PPM accuracy.       */
  NRF_CLOCK_LFCLKSRC_XTAL_250_PPM,                        /**< LFCLK crystal oscillator 250 PPM accuracy.       */
  NRF_CLOCK_LFCLKSRC_XTAL_150_PPM,                        /**< LFCLK crystal oscillator 150 PPM accuracy.       */
  NRF_CLOCK_LFCLKSRC_XTAL_100_PPM,                        /**< LFCLK crystal oscillator 100 PPM accuracy.       */
  NRF_CLOCK_LFCLKSRC_XTAL_75_PPM,                         /**< LFCLK crystal oscillator 75 PPM accuracy.        */
  NRF_CLOCK_LFCLKSRC_XTAL_50_PPM,                         /**< LFCLK crystal oscillator 50 PPM accuracy.        */
  NRF_CLOCK_LFCLKSRC_XTAL_30_PPM,                         /**< LFCLK crystal oscillator 30 PPM accuracy.        */
  NRF_CLOCK_LFCLKSRC_XTAL_20_PPM,                         /**< LFCLK crystal oscillator 20 PPM accuracy.        */
  NRF_CLOCK_LFCLKSRC_RC_250_PPM_250MS_CALIBRATION,        /**< LFCLK RC oscillator, 250ms  calibration interval.*/
  NRF_CLOCK_LFCLKSRC_RC_250_PPM_500MS_CALIBRATION,        /**< LFCLK RC oscillator, 500ms  calibration interval.*/
  NRF_CLOCK_LFCLKSRC_RC_250_PPM_1000MS_CALIBRATION,       /**< LFCLK RC oscillator, 1000ms calibration interval.*/
  NRF_CLOCK_LFCLKSRC_RC_250_PPM_2000MS_CALIBRATION,       /**< LFCLK RC oscillator, 2000ms calibration interval.*/
  NRF_CLOCK_LFCLKSRC_RC_250_PPM_4000MS_CALIBRATION,       /**< LFCLK RC oscillator, 4000ms calibration interval.*/
  NRF_CLOCK_LFCLKSRC_RC_250_PPM_8000MS_CALIBRATION,       /**< LFCLK RC oscillator, 8000ms calibration interval.*/
  NRF_CLOCK_LFCLKSRC_RC_250_PPM_TEMP_1000MS_CALIBRATION,  /**< LFCLK RC oscillator. Temperature checked every 1000ms, if changed above a threshold, a calibration is done.*/
  NRF_CLOCK_LFCLKSRC_RC_250_PPM_TEMP_2000MS_CALIBRATION,  /**< LFCLK RC oscillator. Temperature checked every 2000ms, if changed above a threshold, a calibration is done.*/
  NRF_CLOCK_LFCLKSRC_RC_250_PPM_TEMP_4000MS_CALIBRATION,  /**< LFCLK RC oscillator. Temperature checked every 4000ms, if changed above a threshold, a calibration is done.*/
  NRF_CLOCK_LFCLKSRC_RC_250_PPM_TEMP_8000MS_CALIBRATION,  /**< LFCLK RC oscillator. Temperature checked every 8000ms, if changed above a threshold, a calibration is done.*/
  NRF_CLOCK_LFCLKSRC_RC_250_PPM_TEMP_16000MS_CALIBRATION, /**< LFCLK RC oscillator. Temperature checked every 16000ms, if changed above a threshold, a calibration is done.*/
};

When migrating to S140 softdevice, this is nowhere to be found. By scanning through the migration manual I realized there are some name changes but this one isn't mentioned.

As I noted, I'm migrating a project from nrf51 to 52, and this enum isn't something I can simply discard. Here is the part of the code, a function where the enum is called:

uint32_t timeslot_init(nrf_clock_lfclksrc_t lfclksrc)
{
    if (m_framework_initialized)
{
    return NRF_ERROR_INVALID_STATE;
}

switch (lfclksrc)
{
    case NRF_CLOCK_LFCLKSRC_XTAL_100_PPM:
        m_lfclk_ppm = 100;
        break;
    case NRF_CLOCK_LFCLKSRC_XTAL_150_PPM:
        m_lfclk_ppm = 150;
        break;
    case NRF_CLOCK_LFCLKSRC_XTAL_20_PPM:
        m_lfclk_ppm = 20;
        break;
    case NRF_CLOCK_LFCLKSRC_XTAL_250_PPM:
        m_lfclk_ppm = 250;
        break;
    case NRF_CLOCK_LFCLKSRC_XTAL_30_PPM:
        m_lfclk_ppm = 30;
        break;
    case NRF_CLOCK_LFCLKSRC_XTAL_500_PPM:
        m_lfclk_ppm = 500;
        break;
    case NRF_CLOCK_LFCLKSRC_XTAL_50_PPM:
        m_lfclk_ppm = 50;
        break;
    case NRF_CLOCK_LFCLKSRC_XTAL_75_PPM:
        m_lfclk_ppm = 75;
        break;
    default: /* all RC-sources are 250 */
        m_lfclk_ppm = 250;
}

m_is_in_callback = false;
m_framework_initialized = true;

m_timeslot_length = TIMESLOT_SLOT_LENGTH_US;

return NRF_SUCCESS;
}

Since I don't have a low frequency clock source on my board (I could be wrong, it maybe the clock source which came with an nrf52 SoC, but what I'm sure of is that my board, when fully functional, use an external crystal clock source), I'm planning on replacing the switch case section with a fixed value, which may not be a good idea, and alternatively, I can go with the more preferable solution, which is find the "NRF_CLOCK_LFCLKSRCS" 's counterpart in S140, but where?

Can someone please help me?

Edit: rephrased completely the question and the content.

Parents Reply Children
No Data
Related