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

SDK12.2 nrf_delay_us 32MHz

Hi,

I use nrf51822 with HF XTAL Frequency of 32 MHz

I am migrating from SDK9 S110 to SDK 12.2 S130 and have a problem that the code stop on nrf_delay_us.

#ifndef CLOCK_ENABLED
#define CLOCK_ENABLED 1
#endif
#if  CLOCK_ENABLED
// <o> CLOCK_CONFIG_XTAL_FREQ  - HF XTAL Frequency
 
// <0=> Default (64 MHz) 
// <255=> Default (16 MHz) 
// <0=> 32 MHz 

#ifndef CLOCK_CONFIG_XTAL_FREQ
#define CLOCK_CONFIG_XTAL_FREQ 0
#endif

If i replace nrf_delay.h of sdk12.2 with rf_delay.h of sdk9 all working well.

i also try to set 32MHz with code:

 //Set the external high frequency clock source to 32 MHz
    NRF_CLOCK->XTALFREQ = 0xFFFFFF00;

    // Start the external high frequency crystal
    NRF_CLOCK->EVENTS_HFCLKSTARTED = 0;
    NRF_CLOCK->TASKS_HFCLKSTART = 1;

    // Wait for the external oscillator to start up
    while (NRF_CLOCK->EVENTS_HFCLKSTARTED == 0) {}

Why SDK 12.2 not working with nrf51 32MHz?

image description

Related