diff --git a/targets/TARGET_STM/sleep.c b/targets/TARGET_STM/sleep.c index f0656666e4..3eda86a1e6 100644 --- a/targets/TARGET_STM/sleep.c +++ b/targets/TARGET_STM/sleep.c @@ -98,7 +98,11 @@ static void ForceOscOutofDeepSleep(void) RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_MSI; RCC_OscInitStruct.MSIState = RCC_MSI_ON; RCC_OscInitStruct.MSICalibrationValue = RCC_MSICALIBRATION_DEFAULT; - RCC_OscInitStruct.MSIClockRange = RCC_MSIRANGE_4; // Intermediate freq, 1MHz range +#if defined RCC_MSIRANGE_11 + RCC_OscInitStruct.MSIClockRange = RCC_MSIRANGE_11; // Highest freq, 48MHz range +#else + RCC_OscInitStruct.MSIClockRange = RCC_MSIRANGE_6; // 4MHz range +#endif RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE; #else /* defined RCC_SYSCLKSOURCE_MSI */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;