<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: KEA128 On Board Temperature in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/KEA128-On-Board-Temperature/m-p/1378245#M61955</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;That repo and ADC solution only uses one slope. The data sheet for my part uses two slopes. One below 20 and one above 25.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I know which to use? If I have not calculated the temperature yet, how do I know which slope to use to calculate the temperature?&lt;/P&gt;</description>
    <pubDate>Mon, 29 Nov 2021 13:49:24 GMT</pubDate>
    <dc:creator>MichaelBMiner</dc:creator>
    <dc:date>2021-11-29T13:49:24Z</dc:date>
    <item>
      <title>KEA128 On Board Temperature</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/KEA128-On-Board-Temperature/m-p/1377670#M61942</link>
      <description>&lt;P&gt;I am trying to read the on board temperature of an S9KEAZ128M4 using&amp;nbsp;AN3031. I am following the calculate Vdd procedure.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Reading my bandgap voltage and calculating Vdd I get a value of 3.3V which is expected. Using this I calculate all required values. When reading in the temperarue AD22 and converting I get incorrect values. In regards to&amp;nbsp;AN3031 I have two questions.&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Are my values correct?&lt;/LI&gt;&lt;LI&gt;When do I use the positive vs negative slope?&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;For 1. I have calculated a Vdd of 3.3V. Vtemp25 given by the datasheet is&amp;nbsp;1.396. Vbg is 1.16 typ. Following equations 3 through 7 I get the following values.&lt;/P&gt;&lt;P&gt;ADCRtemp25 = 1732&lt;/P&gt;&lt;P&gt;ADCRm = 451 for – Temp 25 &amp;lt; 40°C&amp;nbsp; &amp;lt; °C&lt;/P&gt;&lt;P&gt;ADCRm = 405 for&amp;nbsp;25°C &amp;lt; Temp 85 &amp;lt;&amp;nbsp; °C&lt;/P&gt;&lt;P&gt;An example reading from ADC22 is 1481. Putting this into the app note equation gives me a temperature of 80°C which is not correct.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For 2. What determines the slope to use? I get that it is when a Vtemp is above/below a certain point but which temp? The one from ADC22? If so how do I use that since it has yet to be converted to a temp.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Nov 2021 14:09:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/KEA128-On-Board-Temperature/m-p/1377670#M61942</guid>
      <dc:creator>MichaelBMiner</dc:creator>
      <dc:date>2021-11-26T14:09:15Z</dc:date>
    </item>
    <item>
      <title>Re: KEA128 On Board Temperature</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/KEA128-On-Board-Temperature/m-p/1377775#M61945</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;This is the code in the uTasker project, which has been used with most Kinetis parts (available free at &lt;A href="https://github.com/uTasker/uTasker-Kinetis" target="_blank"&gt;https://github.com/uTasker/uTasker-Kinetis&lt;/A&gt; including simulation of the Kinetis parts and ADC)&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;#define VTEMP_25_16BIT               ((VTEMP_25_MV * 0xffff) / ADC_REFERENCE_VOLTAGE)
#define VTEMP_25_12BIT               (VTEMP_25_16BIT &amp;gt;&amp;gt; 4)
#define VTEMP_25_10BIT               (VTEMP_25_16BIT &amp;gt;&amp;gt; 6)
#define TEMP_SENSOR_SLOPE_100_16BIT  ((TEMP_SENSOR_SLOPE_UV * 0xffff)/(10 * ADC_REFERENCE_VOLTAGE))
#define TEMP_SENSOR_SLOPE_100_12BIT  (TEMP_SENSOR_SLOPE_100_16BIT &amp;gt;&amp;gt; 4)
#define TEMP_SENSOR_SLOPE_100_10BIT  (TEMP_SENSOR_SLOPE_100_16BIT &amp;gt;&amp;gt; 6

