52832,SDK12.0.0
I met such a situation: In the use of JLink burning program or air upgrade, after the completion of the program card died in initialization low-frequency crystals.
"sd_softdevice_enable(p_clock_lf_cfg, softdevice_fault_handler);"
52832,SDK12.0.0
I met such a situation: In the use of JLink burning program or air upgrade, after the completion of the program card died in initialization low-frequency crystals.
"sd_softdevice_enable(p_clock_lf_cfg, softdevice_fault_handler);"
You need to modify the NRF_CLOCK_LFCLKSRC in the pca10040.h or custom_board.h to the following
#define NRF_CLOCK_LFCLKSRC {.source = NRF_CLOCK_LF_SRC_RC, \
.rc_ctiv = 16, \
.rc_temp_ctiv = 2, \
.xtal_accuracy = NRF_CLOCK_LF_XTAL_ACCURACY_250_PPM }
You need to modify the NRF_CLOCK_LFCLKSRC in the pca10040.h or custom_board.h to the following
#define NRF_CLOCK_LFCLKSRC {.source = NRF_CLOCK_LF_SRC_RC, \
.rc_ctiv = 16, \
.rc_temp_ctiv = 2, \
.xtal_accuracy = NRF_CLOCK_LF_XTAL_ACCURACY_250_PPM }
How to detect abnormal external low-frequency crystals, then automatically switch to the internal low-frequency crystals?
Why do you need to detect "abnormal external low-frequency crystals" ? I assume that you know which crystal that is on your pcb?
Before 52832 program into the main function, initialize the clock: Under normal circumstances: NRF_CLOCK - > LFCLKSTAT = 0; After the abnormal: NRF_CLOCK - > LFCLKSTAT = 0 x00010000, (1 low frequency clock is still running, 00 said RC internal clock)
Now, initialize the clock before I join lfclk_stop (), the program will stuck waiting for the clock stopped while (nrf_clock_lf_is_running ())
// Low frequency clock source to be used by the SoftDevice
#define NRF_CLOCK_LFCLKSRC {.source = NRF_CLOCK_LF_SRC_XTAL, \
.rc_ctiv = 0, \
.rc_temp_ctiv = 0, \
.xtal_accuracy = NRF_CLOCK_LF_XTAL_ACCURACY_20_PPM}
After initialization, you mean that after you've called sd_softdevice_enable
with the following clock config
// Low frequency clock source to be used by the SoftDevice
#define NRF_CLOCK_LFCLKSRC {.source = NRF_CLOCK_LF_SRC_XTAL, \
.rc_ctiv = 0, \
.rc_temp_ctiv = 0, \
.xtal_accuracy = NRF_CLOCK_LF_XTAL_ACCURACY_20_PPM}
then you read 0x00010000
from the LFCLKSTAT register?