diff --git a/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_L152RE/analogin_api.c b/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_L152RE/analogin_api.c index ebcc7b3430..5abb4bcf81 100644 --- a/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_L152RE/analogin_api.c +++ b/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_L152RE/analogin_api.c @@ -81,6 +81,11 @@ void analogin_init(analogin_t *obj, PinName pin) { // Get ADC registers structure address adc = (ADC_TypeDef *)(obj->adc); + // Enable the HSI + RCC_HSICmd(ENABLE); + // Wait until HSI oscillator is ready + while(RCC_GetFlagStatus(RCC_FLAG_HSIRDY) == RESET) {} + // Enable ADC clock RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1, ENABLE);