diff --git a/cores/arduino/stm32/analog.h b/cores/arduino/stm32/analog.h
index dc459a845c..0d0494f03e 100644
--- a/cores/arduino/stm32/analog.h
+++ b/cores/arduino/stm32/analog.h
@@ -49,14 +49,20 @@ extern "C" {
 #endif
 
 /* Exported functions ------------------------------------------------------- */
+#if defined(HAL_ADC_MODULE_ENABLED) && !defined(HAL_ADC_MODULE_ONLY)
+uint32_t get_adc_channel(PinName pin, uint32_t *bank);
+uint32_t get_adc_internal_channel(PinName pin);
+uint16_t adc_read_value(PinName pin, uint32_t resolution);
+#endif
+#if defined(HAL_DAC_MODULE_ENABLED) && !defined(HAL_DAC_MODULE_ONLY)
+uint32_t get_dac_channel(PinName pin);
 void dac_write_value(PinName pin, uint32_t value, uint8_t do_init);
 void dac_stop(PinName pin);
-uint16_t adc_read_value(PinName pin, uint32_t resolution);
+#endif
 #if defined(HAL_TIM_MODULE_ENABLED) && !defined(HAL_TIM_MODULE_ONLY)
 void pwm_start(PinName pin, uint32_t clock_freq, uint32_t value, TimerCompareFormat_t resolution);
 void pwm_stop(PinName pin);
 #endif
-uint32_t get_pwm_channel(PinName pin);
 
 #ifdef __cplusplus
 }
diff --git a/cores/arduino/stm32/timer.h b/cores/arduino/stm32/timer.h
index 344afa6061..7b71dc6b0e 100644
--- a/cores/arduino/stm32/timer.h
+++ b/cores/arduino/stm32/timer.h
@@ -284,6 +284,8 @@ uint8_t getTimerClkSrc(TIM_TypeDef *tim);
 IRQn_Type getTimerUpIrq(TIM_TypeDef *tim);
 IRQn_Type getTimerCCIrq(TIM_TypeDef *tim);
 
+uint32_t getTimerChannel(PinName pin);
+
 #endif /* HAL_TIM_MODULE_ENABLED && !HAL_TIM_MODULE_ONLY */
 
 #ifdef __cplusplus
