My vdd readout is high. Using Vrefint ADC channel.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-01-04 10:51 AM
Hi,
My vdd calculates to 3.49V but I measure it to 3.30V with a voltmeter.
The Vrefint calibration value at 0x1FFFF7BA is 1550.
The ADC value I read is 1465, fluctuating +/- 1.
Calculation is 3.3V * VrefintCalValue / AdcValue = 3.49V
I'm guessing it's my adc read value that is off, not the factory calibration value?
MCU is STM32F042G6Ux. ADC code is done in CubeMX.
ADC is clocked with a prescaler of /4 and sampletime is 239.5 cycles. So all signals should have plenty of time to settle between samples.
Code is inside this link ->
Solved! Go to Solution.
- Labels:
-
ADC
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-03-19 5:29 AM
Usually a bandgap is a structure of transistor which factor out the first order dependency from supply voltage and temperature. Usually around 1.23v it depends on the transistor intrinsic properties (not an expert, this is my rough understanding). The vdd measurement is very handy to convert your analog measurement into milivolt... You need to know if vdda is 3v or 3.3v or 3.6v otherwise no need 12 bit adc...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-03-19 5:42 AM
Thanks for your reply.
If I am running the processor at 2.5v, I assume the below calculation would stay the same as the calibration value (VREFINT_CAL) was set when the VDD was 3.3v?
If my VDD was powered by 2.5v, the below would tell me the exact voltage of the VDD on the processor?
V DDA = 3.3 V x VREFINT_CAL / VREFINT_DATA
Scott
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-03-29 9:40 AM
Hi
As a newbie I am just getting used to the system, and liked the 'Link To Code' above where it shows your code. Would it be possible to add the code you have for the a/d calibration? I am too getting 3.49v, but think I need the calibration.
Many Thanks
Scott
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-03-30 4:31 AM
I'm trying to use the ''Synatx highlighter'' function of the forum instead. If you're using HAL, simply do as I do; add the lineHAL_ADCEx_Calibration_Start(&hadc); after ADC initialization, before you start the ADC. See line number 21 below.
int main(void)
{
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/* MCU Configuration----------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* Configure the system clock */
SystemClock_Config();
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_DMA_Init();
MX_ADC_Init();
MX_USB_DEVICE_Init();
/* USER CODE BEGIN 2 */
HAL_ADCEx_Calibration_Start(&hadc);
HAL_ADC_Start_IT(&hadc);
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
HAL_Delay(1000);
while (1)
{�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?
Edit:
To whoever is reviewing my post: Why is this happening to me, all of a sudden? That my posts needs reviewing.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-03-30 6:09 AM
The person who reviewed my post obviously didn't read it, since I don't see a reply to my question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-03-30 7:14 AM
That isn't the purpose of a moderation review, which is to check for spam, or offensive or illegal content.
Most links and formatted code now get reviewed due to recent spam levels.
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-05-29 6:05 PM
I ran into the same problem, where the results of my voltage calculation for Vdda as well as other ADCs using the VREFINT are off by 5-6 mV. I solved my issue by decreasing the adc sampling rate which was 1.5 adc clock cycle to 55.5 adc clock cycle, and now it's only off by ~ 1mV. I think the reason being the adc might need more time to charge up its cap depending on the resistance of the adc line. Hope this help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-11-13 3:32 AM
Hi!
VREFINT_CAL is the result of conversion of 3.0 V by the ADC. So you should use 3.0 instead of 3.3 in you calculations.
I have the following formula in the reference manual for stm32l476:
VDDA = 3.0 V x VREFINT_CAL / VREFINT_DATA
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-05-23 7:22 AM
I read the whole post and your one sentence gave me the solution. This was the answer that I was looking for. Thank you very much sir.

- « Previous
-
- 1
- 2
- Next »