STMicroelectronics / STM32CubeH7

STM32Cube MCU Full Package for the STM32H7 series - (HAL + LL Drivers, CMSIS Core, CMSIS Device, MW libraries plus a set of Projects running on all boards provided by ST (Nucleo, Evaluation and Discovery Kits))
https://www.st.com/en/embedded-software/stm32cubeh7.html
Other
479 stars 298 forks source link

H730 ADC3: macros to calculate temperature and Vref voltage #259

Closed KubeckPL closed 11 months ago

KubeckPL commented 1 year ago

Caution In the macros in the Low-Layer library to calculate Vref voltage and MCU internal temperature, there is an error for the H730 processor.

__LL_ADC_CALC_VREFANALOG_VOLTAGE https://github.com/STMicroelectronics/STM32CubeH7/blob/b75d4ea0a368c0e2e7bb9c40c1258a39fff0919a/Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_ll_adc.h#L2417

__LL_ADC_CALC_TEMPERATURE: https://github.com/STMicroelectronics/STM32CubeH7/blob/b75d4ea0a368c0e2e7bb9c40c1258a39fff0919a/Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_ll_adc.h#L2471

Both of the above macros use another macro, which is __LL_ADC_CONVERT_DATA_RESOLUTION. In this macro, an ADC resolution of 16 bits is implemented. This configuration is not correct when the user uses ADC3 to measure temperature and Vref voltage, because ADC3 is of a resolution of 12 bits. Using a macro with 16-bit scaling leads to erroneous measurement results.

The __LL_ADC_CONVERT_DATA_RESOLUTION_ADC3 macro is defined in the Low-Layer library, but it is not used in any case: https://github.com/STMicroelectronics/STM32CubeH7/blob/b75d4ea0a368c0e2e7bb9c40c1258a39fff0919a/Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_ll_adc.h#L2359

Tools used:

Please analyze the problem.

Best regards.

RJMSTM commented 1 year ago

Hello @KubeckPL,

Thank you for this report. We will get back to you as soon as we analyze it further. This may take some time. Thank you for your comprehension.

With regards, Rania

RJMSTM commented 1 year ago

Hello @KubeckPL,

I have the impression that there is only one flash calibration value for all ADCs.

So

Regards, Rania

RJMSTM commented 1 year ago

Hello,

Please let us know your feedback so that we can help you.

With regards,

RJMSTM commented 11 months ago

Hello @KubeckPL ,

Please allow me to close this thread as no activity. You may reopen it at any time if you have any details to share with us in order to help you to solve the issue. Thank you for your comprehension.

With regards

KubeckPL commented 11 months ago

Hello. I am not sure how calibrated the ADC is.

But in CubeMX there is no option to configure reference voltage and temperature measurement for ADC1 for MCU H730: obraz

The only possibility is for ADC3: obraz

Check the operation of my program - the reference voltage connected to the MCU is 3.3V:

I have a feeling that the error is in the macro. RJMSTM can you please check this case?