cancel
Showing results for 
Search instead for 
Did you mean: 

STM32G070RB Vbat Data sheet error

MEder
Associate III

According to the data sheet, sec 3.13.3 says the VBAT voltage is measure by the ADC as VBAT/3, or one third Vbat.

using :

uint64_t volt = (uint64_t)(((uint64_t)3300U*adc_result)/(uint64_t)4095U);

I get 2/3 Vbat

Changing to uint64_t volt = (uint64_t)(((uint64_t)4950U*adc_result)/(uint64_t)4095U);

I logged the following

Vin Measured

0.500 684 (seems to be the lowest it goes)

1.000 997

1.500 1496

2.000 1999

2.500 2496

3.000 2992

3.500 3.492

Then in RM0454, 14.3.6 VBat/3, and 14.10 Digital value is half the Vbat voltage. While Showing Vbat/3.

But I clearly see Vbat *2/3 from the ADC. Data sheet error?

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
MEder
Associate III

Found the Issue, I set the OVSE bit in the CFGR2 , instead of the CKMODE bits. So it was performing a left shift in the DR reg, doubling the value.

Now I get the Proper 1/3 Vbat voltage.

Thanks for the help.

View solution in original post

6 REPLIES 6

What's your ADC reference voltage?

JW

it is 3.3v.

Uwe Bonnes
Principal III

Did you perhaps set differential mode?

I checked the data sheet and RM0454 and I dont see a Differential mode.

I will check the configuration, ADCAL etc.

MEder
Associate III

Found the Issue, I set the OVSE bit in the CFGR2 , instead of the CKMODE bits. So it was performing a left shift in the DR reg, doubling the value.

Now I get the Proper 1/3 Vbat voltage.

Thanks for the help.

Thanks for coming back with the solution. Please select your post as Best so that the thread is marked as solved.

JW