cancel
Showing results for 
Search instead for 
Did you mean: 

Possible ADC VREF HAL calibration scaling issue in __LL_ADC_CALC_DATA_TO_VOLTAGE for H723

Ultrawipf
Associate

Note: Firmware package H7 V1.10.0

 

On the STM32H723 the internal vref and temp channels are connected to ADC3 which is a 12b ADC while ADC1 and 2 are 16b.

The internal calibration values for the temperature sensor and vref are also scaled in 12b it seems but the HAL

Macros __HAL_ADC_CALC_VREFANALOG_VOLTAGE (in stm32h7xx_hal_adc.h) or __LL_ADC_CALC_DATA_TO_VOLTAGE (in stm32h7xx_ll_adc.h) assume a scaling in 16b resulting in incorrect readings if the actual adc resolution of 12b is passed to these macros instead of 16b.

Passing a resolution of 16b and the actually 12b value from ADC3 to these functions results in a correct value.

The same also applies to the macro __LL_ADC_CALC_TEMPERATURE and possibly others.

 

The comment to __LL_ADC_CALC_DATA_TO_VOLTAGE  states:
"On this STM32 series, calibration data of internal voltage reference
* VrefInt corresponds to a resolution of 16 bits" which is incorrect for this chip in this case.

The vref calibration value on one specific chip here is 0x5F1 = 1521 which is as expected close to what the 12b adc reads on the vref channel when powered by 3.3v.

2 REPLIES 2
Ghofrane GSOURI
ST Employee

Hello @Ultrawipf 

First let me thank you for posting.

Could you please use the latest CubeMX version 6.9.2 and Firmware package H7 V1.11.1 and see if you still facing the same issue mentioned above .

I will be waiting for your feedback.

Thx

Ghofrane

Ultrawipf
Associate

After updating STM32CubeIDE to 1.15 (FW package V1.11.2, CubeMX 6.11.0) and regenerating the code from the ioc file i noticed that the vrefint channel is now suddenly only selectable on ADC2 and the temperature sense channel completely gone which breaks the previous ADC3 mappings making ADC3 completely redundant.

Selecting vrefint for ADC2 in this case does not generate any code and the adc channel remains unused.

Is this related to this issue or a software bug in that version? Probably a separate cubemx bug.