Please tell me how to use S12 MagniV (MC9S12ZVL) TEMPSENSE (Temperature Sensor).
Looking at MC9S12ZVLRM.pdf (MC9S12ZVL Family ReferenceManual and Datasheet),
I couldn't understand how to use it.
If possible, please provide a white paper or sample code.
Thank you!
#S12 MagniV
#MC9S12ZVL
#TEMPSENSE
#Temperature Sensor
Hello Daniel,
Thanks. I see that HTTR trimming value affects temperature sensor readings as well, quite a lot.
Edward
Hello M. Takahata,
A1.
In the screenshot, the ADC temperature sensor is selected which is a sensor that is not specified at all.
A2.
You are using the equation and the specification of the VREG temperature sensor.
So, you need to select it in the PE.
Please make sure that the sensor is enabled and selected in the CPMUHTCTL register.
I haven't found it in the PE.
The calculation is correct.
But please understand that the V_HT(150) specification is just a typical value.
The min. and the max. values are not specified and they can differ from the typical value significantly.
Therefore, the sensor needs to be calibrated.
Regards,
Daniel
Hi Daniel Martynek,
Thank you for your reply.
I used the DEVKIT-ZVL128, selected VREG_Temp_Sensor__or__BandGap, set the CPMUHTCTL register and calculated, it was close to room temperature.
Question1:
In your comment, I haven't found it in the PE. What is PE?
Question2:
Please tell me how to Calibration?
Question3:
If the HTOE bit of the CPMUHTTR register is set to 1, is HTTR a temperature offset?
How should I set HTTR?
Does it affect only the offset?
Or does it affect both offset and slope?
In that case,
When HTTR = 0h, Untrimmed, 5.05mV / ℃.
When HTTR = 8h, Trimmed, 5.25mV / ℃.
When HTTR = Fh, Trimmed, 5.45mV / ℃.
Is it correct?
Regards,
M.Takahata
Hello masashi.takahata.nh@j-display.com,
A1.
I meat the Processor Expert GUI.
I believe this is well explained in AN3624 S12X Temperature Sensor.
A2.
Section 2.2 Calibration
A3.
The trimming affects the high-temperature interrupt (HTI) assert level as well not only V_HT(temp).
The HTI level is specified at VREGHTTR = 0x88 only.
No, the dV/dT is not influenced by the value in of the VREGHTTR register.
Regards,
Daniel
Hi Daniel Martynek,
Thank you for your reply.
I want to use MC9S12ZVL.
Question1:
The description of HTTR register is different between MC9S12ZVL Datasheet(CPMUHTTR) and AN3624(VREGHTTR).
Does the MC9S12ZVL CPMUHTTR have a VHT offset?
"MC9S12ZVL Family Reference Manual and Datasheet" is CPMUHTTR.
AN3624 is VREGHTTR.
Question2:
There is CPMUHTTR = 0x88 on page 696 of the data sheet. What is it related to?
Regards,
M.Takahata
Hi masashi.takahata.nh@j-display.com,
A1.
These are just different register names.
MagniV and S12(X) have the same sensor.
A2.
When HTTR is trimmed to 0x8 and HTOE = 0x1, T_HTIA / T_HTID are specified as follows:
Regards,
Daniel
Hi Daniel Martynek,
Thank you for all your support.
Trimming Effect of HTTR description varies slightly depending on the specifications.
Tell me more about Trimming effect of HTTR in "MC9S12ZVL Family Reference Manual and Datasheet".
Question1:
If HTIE is 0, HTTR is Temperature sensor voltage VHT?
If HTIE is 1, HTTR is Interrupt threshold temperatures THTLA and THTID? Or is it both?
Question2:
If HTIE is 1 and HTTR is 0x88, the following values are Typical, which means it can be adjusted by HTTR setting?
(Interrupt threshold temperatures THTIA and THTID.)
Regards,
M.Takahata
Hi masashi.takahata.nh@j-display.com,
A1.
If HTOE = 1, HTTR shifts both V_HT(temp) and THTLA and THTID.
If HTIE is 0, the high-temperature interrupt is not generated when the temperature reaches THTIA.
if HTIE is 1, the high-temperature interrupt is generated when the temperature reaches THTIA.
A2.
Yes,
Regards,
Daniel
Hello Daniel Martynek,
I've question regarding High Temperature Trimming Register, CPMUHTTR. Are HTTR3 to HTTR0 bits factory trimmed? HTTR3 to HTTR0 reset value is loaded from flash. Reset = F in CPMUHTTR register description and HTTR bits seem being loaded as advertised from Flash IFR (at 0x1FC0B9 on S12ZVC, which I'm using). Parts I saw have all ones in HTTRx. If I set HTOE=1 calculated Tj seems being little off, but not tens of degrees. So it's not clear a bit. From one side trim value seems being OK because no room to make it any higher, but is it actually trimmed or indeed it is just a default blank or erased flash value?
Thanks,
Edward
Hello Edward,
It is not factory trimmed, this is just an erased flash.
As far as I know, there were some samples with 0x8 default value, but it was not trimmed.
The trimming is used to adjust the high-temperature interrupt level.
BR, Daniel
Hello masashi.takahata.nh@j-display.com,
There are two S12ZVL temperature sensors that can be read by the ADC.
The Chip temperature sensor is specified in the S12ZVL RM rev.2.48, Table B-1.
For more information, please refer to
AN3624 S12X Temperature Sensor
Considerations for Using the S12X Temperature Sensor
The ADC temperature sensor is not specified.
Regards,
Daniel
Hi, danielmartynek,
Thank you for your reply and information.
I have some questions.
Does this require calibration?
How do I convert ADC values to temperature?
Please let us know if you have sample code.
Best Regards,
Masa
Hi masashi.takahata.nh@j-display.com,
It can be calculated using this equation (S12ZVL RM rev.2.48, p252)
The slope (dV_ht) is linear and specified in the RM.
The voltage value at 150C Tj is also specified, however, it is only a typical value.
Therefore, yes, it does require calibration as explained in AN3624.
We don't have any example, unfortunately.
Regards,
Daniel
Hi danielmartynek,
Thank you for your reply.
However, I still don't understand.
I want to measure the ambient temperature.
Precondition:
MC9S12ZVL
M=-40℃ to 125℃
ADC : 12bit
ADC Channel : internal_0 (ADC temperature sensor)
Question1:
Is calibration required for internal_0 (ADC temperature sensor)?
Please tell me how to calibrate.
Question2:
Please tell me how to convert from ADC value to voltage.
I thought it was the formula below, is it correct?
Ta = -40 + (165/4096)*ADC Value
V = 2.4 - (125 - Ta)*0.00525
Regards,
M.Takahata
Hi M.Takahata,
Both temperature sensors measure the internal junction temperature not the ambient temperature.
The difference between the junction and ambient temperature can be calculated though.
As explained in the AN3624, Section 2.2 Calibration.
S12ZVL RM, A.1.8 Power Dissipation and Thermal Characteristics.
A1.
Yes, the ADC sensor is not specified at all.
An older AN3031 explains more about the calibration in general.
http://www.nxp.com/files/microcontrollers/doc/app_note/AN3031.pdf
A2.
I don’t know what equation you are using there.
You can use the equation from my previous post.
temp = junction temperature
V_HT(temp) = ADC V_in at temp
d_V_HT is specified and linear across the temperature.
V_HT(150) = ADC V_in at 150C Tj. This is specifies as 2.4V, however, this is only the typical value - the actual value can differ, the min and max values are not specified.
And therefore, it needs to be calibrated, as explained in AN3624.
Regards,
Daniel
Hi Daniel Martynek,
Thank you for your reply.
Sorry, replies ware late.
However, I still don't understand.
I want to know how to measure junction temperature.
Precondition:
MC9S12ZVL
M=-40℃ to 150℃
ADC : 12bit
ADC Channel : internal_0 (ADC temperature sensor)
Question1:
It's setting ADC of ProcessorExpert.
Is it correct?
Question2:
Please tell me how to convert from ADC value to voltage.
I thought it was the formula below, is it correct?
Tj = -40 + ((40+150) / 4096) * ADC Value
Vj = 2.4 - (150 - Tj) * 0.00525
Is the relationship between temperature and voltage correct in the following?
Temp(℃) | Voltage(V) |
-40 | 1.4025 |
-39 | 1.40775 |
-38 | 1.413 |
-37 | 1.41825 |
-36 | 1.4235 |
-35 | 1.42875 |
-34 | 1.434 |
-33 | 1.43925 |
-32 | 1.4445 |
-31 | 1.44975 |
-30 | 1.455 |
-29 | 1.46025 |
-28 | 1.4655 |
-27 | 1.47075 |
-26 | 1.476 |
-25 | 1.48125 |
-24 | 1.4865 |
-23 | 1.49175 |
-22 | 1.497 |
-21 | 1.50225 |
-20 | 1.5075 |
-19 | 1.51275 |
-18 | 1.518 |
-17 | 1.52325 |
-16 | 1.5285 |
-15 | 1.53375 |
-14 | 1.539 |
-13 | 1.54425 |
-12 | 1.5495 |
-11 | 1.55475 |
-10 | 1.56 |
-9 | 1.56525 |
-8 | 1.5705 |
-7 | 1.57575 |
-6 | 1.581 |
-5 | 1.58625 |
-4 | 1.5915 |
-3 | 1.59675 |
-2 | 1.602 |
-1 | 1.60725 |
0 | 1.6125 |
1 | 1.61775 |
2 | 1.623 |
3 | 1.62825 |
4 | 1.6335 |
5 | 1.63875 |
6 | 1.644 |
7 | 1.64925 |
8 | 1.6545 |
9 | 1.65975 |
10 | 1.665 |
11 | 1.67025 |
12 | 1.6755 |
13 | 1.68075 |
14 | 1.686 |
15 | 1.69125 |
16 | 1.6965 |
17 | 1.70175 |
18 | 1.707 |
19 | 1.71225 |
20 | 1.7175 |
21 | 1.72275 |
22 | 1.728 |
23 | 1.73325 |
24 | 1.7385 |
25 | 1.74375 |
26 | 1.749 |
27 | 1.75425 |
28 | 1.7595 |
29 | 1.76475 |
30 | 1.77 |
31 | 1.77525 |
32 | 1.7805 |
33 | 1.78575 |
34 | 1.791 |
35 | 1.79625 |
36 | 1.8015 |
37 | 1.80675 |
38 | 1.812 |
39 | 1.81725 |
40 | 1.8225 |
41 | 1.82775 |
42 | 1.833 |
43 | 1.83825 |
44 | 1.8435 |
45 | 1.84875 |
46 | 1.854 |
47 | 1.85925 |
48 | 1.8645 |
49 | 1.86975 |
50 | 1.875 |
51 | 1.88025 |
52 | 1.8855 |
53 | 1.89075 |
54 | 1.896 |
55 | 1.90125 |
56 | 1.9065 |
57 | 1.91175 |
58 | 1.917 |
59 | 1.92225 |
60 | 1.9275 |
61 | 1.93275 |
62 | 1.938 |
63 | 1.94325 |
64 | 1.9485 |
65 | 1.95375 |
66 | 1.959 |
67 | 1.96425 |
68 | 1.9695 |
69 | 1.97475 |
70 | 1.98 |
71 | 1.98525 |
72 | 1.9905 |
73 | 1.99575 |
74 | 2.001 |
75 | 2.00625 |
76 | 2.0115 |
77 | 2.01675 |
78 | 2.022 |
79 | 2.02725 |
80 | 2.0325 |
81 | 2.03775 |
82 | 2.043 |
83 | 2.04825 |
84 | 2.0535 |
85 | 2.05875 |
86 | 2.064 |
87 | 2.06925 |
88 | 2.0745 |
89 | 2.07975 |
90 | 2.085 |
91 | 2.09025 |
92 | 2.0955 |
93 | 2.10075 |
94 | 2.106 |
95 | 2.11125 |
96 | 2.1165 |
97 | 2.12175 |
98 | 2.127 |
99 | 2.13225 |
100 | 2.1375 |
101 | 2.14275 |
102 | 2.148 |
103 | 2.15325 |
104 | 2.1585 |
105 | 2.16375 |
106 | 2.169 |
107 | 2.17425 |
108 | 2.1795 |
109 | 2.18475 |
110 | 2.19 |
111 | 2.19525 |
112 | 2.2005 |
113 | 2.20575 |
114 | 2.211 |
115 | 2.21625 |
116 | 2.2215 |
117 | 2.22675 |
118 | 2.232 |
119 | 2.23725 |
120 | 2.2425 |
121 | 2.24775 |
122 | 2.253 |
123 | 2.25825 |
124 | 2.2635 |
125 | 2.26875 |
126 | 2.274 |
127 | 2.27925 |
128 | 2.2845 |
129 | 2.28975 |
130 | 2.295 |
131 | 2.30025 |
132 | 2.3055 |
133 | 2.31075 |
134 | 2.316 |
135 | 2.32125 |
136 | 2.3265 |
137 | 2.33175 |
138 | 2.337 |
139 | 2.34225 |
140 | 2.3475 |
141 | 2.35275 |
142 | 2.358 |
143 | 2.36325 |
144 | 2.3685 |
145 | 2.37375 |
146 | 2.379 |
147 | 2.38425 |
148 | 2.3895 |
149 | 2.39475 |
150 | 2.4 |
Regards,
M.Takahata