// Convert the ADC reading to a temperature (using 12 bit resolution result)
//
signed short ssDifference = (sADC_value - VTEMP_25_12BIT); // convert references to 12 bit values
signed long slTemperature100 = (2550 - ((ssDifference * 10000) / TEMP_SENSOR_SLOPE_100_12BIT)); // the approximate temperature *100, rounded up/down
slTemperature100 /= 100;                         // the approximate temperature rounded up/down to 1°C
fnDebugDec(slTemperature100, DISPLAY_NEGATIVE);
fnDebugMsg(" degC\r\n");&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Values used by KEA parts:&lt;BR /&gt;#define VTEMP_25_MV 1396 // typical internal temperature sensor reference voltage (in mV) (5.0V VDD/VREF and &amp;lt; 3MHz ADC clock speed)&lt;BR /&gt;#define TEMP_SENSOR_SLOPE_UV 3260 // typical internal temperature sensor slope uV/°C (5.0V VDD/VREF and &amp;lt; 3MHz ADC clock speed)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The expected value read by the ADC (in 16 bit mode) at 25°C is&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;(unsigned short)((VTEMP_25_MV * 0xffff) / ADC_REFERENCE_VOLTAGE); // 25°C&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;where the KEA typically uses 5V as reference, and so&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;#define ADC_REFERENCE_VOLTAGE 5000 // ADC uses 5.0V reference&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Beware that the ADC resolution used must match with the ADC resolution calculated with (see above)&lt;BR /&gt;16 bit value is expected to be 18297 (0x4779)&lt;BR /&gt;12 bit value is 1143 (0x0477)&lt;BR /&gt;10 bit value is 285 (0x011d)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Therefore:&lt;BR /&gt;1. Which resolution is the ADC reading with?&lt;BR /&gt;2. What is your ADC reference voltage?&lt;BR /&gt;3. What is the ADC value read at 25°C (in dec or hex)? [1481 dec?]&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;&lt;BR /&gt;Mark&lt;/P&gt;</description>
      <pubDate>Sat, 27 Nov 2021 03:18:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/KEA128-On-Board-Temperature/m-p/1377775#M61945</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2021-11-27T03:18:25Z</dc:date>
    </item>
    <item>
      <title>Re: KEA128 On Board Temperature</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/KEA128-On-Board-Temperature/m-p/1378245#M61955</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;That repo and ADC solution only uses one slope. The data sheet for my part uses two slopes. One below 20 and one above 25.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I know which to use? If I have not calculated the temperature yet, how do I know which slope to use to calculate the temperature?&lt;/P&gt;</description>
      <pubDate>Mon, 29 Nov 2021 13:49:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/KEA128-On-Board-Temperature/m-p/1378245#M61955</guid>
      <dc:creator>MichaelBMiner</dc:creator>
      <dc:date>2021-11-29T13:49:24Z</dc:date>
    </item>
    <item>
      <title>Re: KEA128 On Board Temperature</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/KEA128-On-Board-Temperature/m-p/1378246#M61956</link>
      <description>&lt;P&gt;I also have my ADC working. My new issue is with ADC FIFO&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.nxp.com/t5/Kinetis-Microcontrollers/KEA-ADC-FIFO/m-p/1377751#M61944" target="_blank"&gt;https://community.nxp.com/t5/Kinetis-Microcontrollers/KEA-ADC-FIFO/m-p/1377751#M61944&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Nov 2021 13:50:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/KEA128-On-Board-Temperature/m-p/1378246#M61956</guid>
      <dc:creator>MichaelBMiner</dc:creator>
      <dc:date>2021-11-29T13:50:15Z</dc:date>
    </item>
    <item>
      <title>Re: KEA128 On Board Temperature</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/KEA128-On-Board-Temperature/m-p/1378316#M61958</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;You know whether it is below or above 25°C from the ADC value comparison with the 25°C value. Therefore if &lt;EM&gt;ssDifference&lt;/EM&gt; is negative the one slop can be used and if it is positive the other can be used. &lt;EM&gt;If it exactly matches the 25°C value either no slope or any slope can be used since it will result in no adjustment anyway.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Nov 2021 16:37:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/KEA128-On-Board-Temperature/m-p/1378316#M61958</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2021-11-29T16:37:40Z</dc:date>
    </item>
  </channel>
</rss>

