STM32G4 temperature internal sensor gives wrong reading when fast sampled
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-06-19 3:53 PM
Hi All,
As is the topic. Maybe someone else is stuck with the same problem?
I wasted the last few days trying to find why my code is giving wrong (to low) temperature readings but it looks like a device limitation. I try to isolate the test case but in the meantime maybe someone else can confirm or point me to some information why sampling the internal temperature sensor with short time gives incorrect values.
To low I mean values below zero ...
Regards,
Pawel
Solved! Go to Solution.
- Labels:
-
ADC
-
STM32G4 Series
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-06-19 4:05 PM
How fast? There's a minimum sampling time requirement per the datasheet, you're probably running into that. Also a start-up time.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-06-19 4:05 PM
How fast? There's a minimum sampling time requirement per the datasheet, you're probably running into that. Also a start-up time.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-06-19 10:43 PM
You are right.
I started with default stm32cubeide values which is 15 cycles per ADC conversion, prescaler equal 4 and 170MHz clock.
Its interesting that temperature reading is ok if you mix one slow conversion (650) with fast ones.
I didn't read LL_ADC_SetChannelSamplingTime function description:
* @note In case of internal channel (VrefInt, TempSensor, ...) to be
* converted:
* sampling time constraints must be respected (sampling time can be
* adjusted in function of ADC clock frequency and sampling time
* setting).
* Refer to device datasheet for timings values (parameters TS_vrefint,
* TS_temp, ...).
Repository with my test:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-06-20 12:30 AM
Also, note the Wrong ADC result if conversion done late after calibration or previous conversion erratum.
JW
