2023-11-22 05:04 AM - edited 2023-11-22 05:14 AM
I read the messages in here about wrong temperature values including code examples, but still getting wrong values:
I need to measure the internal CPU temperature sensor from the STM32H743XIH6. I activated the ADC3 using STM32CUBEMX (V. 6.9.2) and selected Temperature Channel.
However the calculated temperatures are far too high (140-170):
ADC input clock is set to 37.5 MHz
read T1_30 - address: 0x1FF1E820 - getting value: 0x3064
T1_110 - address: 0x1FF1E840 - getting value: 0x4023
reading GetValue - HAL_ADC_GetValue: 0x4783, 0x4a04, 0x4c68
it is grater than T1_110, how come?!
Mpu internal Temperature: GetValue=0x4783, T1_110=0x4023, T1_30=0x3064
Mpu internal Temperature: 147.47
Mpu internal Temperature: GetValue=0x4a04, T1_110=0x4023, T1_30=0x3064
Mpu internal Temperature: 160.19
Mpu internal Temperature: GetValue=0x4c68, T1_110=0x4023, T1_30=0x3064
Mpu internal Temperature: 172.34
see code below
Any help is very much appreciated!
thanks in advanced
2023-11-22 05:13 AM
You can Use HAL_ADC_GetState to check the ADC state during different stages of your code execution. This can help identify where the issue might be occurring.
2023-11-22 06:11 AM
it seems the state is 0x0201 all the time:
#define HAL_ADC_STATE_REG_EOC (0x00000200UL) /*!< Conversion data available on group regular */
#define HAL_ADC_STATE_READY (0x00000001UL) /*!< ADC peripheral ready for use */
but the case after I call HAL_ADC_Start:
the state is 0x0100:
#define HAL_ADC_STATE_REG_BUSY (0x00000100UL) /*!< A conversion on ADC group regular is ongoing or can occur (either by continuous mode, external trigger, low power auto power-on (if feature available), multimode ADC master control (if feature available)) */
looks O.K
2023-11-22 06:40 AM
What board is this? What is VREF+ on your board?
2023-11-22 07:38 AM - edited 2023-11-22 08:33 AM
The TS_CAL2 values are different between rev Y and rev V devices. See the Data Sheet Sections 6 and 7.
2023-11-23 07:52 AM
I disabled the OversamplingMode and now reading GetValue - HAL_ADC_GetValue: 0x351a, 3527
which is Mpu internal Temperature: 53-54 degrees
is this make sense?
2023-12-06 08:29 AM - edited 2024-03-22 02:42 AM
Hi @Roni and welcome to the community :),
For the Oversampling Mode issue, this is a known issue, already reported in STM32H723 ADC Oversampling code generation bug - STMicroelectronics Community.
This code line in generation code is wrong:
hadc3.Init.Oversampling.Ratio = 256;
and should be
hadc3.Init.Oversampling.Ratio = ADC3_OVERSAMPLING_RATIO_256;
Internal ticket number: 176763 (This is an internal tracking number and is not accessible or usable by customers).
Thank you.
Kaouthar
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.