From f12559685fc137cc3edcb2be413f5c7f6eeb02da Mon Sep 17 00:00:00 2001 From: Frederic Pillon Date: Mon, 26 Aug 2024 11:18:13 +0200 Subject: [PATCH] fix(u0): VREFINT_CAL value is not programmed during production Signed-off-by: Frederic Pillon --- .../ADC/Internal_channels/Internal_channels.ino | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/examples/Peripherals/ADC/Internal_channels/Internal_channels.ino b/examples/Peripherals/ADC/Internal_channels/Internal_channels.ino index 373e8d9..35644dc 100644 --- a/examples/Peripherals/ADC/Internal_channels/Internal_channels.ino +++ b/examples/Peripherals/ADC/Internal_channels/Internal_channels.ino @@ -54,6 +54,13 @@ void setup() { static int32_t readVref() { +#ifdef STM32U0xx + /* On some devices Internal voltage reference calibration value not programmed + during production and return 0xFFFF. See errata sheet. */ + if ((uint32_t)(*VREFINT_CAL_ADDR) == 0xFFFF) { + return 3300U; + } +#endif #ifdef __LL_ADC_CALC_VREFANALOG_VOLTAGE #ifdef STM32U5xx return (__LL_ADC_CALC_VREFANALOG_VOLTAGE(ADC1, analogRead(AVREF), LL_ADC_RESOLUTION)); pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy