Getting temperature from STM32G491x internal temperature sensor ADC
How to get temperature (degC) from the STM32G491x internal temperature sensor?
I have my ADC working and producing raw count values. Eg: 303.
So assuming a working voltage of 3V3 and maximum count value of 4095 then I assume that I must multiply the raw count value by (3.3 / 4095).
But then what? I cannot find any reference to a gain value.
Also, I understand that calibration is required. I used pointers to dereference the TC_CAL1 and TC_CAL2 addresses given in the DS13122 Rev 3 datasheet. (0x1FFF 75A8 - 0x1FFF 75A9).
uint8_t * TC_CAL1;
uint8_t * TC_CAL2;
TC_CAL1 = 0x1FFF75A9;
TC_CAL2 = 0x1FFF75A8;
Calibration1 = *TC_CAL1;
Calibration2 = *TC_CAL2;Although the documentation does not say, I assume that these are the high and low values of a 16-bit value?
Then question is how to apply the calibration value? Should I add or subtract it from the final value derived from the raw value?
Please help.
