@@ -56,11 +56,11 @@ const PinName digitalPin[] = {
5656
5757// Analog (Ax) to digital pin number array
5858const uint32_t analogInputPin[] = {
59- 0 , // PA0, A0
60- 1 , // PA1, A1
61- 2 , // PA2, A2
62- 3 , // PA3, A3
63- 4 , // PB1, A4
59+ 0 , // PA0, A0
60+ 1 , // PA1, A1
61+ 2 , // PA2, A2
62+ 3 , // PA3, A3
63+ 4 , // PB1, A4
6464 14 , // PA7, A5
6565 30 // PA4, A6/BATTERY_VOLTAGE (STAT)
6666};
@@ -194,7 +194,7 @@ WEAK void SystemClock_Config(void)
194194 * - FLASH_LATENCY: 4 (required for 80 MHz / VOS1 per RM0394 s.3.3)
195195 */
196196 RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSE
197- | RCC_OSCILLATORTYPE_MSI;
197+ | RCC_OSCILLATORTYPE_MSI;
198198 RCC_OscInitStruct.LSEState = RCC_LSE_ON;
199199 RCC_OscInitStruct.HSIState = RCC_HSI_OFF;
200200 RCC_OscInitStruct.MSIState = RCC_MSI_ON;
@@ -257,35 +257,35 @@ WEAK void SystemClock_Config(void)
257257 Error_Handler ();
258258 }
259259
260- /* * Enable MSI Auto calibration (MSIPLLEN, RCC_CR[2])
261- *
262- * RM0394 s.6.2 (MSI clock): setting MSIPLLEN causes the MSI hardware
263- * to automatically trim itself against LSE as a phase reference,
264- * reducing MSI frequency error to < +/-0.25%. LSE must already be
265- * stable (LSERDY=1) before the bit is set -- guaranteed here because
266- * HAL_RCC_OscConfig() waited for LSERDY before returning.
267- *
268- * Setting MSIPLLEN causes MSIRDY to deassert transiently while MSI
269- * re-synchronises to LSE. HAL_RCCEx_EnableMSIPLLMode() returns
270- * immediately (it is a single SET_BIT); no MSIRDY wait is performed
271- * inside it. Two conclusions follow:
272- *
273- * (1) This call must come AFTER any HAL routine that polls MSIRDY
274- * under a HAL_GetTick() timeout -- if MSIRDY drops inside such
275- * a routine, the routine returns HAL_TIMEOUT and leaves the
276- * clock tree in an undefined state.
277- *
278- * (2) If SYSCLK were MSI, a deadlock would be possible: MSIRDY
279- * drops -> SysTick stalls -> HAL_GetTick() freezes -> any
280- * subsequent timeout loop never exits. RM0394 s.6.2.9 confirms
281- * SysTick is driven by HCLK (= SYSCLK / AHBdiv). Because
282- * SYSCLK is now PLLCLK (80 MHz), SysTick is completely
283- * decoupled from MSI and the transient is harmless.
284- *
285- * Placement here -- after PeriphCLKConfig -- satisfies both constraints
286- * and mirrors the ordering generated by CubeMX for the Nucleo L432KC.
287- */
288- HAL_RCCEx_EnableMSIPLLMode ();
260+ /* * Enable MSI Auto calibration (MSIPLLEN, RCC_CR[2])
261+ *
262+ * RM0394 s.6.2 (MSI clock): setting MSIPLLEN causes the MSI hardware
263+ * to automatically trim itself against LSE as a phase reference,
264+ * reducing MSI frequency error to < +/-0.25%. LSE must already be
265+ * stable (LSERDY=1) before the bit is set -- guaranteed here because
266+ * HAL_RCC_OscConfig() waited for LSERDY before returning.
267+ *
268+ * Setting MSIPLLEN causes MSIRDY to deassert transiently while MSI
269+ * re-synchronises to LSE. HAL_RCCEx_EnableMSIPLLMode() returns
270+ * immediately (it is a single SET_BIT); no MSIRDY wait is performed
271+ * inside it. Two conclusions follow:
272+ *
273+ * (1) This call must come AFTER any HAL routine that polls MSIRDY
274+ * under a HAL_GetTick() timeout -- if MSIRDY drops inside such
275+ * a routine, the routine returns HAL_TIMEOUT and leaves the
276+ * clock tree in an undefined state.
277+ *
278+ * (2) If SYSCLK were MSI, a deadlock would be possible: MSIRDY
279+ * drops -> SysTick stalls -> HAL_GetTick() freezes -> any
280+ * subsequent timeout loop never exits. RM0394 s.6.2.9 confirms
281+ * SysTick is driven by HCLK (= SYSCLK / AHBdiv). Because
282+ * SYSCLK is now PLLCLK (80 MHz), SysTick is completely
283+ * decoupled from MSI and the transient is harmless.
284+ *
285+ * Placement here -- after PeriphCLKConfig -- satisfies both constraints
286+ * and mirrors the ordering generated by CubeMX for the Nucleo L432KC.
287+ */
288+ HAL_RCCEx_EnableMSIPLLMode ();
289289
290290 /* * Ensure that MSI is wake-up system clock
291291 *
0 commit comments