Temperature and ADC temperature raw value increase but temperature from formula decreases
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-03-11 04:28 AM
Hi,
I'm using STM32G070RBTx, and I use this formula from document RM0360 to compute temeperature:
From page 56 of document https://www.st.com/resource/en/datasheet/stm32g070cb.pdf, I'm using:
Avg_Slope = 2.5 and V30 = 0.76.
The temperature converted value I obtain at ambient temperature appears reasonable ( 21 °C approx. ) but when the temperature increases the raw value I get from ADC also increases but using formula above gives a decreasing temperature value and this is wrong.
Please help.
Solved! Go to Solution.
- Labels:
-
STM32CubeMX
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-03-11 05:45 AM - edited ‎2024-03-11 05:46 AM
Perhaps you are using an older version of the RM. Here it what the current version says:
This is the same as your formula except the sign on V30 and V_SENSE has changed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-03-11 05:45 AM - edited ‎2024-03-11 05:46 AM
Perhaps you are using an older version of the RM. Here it what the current version says:
This is the same as your formula except the sign on V30 and V_SENSE has changed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-03-12 07:28 AM - edited ‎2024-03-12 07:35 AM
Thanks TDK for reply, a couple of questions:
1) is VDDA in the formula the voltage power supply I use to power my board, that is 3.3 V, or is the voltage power supply used during factory calibration that is 3.0 V ?
2) in the formula provided shouldn't be Sense_DATA = TS_DATA / VDDA * 3.3 ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-03-12 07:34 AM
Your actual VDDA value.
PS: This is NOT an online support (https://ols.st.com) but a collaborative space. So please be polite in your reply. Otherwise, it will be reported as inappropriate and you will be permanently blacklisted from my help/support.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-03-12 07:48 AM
1) "VDDA" in the calculation should be VREF+ on the board you are taking the ADC measurement on (your board).
2) No, I don't think so. But it should be 3.0 V since that's what the TS_CAL was taken at.
A better formula would be:
- TS_DATA = V_TS * 4096 / VREF+
- (TS_CAL1 = V_TS30 * 4096 / TS_CAL1_VREF+)
- SENSE_DATA = TS_DATA * VREF+ / TS_CAL1_VREF+
- TEMP_C = (SENSE_DATA - TS_CAL1) / AVG_SLOPE + TS_CAL1_TEMP
Where TS_CAL1 is read from memory, TS_CAL1_VREF+ (3.0) and TS_CAL1_TEMP (30 C) are taken from the datasheet.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-03-12 08:56 AM - edited ‎2024-03-12 09:38 AM
Thanks for helping, the formula provided appears to be working fine.