cancel
Showing results for 
Search instead for 
Did you mean: 

calculating temperature for STM32L451 - tried both methods, but don't get correct readings

MFend
Associate III

According to the data sheet, the calibrated values for specific chip (at 30°C and 130°C) are at the following addresses:

#define TEMP30_CAL_ADDR  (*((uint16_t*)0x1FFF75A8))
#define TEMP130_CAL_ADDR (*((uint16_t*)0x1FFF75CA))

0693W00000BabFnQAJ.jpgTherefore the calculation should be :

        fCalTemperature_DegreeCelsius = (((130.0f - 30.0f) / (TEMP130_CAL_ADDR - TEMP30_CAL_ADDR)) * (ADC_TempReading - TEMP30_CAL_ADDR)) + 30.0f;

The problem is that in memory the values don't seem to be correct:

0693W00000BabLqQAJ.jpgI'd appreciate any help.

Thanks,

Mechi

11 REPLIES 11
MFend
Associate III

Yes. Thank you - that's definitely the correct equation.

Mohamed Aymen HZAMI
ST Employee

Hello @MFend,

Please mark the helped reply as Best answer in order to help other users find the answer quickly.

Mohamed Aymen