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

Tutorials[Meta]

Hi,

We're working on making some more tutorials, we have some thoughts on what we want to do, but we would really like your input. After all it's you, the user, who will benefit from this material.

What do you find unclear, difficult or would like a more thorough walk-through on?

Best regards,

Øyvind

Parents
  • Please make some tutorials on switching clock sources and changing clock frequencies for nRF52 with and without softdevices.. Also some more help on Low power modes is appreciated.

    Thanks

  • Well, there's not really all that much to it.

    SoftDevice:

    HFCLK started by:

    uint32_t running=0;
    sd_clock_hfclk_request();
    while (!running) 
    {
        sd_clock_hfclk_is_running(&p_is_running);
    }
    

    Stopped by:

    sd_clock_hfclk_release();
    

    LFCLK is always configured when the SoftDevice running, start it by calling

    SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_XTAL_50_PPM , NULL) 
    

    NRF_CLOCK_LFCLKSRC_XTAL_50_PPM should be exchanged with the appropriate LFCLK from this struct.

    No SoftDevice

    // Start high frequency clock
    NRF_CLOCK->TASKS_HFCLKSTART = 1;
    while (NRF_CLOCK->EVENTS_HFCLKSTARTED == 0)
    {
        // Wait for clock to start
    }
    NRF_CLOCK->EVENTS_HFCLKSTARTED = 0;
    
    // Start low frequency clock
    NRF_CLOCK->TASKS_LFCLKSTART = 1;
    while (NRF_CLOCK->EVENTS_LFCLKSTARTED == 0)
    {
        // Wait for clock to start
    }
    NRF_CLOCK->EVENTS_LFCLKSTARTED = 0;
    

    Note that there is not ppm configuration in the initialization without SoftDevice, this has to be done manually.

Reply
  • Well, there's not really all that much to it.

    SoftDevice:

    HFCLK started by:

    uint32_t running=0;
    sd_clock_hfclk_request();
    while (!running) 
    {
        sd_clock_hfclk_is_running(&p_is_running);
    }
    

    Stopped by:

    sd_clock_hfclk_release();
    

    LFCLK is always configured when the SoftDevice running, start it by calling

    SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_XTAL_50_PPM , NULL) 
    

    NRF_CLOCK_LFCLKSRC_XTAL_50_PPM should be exchanged with the appropriate LFCLK from this struct.

    No SoftDevice

    // Start high frequency clock
    NRF_CLOCK->TASKS_HFCLKSTART = 1;
    while (NRF_CLOCK->EVENTS_HFCLKSTARTED == 0)
    {
        // Wait for clock to start
    }
    NRF_CLOCK->EVENTS_HFCLKSTARTED = 0;
    
    // Start low frequency clock
    NRF_CLOCK->TASKS_LFCLKSTART = 1;
    while (NRF_CLOCK->EVENTS_LFCLKSTARTED == 0)
    {
        // Wait for clock to start
    }
    NRF_CLOCK->EVENTS_LFCLKSTARTED = 0;
    

    Note that there is not ppm configuration in the initialization without SoftDevice, this has to be done manually.

Children
No Data
Related