File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
targets/TARGET_STM/TARGET_STM32L4 Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -86,12 +86,23 @@ void analogin_init(analogin_t *obj, PinName pin)
86
86
obj -> handle .Init .DFSDMConfig = 0 ;
87
87
#endif
88
88
89
+ #if defined(TARGET_DISCO_L496AG )
90
+ /* VREF+ is not connected to VDDA by default */
91
+ /* Use 2.5V as reference (instead of 3.3V) for internal channels calculation */
92
+ __HAL_RCC_SYSCFG_CLK_ENABLE ();
93
+ HAL_SYSCFG_VREFBUF_VoltageScalingConfig (SYSCFG_VREFBUF_VOLTAGE_SCALE1 ); /* VREF_OUT2 = 2.5 V */
94
+ HAL_SYSCFG_VREFBUF_HighImpedanceConfig (SYSCFG_VREFBUF_HIGH_IMPEDANCE_DISABLE );
95
+ if (HAL_SYSCFG_EnableVREFBUF () != HAL_OK ) {
96
+ error ("HAL_SYSCFG_EnableVREFBUF issue\n" );
97
+ }
98
+ #endif /* TARGET_DISCO_L496AG */
99
+
89
100
// Enable ADC clock
90
101
__HAL_RCC_ADC_CLK_ENABLE ();
91
102
__HAL_RCC_ADC_CONFIG (RCC_ADCCLKSOURCE_SYSCLK );
92
103
93
104
if (HAL_ADC_Init (& obj -> handle ) != HAL_OK ) {
94
- error ("Cannot initialize ADC" );
105
+ error ("Cannot initialize ADC\n " );
95
106
}
96
107
97
108
// ADC calibration is done only once
You can’t perform that action at this time.
0 commit comments