Solve bug: Low frequency clock will now selected by given "lf_clock_src" setting.

pull/11023/head
Philipp Steiner 2019-07-01 15:38:22 +02:00 committed by Evelyne Donnaes
parent a424c4c7b2
commit 66ce92aa1b
1 changed files with 10 additions and 1 deletions

View File

@ -40,6 +40,7 @@
// Nordic Includes // Nordic Includes
#include "nrf.h" #include "nrf.h"
#include "nrf5x_lf_clk_helper.h"
#include "NRFCordioHCIDriver.h" #include "NRFCordioHCIDriver.h"
#include "NRFCordioHCITransportDriver.h" #include "NRFCordioHCITransportDriver.h"
@ -78,6 +79,14 @@ using namespace ble::vendor::cordio;
/*! \brief Typical implementation revision number (LlRtCfg_t::implRev). */ /*! \brief Typical implementation revision number (LlRtCfg_t::implRev). */
#define LL_IMPL_REV 0x2303 #define LL_IMPL_REV 0x2303
#if MBED_CONF_NORDIC_NRF_LF_CLOCK_SRC == NRF_LF_SRC_SYNTH
#define NRF_LF_CLK_SRC CLOCK_LFCLKSRC_SRC_Synth
#elif MBED_CONF_NORDIC_NRF_LF_CLOCK_SRC == NRF_LF_SRC_XTAL
#define NRF_LF_CLK_SRC CLOCK_LFCLKSRC_SRC_Xtal
#elif MBED_CONF_NORDIC_NRF_LF_CLOCK_SRC == NRF_LF_SRC_RC
#define NRF_LF_CLK_SRC CLOCK_LFCLKSRC_SRC_RC
#endif
// Note to implementer: this should be amended if the Cordio stack is updated // Note to implementer: this should be amended if the Cordio stack is updated
// The Nordic-specific baseband configuration // The Nordic-specific baseband configuration
@ -283,7 +292,7 @@ void NRFCordioHCIDriver::do_initialize()
} }
/* configure low-frequency clock */ /* configure low-frequency clock */
NRF_CLOCK->LFCLKSRC = (CLOCK_LFCLKSRC_SRC_Xtal << CLOCK_LFCLKSRC_SRC_Pos); NRF_CLOCK->LFCLKSRC = (NRF_LF_CLK_SRC << CLOCK_LFCLKSRC_SRC_Pos);
NRF_CLOCK->EVENTS_LFCLKSTARTED = 0; NRF_CLOCK->EVENTS_LFCLKSTARTED = 0;
NRF_CLOCK->TASKS_LFCLKSTART = 1; NRF_CLOCK->TASKS_LFCLKSTART = 1;
while (NRF_CLOCK->EVENTS_LFCLKSTARTED == 0) while (NRF_CLOCK->EVENTS_LFCLKSTARTED == 0)