Skip to main content
Visitor II
March 6, 2025
Question

STM32L4 : why the voltage of temperature sensor drop down suddently while heating the MCU

  • March 6, 2025
  • 5 replies
  • 1120 views

Hi,

I'm working on a custom module based on a STM32L452CCU MCU.
I'm reading the temperature of the MCU (using ADC1 with DMA, temp is updated at 30Hz using a timer)

When I read the ADC value on a regular basis while heating the MCU, I can read a voltage going from 1600 up to 2300 or so (which should be someting like 105°C or so) which is OK

However, when I do the same with some external hardware enabled, while heating the MCU, the voltage suddently drop down when reachin a value of 2100 or so, it drops to 690 / 700 mV leading to a wrong temperature.

What could be the reason of this ?

Thanks

    This topic has been closed for replies.

    5 replies

    Super User
    March 6, 2025

    Internal temperature shouldn't be more than about 20 C above ambient. 105 C doesn't seem right unless this is in a thermal chamber.

    > What could be the reason of this ?

    Probably a code bug or misinterpretation of results. Internal temperature doesn't swing wildly.

    PierrePAuthor
    Visitor II
    March 6, 2025

    I'm using a Hot air station to reach 105 C. That how I can test over temperature.

    Graduate II
    March 7, 2025

    Hi, 

    How are you calculating the Temperature from the ADC Data Register ?. 

    Have you calibrated the Internal Temperature Sensor according to the Reference Manual. ?

    Graduate II
    March 7, 2025

    danielbathtub_0-1741335046711.pngdanielbathtub_1-1741335150219.png

    Are you following the procedure above ? 

    PierrePAuthor
    Visitor II
    March 7, 2025

    Hi,

    Thanks and yes I'm aware of the procedure and went over this several times. My implementation relies on the STM32 HAL.
    The point is not about the conversion and calibration (by the way, after conversion I'm seeing temperature around 20-23C at ambiant so no issue there) but realy about the temperature sensor voltage that increase until 2100mV or so when I heat the sensor (which is expected) but then switch ti 690-700 when I continue to heat the sensor.

    IF I only enable ADC and read the temperature in a loop, I can see values up to 2300 (which is around 105C); but IF I enable other HW subsystem on my module, I can't go above 2100mV, however, the system / FW works weel, only the value read from the sensor becomes incorrect when I heat the MCU; so really wierd ...

    Super User
    March 7, 2025

    @PierreP wrote:

    the temperature sensor voltage that increase until 2100mV or so when I heat the sensor (which is expected) but then switch ti 690-700 when I continue to heat the sensor. ...


    Sounds like a problem with an arithmetic overflow somewhere?

     


    @PierreP wrote:

    IF I enable other HW subsystem on my module, I can't go above 2100mV, .


    What "other HW subsystem" ?

    Is it the actual raw reading - direct from the ADC data register - which changes, or your calculated value?

    Graduate II
    March 10, 2025

    My suggestion is to log the ADC counts and the calculated temperature (in RAM during debugging or on PC by printing to UART/USART). Then use a spreadsheet to analyze it and verify/validate the calculation.
    I also recommend measuring the VDDA to make sure it doesn't change.
    The ADC needs to be calibrated during initialization.
    Make sure the ADC doesn't sample the temperature sensor too fast. There is a minimal number of clock cycles required for measuring the temperature sensor. This is listed in one of the datasheets (I forgot which one).