LFCLK: Add compatibility to wasp-os reloader-factory

This commit is contained in:
Christoph Honal 2022-05-25 15:00:19 +02:00 committed by Riku Isokoski
parent 8b0559c481
commit e77d47e35c

View file

@ -312,10 +312,15 @@ int main(void) {
nrf_drv_clock_init(); nrf_drv_clock_init();
nrf_drv_clock_lfclk_request(NULL); nrf_drv_clock_lfclk_request(NULL);
// The RC source for the LF clock has to be calibrated // When loading the firmware via the Wasp-OS reloader-factory, which uses the used internal LF RC oscillator,
#if (CLOCK_CONFIG_LF_SRC == NRF_CLOCK_LFCLK_RC) // the LF clock has to be explicitly restarted because InfiniTime uses the external crystal oscillator if available.
// If the clock is not restarted, the Bluetooth timers fail to initialize.
nrfx_clock_lfclk_start();
while (!nrf_clock_lf_is_running()) { while (!nrf_clock_lf_is_running()) {
} }
// The RC source for the LF clock has to be calibrated
#if (CLOCK_CONFIG_LF_SRC == NRF_CLOCK_LFCLK_RC)
nrf_drv_clock_calibration_start(0, calibrate_lf_clock_rc); nrf_drv_clock_calibration_start(0, calibrate_lf_clock_rc);
#endif #endif