Skip to content

Commit d43dcec

Browse files
committed
fix(u0): VREFINT_CAL value is not programmed during production
Signed-off-by: Frederic Pillon <[email protected]>
1 parent 2e82ca1 commit d43dcec

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

examples/Peripherals/ADC/Internal_channels/Internal_channels.ino

+7
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,13 @@ void setup() {
5454

5555
static int32_t readVref()
5656
{
57+
#ifdef STM32U0xx
58+
/* On some devices Internal voltage reference calibration value not programmed
59+
during production and return 0xFFFF. See errata sheet. */
60+
if ((uint32_t)(*VREFINT_CAL_ADDR) == 0xFFFF) {
61+
return 3300U;
62+
}
63+
#endif
5764
#ifdef __LL_ADC_CALC_VREFANALOG_VOLTAGE
5865
#ifdef STM32U5xx
5966
return (__LL_ADC_CALC_VREFANALOG_VOLTAGE(ADC1, analogRead(AVREF), LL_ADC_RESOLUTION));

0 commit comments

Comments
 (0)