diff --git a/libraries/SrcWrapper/src/HardwareTimer.cpp b/libraries/SrcWrapper/src/HardwareTimer.cpp
index 9e948bc53a..d9de8dfcd2 100644
--- a/libraries/SrcWrapper/src/HardwareTimer.cpp
+++ b/libraries/SrcWrapper/src/HardwareTimer.cpp
@@ -740,7 +740,7 @@ void HardwareTimer::setMode(uint32_t channel, TimerModes_t mode, PinName pin)
   _ChannelMode[channel - 1] = mode;
 
   if (pin != NC) {
-    if ((int)get_pwm_channel(pin) == timChannel) {
+    if ((int)getTimerChannel(pin) == timChannel) {
       /* Configure PWM GPIO pins */
       pinmap_pinout(pin, PinMap_TIM);
 #if defined(STM32F1xx)
diff --git a/libraries/SrcWrapper/src/stm32/analog.cpp b/libraries/SrcWrapper/src/stm32/analog.cpp
index 18b026fad8..479cfcd630 100644
--- a/libraries/SrcWrapper/src/stm32/analog.cpp
+++ b/libraries/SrcWrapper/src/stm32/analog.cpp
@@ -101,8 +101,14 @@ static PinName g_current_pin = NC;
 #define ADC_REGULAR_RANK_1  1
 #endif
 
-/* Private Functions */
-static uint32_t get_adc_channel(PinName pin, uint32_t *bank)
+/* Exported Functions */
+/**
+  * @brief  Return ADC HAL channel linked to a PinName
+  * @param  pin: PinName
+  * @param  bank: pointer to get ADC channel bank if required
+  * @retval Valid HAL channel
+  */
+uint32_t get_adc_channel(PinName pin, uint32_t *bank)
 {
   uint32_t function = pinmap_function(pin, PinMap_ADC);
   uint32_t channel = 0;
@@ -218,7 +224,7 @@ static uint32_t get_adc_channel(PinName pin, uint32_t *bank)
 #endif
 #endif
     default:
-      channel = 0;
+      _Error_Handler("ADC: Unknown adc channel", (int)(STM_PIN_CHANNEL(function)));
       break;
   }
 #ifdef ADC_CHANNELS_BANK_B
@@ -233,7 +239,14 @@ static uint32_t get_adc_channel(PinName pin, uint32_t *bank)
   return channel;
 }
 
-static uint32_t get_adc_internal_channel(PinName pin)
+/**
+  * @brief  Return ADC HAL internal channel linked to a PinName
+  * @param  pin: specific PinName's for ADC internal. Value can be:
+  *         PADC_TEMP, PADC_TEMP_ADC5, PADC_VREF, PADC_VBAT
+  *         Note that not all of these values ​​may be available for all series.
+  * @retval Valid HAL internal channel.
+  */
+uint32_t get_adc_internal_channel(PinName pin)
 {
   uint32_t channel = 0;
   switch (pin) {
@@ -263,41 +276,20 @@ static uint32_t get_adc_internal_channel(PinName pin)
       break;
 #endif
     default:
-      channel = 0;
+      _Error_Handler("ADC: Unknown adc internal PiName", (int)(pin));
       break;
   }
   return channel;
 }
 #endif /* HAL_ADC_MODULE_ENABLED && !HAL_ADC_MODULE_ONLY */
 
-#if defined(HAL_TIM_MODULE_ENABLED) && !defined(HAL_TIM_MODULE_ONLY)
-uint32_t get_pwm_channel(PinName pin)
-{
-  uint32_t function = pinmap_function(pin, PinMap_TIM);
-  uint32_t channel = 0;
-  switch (STM_PIN_CHANNEL(function)) {
-    case 1:
-      channel = TIM_CHANNEL_1;
-      break;
-    case 2:
-      channel = TIM_CHANNEL_2;
-      break;
-    case 3:
-      channel = TIM_CHANNEL_3;
-      break;
-    case 4:
-      channel = TIM_CHANNEL_4;
-      break;
-    default:
-      channel = 0;
-      break;
-  }
-  return channel;
-}
-#endif /* HAL_TIM_MODULE_ENABLED && !HAL_TIM_MODULE_ONLY */
-
 #if defined(HAL_DAC_MODULE_ENABLED) && !defined(HAL_DAC_MODULE_ONLY)
-static uint32_t get_dac_channel(PinName pin)
+/**
+  * @brief  Return DAC HAL channel linked to a PinName
+  * @param  pin: specific PinName's for ADC internal.
+  * @retval Valid HAL channel
+  */
+uint32_t get_dac_channel(PinName pin)
 {
   uint32_t function = pinmap_function(pin, PinMap_DAC);
   uint32_t channel = 0;
@@ -316,7 +308,7 @@ static uint32_t get_dac_channel(PinName pin)
       break;
 #endif
     default:
-      channel = 0;
+      _Error_Handler("DAC: Unknown dac channel", (int)(STM_PIN_CHANNEL(function)));
       break;
   }
   return channel;
diff --git a/libraries/SrcWrapper/src/stm32/timer.c b/libraries/SrcWrapper/src/stm32/timer.c
index 945d79569a..e9febec358 100644
--- a/libraries/SrcWrapper/src/stm32/timer.c
+++ b/libraries/SrcWrapper/src/stm32/timer.c
@@ -715,6 +715,34 @@ uint8_t getTimerClkSrc(TIM_TypeDef *tim)
   return clkSrc;
 }
 
+/**
+  * @brief  Return HAL timer channel linked to a PinName
+  * @param  pin: PinName
+  * @retval Valid HAL channel
+  */
+uint32_t getTimerChannel(PinName pin)
+{
+  uint32_t function = pinmap_function(pin, PinMap_TIM);
+  uint32_t channel = 0;
+  switch (STM_PIN_CHANNEL(function)) {
+    case 1:
+      channel = TIM_CHANNEL_1;
+      break;
+    case 2:
+      channel = TIM_CHANNEL_2;
+      break;
+    case 3:
+      channel = TIM_CHANNEL_3;
+      break;
+    case 4:
+      channel = TIM_CHANNEL_4;
+      break;
+    default:
+      _Error_Handler("TIM: Unknown timer channel", (int)(STM_PIN_CHANNEL(function)));
+      break;
+  }
+  return channel;
+}
 
 #endif /* HAL_TIM_MODULE_ENABLED && !HAL_TIM_MODULE_ONLY */