2023-10-19 12:16 AM
Steps to read the temperature calibration values from the stm32l152rc
Solved! Go to Solution.
2023-10-19 07:56 AM
uint16_t cal1, cal2;
cal1 = *(uint16_t*)TEMPSENSOR_CAL1_ADDR_CMSIS;
cal2 = *(uint16_t*)TEMPSENSOR_CAL2_ADDR_CMSIS;
TEMPSENSOR_CAL1_ADDR_CMSIS and TEMPSENSOR_CAL2_ADDR_CMSIS are defined in the CMSIS-mandated device header.
JW
2023-10-19 01:09 AM
In the datasheet for your particular STM32 model, look up TS_CAL1 and TS_CAL2 addresses, and then read a halfword from that address.
Maybe related to this thread?
JW
2023-10-19 01:25 AM
Why is there two addresses corresponding to CAL1 and CAL2
2023-10-19 03:36 AM
Each TS_CALx is 16-bit so it occupies two bytes.
JW
2023-10-19 06:40 AM
Can I get an example souce code to read TS_CAL1 and TS_CAL2 addresses.
2023-10-19 07:56 AM
uint16_t cal1, cal2;
cal1 = *(uint16_t*)TEMPSENSOR_CAL1_ADDR_CMSIS;
cal2 = *(uint16_t*)TEMPSENSOR_CAL2_ADDR_CMSIS;
TEMPSENSOR_CAL1_ADDR_CMSIS and TEMPSENSOR_CAL2_ADDR_CMSIS are defined in the CMSIS-mandated device header.
JW
2023-10-19 10:33 PM
Thank You!!:hundred_points:
2023-10-20 02:10 AM
One more thing. The Calibration value shows 666 and 849 for 30°C and 110°C respectively. But when I tried to read it using the inbuilt ADC channel the value shows 680 for 25°C. What may be the reason?
2023-10-20 08:05 AM
Different VREF+/VDDA voltage than 3.0V, or some other reason.
JW
2023-10-22 03:50 AM
As often, only few families have this data. I see it for F7 and L1. This non-orthogonality is a pity.