Skip to main content
Explorer
April 17, 2024
Question

STM32H723 ADC3 with VREF+ at 3 v

  • April 17, 2024
  • 1 reply
  • 1130 views

All:

We have a custom board with STM32H723 where VREF+ is set to 3 volts.

When I feed ADC3 input 2 with a value of 0 volts, I get 118 counts on the 12-bit ADC,

  1.48 volts gives 1385 counts, and 2.95 volts gives 2600 counts.

Earlier work with Nucleo board with STM32h723 had VREF+ set to 3.3 volts.

Same inputs: ADC3 input 2 with a value of 0 volts gives 12 counts on the 12-bit ADC,

   1.65 volts gives 2090 counts, and 3.3 volts gives 4075 counts.

I was expecting to see similar values when I switched from Nucleo to custom.

I am running  HAL_ADCEx_Calibration_Start( ) at power up.

The ADC is set up not to use DMA, so I send the following every 50 msec:

ADC_Select_Temperature();
HAL_ADC_Start(&hadc3);
HAL_ADC_PollForConversion(&hadc3, HAL_MAX_DELAY);
temp_value = HAL_ADC_GetValue(&hadc3);
HAL_ADC_Stop(&hadc3);

 Is there a setup step needed for change in VREF+ or should that be transparent?

Regards,

Todd Anderson

    This topic has been closed for replies.

    1 reply

    ToddAAuthor
    Explorer
    April 18, 2024

    Update:

    Here is the setup code to get data from channel 2 (similar to the ADC setup for temperature).

    /* Select input channel. */
    ADC_Select_CH2( );
    /* Start ADC */
    HAL_ADC_Start(&hadc3);
    /* wait for conversion to finish. */
    HAL_ADC_PollForConversion(&hadc3, HAL_MAX_DELAY);
    /* Get value */
    adc_value = HAL_ADC_GetValue(&hadc3);
    /* Stop ADC */
    HAL_ADC_Stop(&hadc3);

     

    ToddAAuthor
    Explorer
    April 18, 2024

    Further update - when I changed the sample time from original (ADC3_SAMPLETIME_2CYCLES5) to higher values, the ADC value also changed. I have seen that ADC3_SAMPLETIME_247CYCLES5 works well, any higher sample times give no additional benefit.

    Here is what I am seeing:

     Nucleo with 3.3 v VREF+                  

     4075 counts at 3.3 v (max)   [ideal 4095 counts]         

     2040 counts at 1.65 v           [ideal 2047 counts]

     12 counts    at 0v

     

    Custom board with 3.0 v VREF+

    3945 counts at 3.0 v (max)

    1910 counts at 1.5 v

    0 counts  at 0v

     

    This is much closer to the ideal than I was originally seeing.

    Regards,

    Todd Anderson