cancel
Showing results for 
Search instead for 
Did you mean: 

Reading ADC3 VREF, VBAT and VTEMPERATURE on NUCLEO-H743ZI with STM32H743xI MCU - Cannot find any H7 references to the VREFINT_CAL_ADDR to determine Factory burnt VREFINT_CAL value for VDD calculation; same with TEMPSENSOR_CAL1_ADDR and _CAL2_ADDR

SWood.8
Associate III

I have managed to get ADC working in Interrupt mode and can read the three sensors values into a buffer called ADC3_VALUES[] on each of 3 callback events triggered by the ADC....

/* USER CODE BEGIN 1 */

void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc)

{

      if(hadc->Instance == ADC3)

      {

            /* Return ADC converted value -> return hadc->Instance->DR;*/

            ADC3_VALUES[iRankCounter++] = HAL_ADC_GetValue(&hadc3);

            if(iRankCounter == 2) PIP_BUSY = PIP_NOT_BUSY;

      }

}

PIP_BUSY is just a local flag used to determine if all 3 integer values have been read. Read is Once only (Single Conversion) triggered with HAL_ADC_Start_IT(&hadc3);

All references I find for things like STM32L4 or F7 (e.g. STM32L4xx_HAL_Driver) look like this or similar:

#define VREFINT_CAL_ADDR          ((uint16_t*) ((uint32_t)0x1FFF75AA)) 

#define VREFINT_CAL_VREF          ((uint32_t) 3000)          

#define TEMPSENSOR_CAL1_ADDR        ((uint16_t*) ((uint32_t)0x1FFF75A8))

#define TEMPSENSOR_CAL2_ADDR        ((uint16_t*) ((uint32_t)0x1FFF75CA)) 

#define TEMPSENSOR_CAL1_TEMP        (( int32_t)  30)           

#define TEMPSENSOR_CAL2_TEMP        (( int32_t) 110)          

#define TEMPSENSOR_CAL_VREFANALOG     ((uint32_t) 3000)           

This address 0x1FFF75AA when called in something like...

uint16_t vrefCal;

vrefCal = *((uint16_t*)VREFINT_CAL_ADDR);

...simply throws a void HardFault_Handler(void) stm32h7xx_it.c

Have tried a load of addresses including 0x1FF07A4A 0x58003C00 0x1FFF75AA 0x1FFFF7BA from various example projects.

I would very much like a STM32H7 friendly version of something like Damien George's https://gitrepos.estec.esa.int/taste/uPython-mirror/blob/e72353cc48f1ac2869458625aa0ebae7b6bfe24f/stmhal/adc.c

Basically need to read factory CALIBRATION values and use them to prepare float variables containing VBat VRef and Vdd in Volts (%.2f)

Can anyone point me in the right direction ?

2 REPLIES 2
Uwe Bonnes
Principal III

Look in the datasheet STM32H743xI Table 28. Internal reference voltage calibration values

TV
Associate II

I know this is old, just writing this for anyone else that runs into the problem and don't want to wade through a lot of code...

1) Look at section 24.4.33 of the reference manual for these parts

2) Calibration values are in the datasheet, just search for TS_CAL1 and TS_CAL2