Showing results for 
Search instead for 
Did you mean: 

ADC in STM32H743ZI does not work



I am trying to run a 16-bit ADC on a Nucleo-H743ZI2 debug board. The measured voltage is DC, 1.25 Volts, obtained from the DAC output of the controller. ADC1 input is channel 5 (pin PB1 on the CN7 board connector is close to GNDA pin and a 6.8 µF tantalum capacitor is included between them). The measurement result is output every 0.3 seconds via USART3 to the terminal program on the PC. For programming I use CubeMX + IAR Workbench. Memory Protection Unit is enabled in the controller, as well as both caches: CPU ICache and CPU DCache. In the program generated by CubeMX, the internal voltage source VREFINT = 2.5 Volt is enabled. Fosc = 100 MHz. Asynchronous clock mode divided by 4. I used “Regular conversion launched by software”  with “End of single conversion” and Sampling time = 8.5 cycles. Scan, continuous and discontinuous conversion modes – all of these modes have been disabled.

ADC1 is enabled as follows:

1) MX_ADC1_Init();

2) ADC_Disable(&hadc1);

3) ADC1->CR &= ~ADC_CR_DEEPPWD;     // Deep-power-down disable;

4) ADC1->CR |= ADC_CR_ADVREGEN;       // LDO enable;

5) ADC1->CR |= ADC_CR_BOOST;              // Boost Mode enable (Fosc > 20 MHz);


7) ADC_Enable(&hadc1).

Initialization and connection of ADC1, Channel 5, are finished.

Of course, the results of execution of the functions specified in items 3 and 4 are checked in the corresponding loops.

Next, an infinite loop is enabled in which the ADC is started by the HAL_ADC_Start_IT(&hadc1) function. At the end of the measurement the interrupt calls the colback:

void  HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc) {

 if (hadc->Instance  ==  ADC1)  {


                              INTADC = 1;


  } ,

where  the bit “volatile bool INTADC”  tells the program that the ADC conversion is finished and the result can be obtained:

__IO uint32_t uhADCxConvertedValue  =  HAL_ADC_GetValue(&hadc1);

Now, reset the INTADC bit and send the result via USART3 to the PC. However, instead of the expected measurement results, the screen displays random numbers in the range of approximately 8000 to 14000. If the ADC reference voltage = 2.5 Volts and the ADC input is 1.25 Volts, I expected to see a measurement result of about 32767 for a 16-bit ADC. However, I get a sequence of numbers that look like random numbers!

What have I left out of the program or turned on incorrectly?   Please help!