I am trying to get the MCU temperature on an
TTSENS_CODE(TLOW) is 0x1647(-40C)
TTSENS_CODE(THIGH) is 0x1D61(150C)
VBG_CODE(TLOW) is 0xF7F
Temperature sensor is ch 128 and returns values roughly 0x16A0 at room temperature/normal running.
Bandgap is ch 45 and returns values roughly 0x1000.
When temperature formula is applied (MPC5644ARM pp 1231), (TTSENS_CODE(T) X B) calculates to a value less than TTSENS_CODE(TLOW) which should be impossible. The reading from ch 128 when bandgap adjusted is below the -40C value. What is wrong?
eQADC is calibrated and works just fine reading various internal voltage and the bandgap.
If the TTSENS_CODE(T) X B gives you value below TTSENS_CODE(TLOW), then the calculated temperature must be below TLOW. This can happen, I think. Take into account the TSENS accuracy, also the ADC accuracy itself.
Hard to say, Are you sure the TLOW is -40?
I have upload the MPC5644A TSENS calculation example on https://community.freescale.com/docs/DOC-104692.
Try to use it.
I reviewed the sample and verified that the formula I implemented is working correctly.
TSENS_CODE(T)B can be reduced to VTSENS(T)VBG_CODE(TLOW)/VBG_CODE(T) thereby eliminating the need to sample for VREF.
The problem is the TSENSE low constant stored at FFFEC000. I get a value which appears incorrect. The high constant and bandgap values appear correct.
FFFEC000(TSENS_TCCR0) -> $DD615627 which corresponds to: 150C with TSENS_CODE(THIGH) of $1D61 and -40C with TSENS_CODE(TLOW) of $1627.
FFFEC004(TSENS_TCCR1) -> $0F7FXXXX which is $F7F for VBG_CODE(TLOW)
FFFEC000(TSENS_TCCR0) -> $9C891541 which corresponds to: 145C with TSENS_CODE(THIGH) of $1C89 and 25C with TSENS_CODE(TLOW) of $1541.
FFFEC004(TSENS_TCCR1) -> $0FAAXXXX which is $FAA for VBG_CODE(TLOW)
The value you read for TLOW is $1541 for 25C. I read $1627 for -40C. This is impossible! The lower the temperature, the lower the voltage not higher. I believe the value you are reading is correct. The value I am reading is clearly wrong. Where there chips with incorrect TLOW temperature constant manufactured for STM?
I am using a discovery board made by STMicro called SPC564A-DISC containing an SPC564A70L7 chip. The specs on the chip are 150Mhz, 150C to -40C, 1.5MB Flash and 128KB SRAM. Otherwise it is the same as a MPC5644A. Freescale’s and STM’s reference manuals are equivalent for the eQADC and temperature sensor sections.
We are in the process of producing the first 5 vehicle controllers using an SPC5644AMLU1 chip. I hope that chip contains correct TSENSE constants. I will adjust my code to handle the faulty SPC564A70L7 chip.
For now, my query has been answered
William A Troy Jr