Skip to main content
Associate III
June 15, 2024
Solved

STM32L432 Internal Temp Sensor

  • June 15, 2024
  • 8 replies
  • 4378 views

I'm trying to get the internal temperature sensor working on a custom board with an STM32L432KC. VDDA is 2.5V and is stable. The raw readings I'm getting are about 200 counts higher than I would expect on a 12bit config. The reading doesn't change based on temperature, usually I can see a 5 degree change if I shoot compressed air at the chip. I'm guessing I'm somehow reading a different ADC channel but I'm not exactly sure how to debug that. Attached are the register values after boot up.

Best answer by waclawek.jan

Also, judging from ADC_CR.ADCALDIF being set, and the fact that ADC_CALFACT contains nonzero value only for the differential field, you probably did not perform single-ended calibration.

JW

8 replies

PCarn.1Author
Associate III
June 15, 2024

I'm also using 

__LL_ADC_CALC_TEMPERATURE

to get the temperature. It currently returns 79 degrees.

AScha.3
Super User
June 16, 2024

So what you get from ADC ? (in hex)

Maybe, its ok - because typical values are at 3.0 Vdda ->

AScha3_0-1718530794244.png

but you have 2.5Vdda .

+

btw

Did you calibrate ADC ?

AScha3_0-1718531564047.png

 

"If you feel a post has answered your question, please click ""Accept as Solution""."
waclawek.jan
Super User
June 16, 2024

+1 to what @AScha.3  said above; some more possible sources of problems here.

JW

PCarn.1Author
Associate III
June 16, 2024

I understand the calibration values might be off. But I should still see the raw counts changing with major temperature changes, but I don't.

waclawek.jan
Super User
June 16, 2024

> I understand the calibration values might be off.

Why do you think the problem are the calibration values? I pointed you to a list, did you exclude all other sources of problems?

> I should still see the raw counts changing with major temperature changes, but I don't.

So, you read out the same value over and over?

JW

 

PCarn.1Author
Associate III
June 17, 2024

I don't think it's the calibration values. There is some variation in my readings but they are not affected by temperature changes. I have other ADC channels that are working so I know my ADC is on. There's a problem specific to the temperature sensor channel that I can't figure out. It almost seems like I'm reading a different a different ADC channel.

waclawek.jan
Super User
June 17, 2024

> There is some variation in my readings

How much?

> but they are not affected by temperature changes.

At all? And what are those temperature changes? Blowing air won't change internal temperature much, unless the chip is really hot on the surface.

Have you checked that all other items of the list I linked to are OK?

JW

Andrew Neil
Super User
June 17, 2024

@waclawek.jan wrote:

Blowing air won't change internal temperature much, unless the chip is really hot 


Or the air is significantly hotter (or colder) than the chip ...

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Andrew Neil
Super User
June 17, 2024

@PCarn.1 wrote:

usually I can see a 5 degree change if I shoot compressed air at the chip.


Some more info on this "usually" - same chip? same board?

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
PCarn.1Author
Associate III
June 17, 2024

12-bit resolution I'm seeing 1714 counts +/- 3 counts. I've set the temp sensor up on STM32G474s, F217s, L475s, and G431s, on all of them blowing compressed air on the chip can cool it down from it's ambient temp of 30C to 25C. 

Almost all of those points on the list can be ruled out when taking into account that the other ADC channels are working and not being concerned with conversion to degrees C yet. 

waclawek.jan
Super User
June 17, 2024

> I'm seeing 1714 counts +/- 3 counts

In the screenshot in your initial post I see DR=1439.

JW

PCarn.1Author
Associate III
June 17, 2024

The one point in that list that does apply can be checked by the photo of the registers posted above. Ch17 is enabled.

waclawek.jan
waclawek.janBest answer
Super User
June 17, 2024

Also, judging from ADC_CR.ADCALDIF being set, and the fact that ADC_CALFACT contains nonzero value only for the differential field, you probably did not perform single-ended calibration.

JW

waclawek.jan
Super User
June 17, 2024

Also, the 'L432 may run cooler (have lower power consumption) than the other chips, so blown air may have less influence at its die temperature.

JW