2024-04-20 12:17 PM - last edited on 2024-04-20 01:20 PM by SofLit
Hi, I'm using STM32F767ZG on a development board (Fusion for STM32 V8 by Mikroelectronica).
My problem is that all ADCs will read 4095 for the first 2.3 seconds after power on. If I perform a reset on the uC, they read correctly from the first read. Also, if I power down, hold the reset button, then power on and wait ~3 second and then release the reset button, they will read fine immediately.
I suspect that the analog reference voltage on the uC on the board has an issue stabilizing quick enough, but 2.3 seconds seems waaaay too big.
Sample code:
ADC_ChannelConfTypeDef sConfig = {0};
hadc1.Instance = ADC1;
hadc1.Init.ClockPrescaler = ADC_CLOCK_SYNC_PCLK_DIV2;
hadc1.Init.Resolution = ADC_RESOLUTION_12B;
hadc1.Init.ScanConvMode = DISABLE;
hadc1.Init.ContinuousConvMode = ENABLE;
hadc1.Init.DiscontinuousConvMode = DISABLE;
hadc1.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE;
hadc1.Init.ExternalTrigConv = ADC_SOFTWARE_START;
hadc1.Init.DataAlign = ADC_DATAALIGN_RIGHT;
hadc1.Init.NbrOfConversion = 1;
hadc1.Init.DMAContinuousRequests = DISABLE;
hadc1.Init.EOCSelection = ADC_EOC_SEQ_CONV;
HAL_ADC_Init(&hadc1);
sConfig.Channel = ADC_CHANNEL_TEMPSENSOR;
sConfig.Rank = 1;
sConfig.SamplingTime = ADC_SAMPLETIME_3CYCLES;
HAL_ADC_ConfigChannel(&hadc1, &sConfig);
HAL_ADC_Start(&hadc1);
HAL_ADC_PollForConversion(&hadc1, HAL_MAX_DELAY);
voltage_adc = HAL_ADC_GetValue(&hadc1); // Always 4095 for the first 2.3 seconds
Solved! Go to Solution.
2024-04-20 11:30 PM
Yup is the analog reference voltage as I suspected. I can't believe a development board has an issue like this. Case closed.
2024-04-20 01:19 PM - edited 2024-04-20 01:41 PM
Hi,
did you check ( with a scope ) the AVDD and AREF voltages and their rise time ?
+
same for ADC input (at pin) you convert .
2024-04-20 11:30 PM
Yup is the analog reference voltage as I suspected. I can't believe a development board has an issue like this. Case closed.