Skip to main content
Texram
Associate III
Jul 8, 2022 7:27 PM UTC
Question

NUCLEO-L073RZ, On-chip Temperature Sensor reading problem.

We are using NUCLEO-L073RZ board and configured ADC Temperature Sensor through STMCubeMX. And we used the temperature calculation formula from the section A.8.17 of RM0377 Rev 10 (STM32L0x Reference Manual)

At room temperature (around 22 – 25 degree in C), the ADC count from Temperature Sensor channel is around 0x628. Based on the temperature calculation formula, temperature is around 343 degree in C, which is incorrect.

Do we miss any configuration or the temperature calculation formula from the section A.8.17 is incorrect?

We are also using STM32Fxxx and STM32L1xx MCUs, but we don’t have any issue on reading ADC Temperature Sensor.

Thanks

David

This topic has been closed for replies.

4 replies

waclawek.jan
Super User
Jul 8, 2022 8:47 PM UTC

Do you perform ADC calibration as outlined in RM, before taking the measurement? Do you observe timing after switching on temperature sensor and sampling time given in DS? What is VREF+ pin voltage? What is the ADC readout for internal VREFINT reference? And what are vales of TS_CALx constants in system memory?

JW​

Texram
TexramAuthor
Associate III
Jul 11, 2022 11:34 PM UTC

Hi, JW

Thank you for looking into the issues.

the ADC readout for internal VREFINT reference is around 0x25F, and VREFINT_CAL (from 0x1FF80078) is 0x681.

HAL_ADCEx_Calibration_Start() is called right after ADC channel configuration

Since there is no pin for Vref+ on NUCLEO-L073RZ board, Vref can't be measured. Do you have any other way to measure Vref+ on board?

A few different sampling frequencies/times have been tried, and no difference was seen. Currently, ADC_SAMPLETIME_19CYCLES_5 is used.

BTW, PC/USB power is used for the board. And a few other NUCLEO-L073RZ boards have been tried and got the same issues.

Any other inputs will be appreciated!

waclawek.jan
Super User
Jul 12, 2022 10:29 AM UTC

You appear to have swapped the VREFINT and temperature channels - 0x25F corresponds to value expected for temperature measurement at around 20deg.C, and 0x628 is the approximate value expected for the VREFINT channel at VREF+ somewhat below 3.3V.

JW

Texram
TexramAuthor
Associate III
Jul 12, 2022 5:08 PM UTC

Hi JW,

You are right, I got temperature channel and Vrefint channel swapped. In all other STM uCs that we used, temperature channel is placed before Vrefint channel.

Thanks for the help !

David