File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
libraries/mbed/targets/cmsis/TARGET_Freescale/TARGET_KLXX/TARGET_KL05Z Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -103,6 +103,11 @@ uint32_t SystemCoreClock = DEFAULT_SYSTEM_CLOCK;
103
103
-- SystemInit()
104
104
---------------------------------------------------------------------------- */
105
105
106
+ static void busy_delay (uint32_t delay ) {
107
+ volatile uint32_t i = delay ;
108
+ while (i -- );
109
+ }
110
+
106
111
void SystemInit (void ) {
107
112
#if (DISABLE_WDOG )
108
113
/* Disable the WDOG module */
@@ -189,6 +194,13 @@ void SystemInit (void) {
189
194
while ((MCG -> S & MCG_S_IRCST_MASK ) == 0x00U ) { /* Check that the fast external reference clock is selected. */
190
195
}
191
196
#endif /* (CLOCK_SETUP == 2) */
197
+ // Give the FLL time to stabilize
198
+ // This can take up to 1ms according to the KL05 datasheet
199
+ // Note: Without this delay the UART's baud can be wrong for the
200
+ // first byte sent in some cases. A delay of 1000 fixes this
201
+ // problem even under optimizations. The delay of 10,000 is used
202
+ // to add a saftey margin.
203
+ busy_delay (10000 );
192
204
}
193
205
194
206
/* ----------------------------------------------------------------------------
You can’t perform that action at this time.
0 commit comments