diff --git a/drivers/sensor/stm32_vref/stm32_vref.c b/drivers/sensor/stm32_vref/stm32_vref.c index 8b85d0e4c9b..4e49e17e9e8 100644 --- a/drivers/sensor/stm32_vref/stm32_vref.c +++ b/drivers/sensor/stm32_vref/stm32_vref.c @@ -86,7 +86,16 @@ static int stm32_vref_channel_get(const struct device *dev, enum sensor_channel #endif /* CONFIG_SOC_SERIES_STM32H5X */ /* Calculate VREF+ using VREFINT bandgap voltage and calibration data */ +#if defined(CONFIG_SOC_SERIES_STM32U5X) + /* + * The VREF CALIBRATION value is acquired on 14 bits + * and the data acquired is on 12 bits + * since the adc_sequence.resolution is 12 + */ + vref = (cfg->cal_mv * (*cfg->cal_addr) >> 2) / data->raw; +#else vref = cfg->cal_mv * (*cfg->cal_addr) / data->raw; +#endif /* CONFIG_SOC_SERIES_STM32H5X */ /* millivolt to volt */ vref /= 1000;