How to use MC9S12ZVL Temperature Sensor

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to use MC9S12ZVL Temperature Sensor

2,803 Views
masashi_takahat
Contributor III

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

17 Replies

2,423 Views
kef2
Senior Contributor IV

Hello Daniel,

Thanks. I see that HTTR trimming value affects temperature sensor readings as well, quite a lot.

Edward

0 Kudos

2,423 Views
danielmartynek
NXP TechSupport
NXP TechSupport

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.

pastedImage_2.png

Please make sure that the sensor is enabled and selected in the CPMUHTCTL register.

I haven't found it in the PE.

pastedImage_3.png

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

2,423 Views
masashi_takahat
Contributor III

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?

pastedImage_1.png

  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?

  

pastedImage_2.png

Regards,

M.Takahata

0 Kudos

2,423 Views
danielmartynek
NXP TechSupport
NXP TechSupport

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.  

pastedImage_2.png

pastedImage_3.png

No, the dV/dT is not influenced by the value in of the VREGHTTR register.

pastedImage_4.png

pastedImage_5.png

Regards,

Daniel

0 Kudos

2,425 Views
masashi_takahat
Contributor III

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.

pastedImage_1.png

AN3624 is VREGHTTR.

pastedImage_2.png

Question2:

There is CPMUHTTR = 0x88 on page 696 of the data sheet. What is it related to?

pastedImage_3.png

Regards,

M.Takahata

0 Kudos

2,425 Views
danielmartynek
NXP TechSupport
NXP TechSupport

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:pastedImage_2.png

Regards,

Daniel

0 Kudos

2,425 Views
masashi_takahat
Contributor III

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?

pastedImage_1.png

pastedImage_2.png

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.)

pastedImage_3.png

 

Regards,

M.Takahata

0 Kudos

2,425 Views
danielmartynek
NXP TechSupport
NXP TechSupport

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

2,425 Views
masashi_takahat
Contributor III

Hi Daniel Martynek,

 

Thanks.

I understand about HTTR.

Regards,

M.Takahata

0 Kudos

2,425 Views
kef2
Senior Contributor IV

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

0 Kudos

2,425 Views
danielmartynek
NXP TechSupport
NXP TechSupport

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.

pastedImage_1.png

BR, Daniel

0 Kudos

2,425 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello masashi.takahata.nh@j-display.com,

There are two S12ZVL temperature sensors that can be read by the ADC.

pastedImage_3.png

The Chip temperature sensor is specified in the S12ZVL RM rev.2.48, Table B-1.

pastedImage_4.png

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

2,425 Views
masashi_takahat
Contributor III

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

0 Kudos

2,423 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi masashi.takahata.nh@j-display.com,

It can be calculated using this equation (S12ZVL RM rev.2.48, p252)

pastedImage_1.png

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.

pastedImage_3.png

Therefore, yes, it does require calibration as explained in AN3624.

We don't have any example, unfortunately.

Regards,

Daniel

2,423 Views
masashi_takahat
Contributor III

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

0 Kudos

2,423 Views
danielmartynek
NXP TechSupport
NXP TechSupport

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.

pastedImage_1.png

Regards,

Daniel

0 Kudos

2,423 Views
masashi_takahat
Contributor III

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?

 pastedImage_1.png

 

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)
-401.4025
-391.40775
-381.413
-371.41825
-361.4235
-351.42875
-341.434
-331.43925
-321.4445
-311.44975
-301.455
-291.46025
-281.4655
-271.47075
-261.476
-251.48125
-241.4865
-231.49175
-221.497
-211.50225
-201.5075
-191.51275
-181.518
-171.52325
-161.5285
-151.53375
-141.539
-131.54425
-121.5495
-111.55475
-101.56
-91.56525
-81.5705
-71.57575
-61.581
-51.58625
-41.5915
-31.59675
-21.602
-11.60725
01.6125
11.61775
21.623
31.62825
41.6335
51.63875
61.644
71.64925
81.6545
91.65975
101.665
111.67025
121.6755
131.68075
141.686
151.69125
161.6965
171.70175
181.707
191.71225
201.7175
211.72275
221.728
231.73325
241.7385
251.74375
261.749
271.75425
281.7595
291.76475
301.77
311.77525
321.7805
331.78575
341.791
351.79625
361.8015
371.80675
381.812
391.81725
401.8225
411.82775
421.833
431.83825
441.8435
451.84875
461.854
471.85925
481.8645
491.86975
501.875
511.88025
521.8855
531.89075
541.896
551.90125
561.9065
571.91175
581.917
591.92225
601.9275
611.93275
621.938
631.94325
641.9485
651.95375
661.959
671.96425
681.9695
691.97475
701.98
711.98525
721.9905
731.99575
742.001
752.00625
762.0115
772.01675
782.022
792.02725
802.0325
812.03775
822.043
832.04825
842.0535
852.05875
862.064
872.06925
882.0745
892.07975
902.085
912.09025
922.0955
932.10075
942.106
952.11125
962.1165
972.12175
982.127
992.13225
1002.1375
1012.14275
1022.148
1032.15325
1042.1585
1052.16375
1062.169
1072.17425
1082.1795
1092.18475
1102.19
1112.19525
1122.2005
1132.20575
1142.211
1152.21625
1162.2215
1172.22675
1182.232
1192.23725
1202.2425
1212.24775
1222.253
1232.25825
1242.2635
1252.26875
1262.274
1272.27925
1282.2845
1292.28975
1302.295
1312.30025
1322.3055
1332.31075
1342.316
1352.32125
1362.3265
1372.33175
1382.337
1392.34225
1402.3475
1412.35275
1422.358
1432.36325
1442.3685
1452.37375
1462.379
1472.38425
1482.3895
1492.39475
1502.4

Regards,

M.Takahata

0 Kudos