2019-04-30 05:45 AM
Using a STM32G071RBT6 on a Nucleo-64 board. Board is powered by its USB port.
According to user manual schematic VREF+ is connected to VDD (jumpers are installed).
At CN6.4 (VDD) we measure 3.322 V against CN6.6 (GND).
ADC is calibrated, CALFACT varying between 0x2A and 0x2B.
Sampling is max (160.5 us), and conversions single/polling.
Now trying to measure VDDA according to User Manual Chap. 14.9:
"The embedded internal voltage reference (VREFINT) and its calibration data acquired by the ADC during the manufacturing process at VDDA = 3.3 V can be used to evaluate the actual VDDA voltage level.
The following formula gives the actual VDDA voltage supplying the device: VDDA = 3 V x VREFINT_CAL / VREFINT_DATA."
3.0 V or 3.3 V... ?
We read
for VREFINT_CAL: 0x0683
for VREFINT_DATA (CH13) we read 0x05D6
Calculated VDDA gives 3.679 V (3.3V) or 3.345 (3.0V).>
What is wrong ?
Also problem with internal temperature sensor:
TS_CAL1 reads 0x0407, TS_CAL2 reads 0x055F.
TS_DATA (CH12) reads 0x03E0 (Nucleo board open air on desktop).
With formula we get -301.37 °C (VDDA==3.345V)...
What' wrong here ?
Regards Juergen
2019-08-09 12:59 AM
@JuM Did you find out what is wrong? I also have a problem with STM32G0 and ADC.
My Vintref measure is incorrect.
2019-08-12 01:31 AM
Hi Olek, had these problems
void ADCSetVref2500 (void)
{
uint32_t temp32;
//---- Enable clock for VREFBUF ----//
//
temp32 = RCC->APBENR2;
temp32 |= (RCC_APBENR2_SYSCFGEN);
RCC->APBENR2 = temp32;
temp32 = VREFBUF->CSR; // should be 0x0000 0002 (HIZ==1) after Reset
temp32 &= ~(VREFBUF_CSR_VRR | VREFBUF_CSR_VRS | VREFBUF_CSR_HIZ | VREFBUF_CSR_ENVR);
VREFBUF->CSR = temp32;
//---- 2.500 V connected to pin VREF+ ----//
//
temp32 |= (VREFBUF_CSR_ENVR | VREFBUF_CSR_VRS); // ENVR == 0x01 , VRS == 0x04
VREFBUF->CSR = temp32;
} // of void ADCSetVref2500 (void)
2020-10-23 04:21 AM
Hi @JuM, @Community member
Did you try to calibrate the ADC before?
HAL_StatusTypeDef HAL_ADCEx_Calibration_Start(ADC_HandleTypeDef* hadc)