File tree Expand file tree Collapse file tree 1 file changed +25
-1
lines changed
hal/targets/cmsis/TARGET_NORDIC/TARGET_NRF5/TARGET_MCU_NRF51822 Expand file tree Collapse file tree 1 file changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -104,8 +104,32 @@ void SystemInit(void)
104
104
* (uint32_t volatile * )0x4006EC14 = 0xC0 ;
105
105
}
106
106
107
+
108
+ #define NRF_LF_SRC_XTAL 2
109
+ #define NRF_LF_SRC_SYNTH 3
110
+ #define NRF_LF_SRC_RC 4
111
+
112
+ //MBED_CONF_APP_NORDIC_NRF_LF_CLOCK_SRC
113
+ #if MBED_CONF_APP_NORDIC_NRF_LF_CLOCK_SRC == NRF_LF_SRC_SYNTH
114
+ #define CLOCK_LFCLKSRC_SRC_TO_USE (CLOCK_LFCLKSRC_SRC_Synth)
115
+ #warning synhetic clock
116
+ #elif MBED_CONF_APP_NORDIC_NRF_LF_CLOCK_SRC == NRF_LF_SRC_XTAL
117
+ #define CLOCK_LFCLKSRC_SRC_TO_USE (CLOCK_LFCLKSRC_SRC_Xtal)
118
+ #warning crystal clock
119
+ #elif MBED_CONF_APP_NORDIC_NRF_LF_CLOCK_SRC == NRF_LF_SRC_RC // and undefined
120
+ #define CLOCK_LFCLKSRC_SRC_TO_USE (CLOCK_LFCLKSRC_SRC_RC)
121
+ #warning RC clock
122
+ #else
123
+ #error Bad LFCLK configuration. Declare proper source through mbed configuration.
124
+ #endif
125
+
126
+ #undef NRF_LF_SRC_XTAL
127
+ #undef NRF_LF_SRC_SYNTH
128
+ #undef NRF_LF_SRC_RC
129
+
107
130
// Start the external 32khz crystal oscillator.
108
- NRF_CLOCK -> LFCLKSRC = (CLOCK_LFCLKSRC_SRC_Xtal << CLOCK_LFCLKSRC_SRC_Pos );
131
+ //NRF_CLOCK->LFCLKSRC = (CLOCK_LFCLKSRC_SRC_Xtal << CLOCK_LFCLKSRC_SRC_Pos);
132
+ NRF_CLOCK -> LFCLKSRC = (CLOCK_LFCLKSRC_SRC_TO_USE << CLOCK_LFCLKSRC_SRC_Pos );
109
133
NRF_CLOCK -> EVENTS_LFCLKSTARTED = 0 ;
110
134
NRF_CLOCK -> TASKS_LFCLKSTART = 1 ;
111
135
You can’t perform that action at this time.
0 commit comments