<?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 MK20DX256 TSI Calibration in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/MK20DX256-TSI-Calibration/m-p/725231#M44376</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Greetings everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a possibly odd question. I would like to try to use the MK20 TSI module to perform very small capacitance measurements. This of course implies some sort of calibration. While playing with the module I noticed something odd: The resulting count did not scale linearly with the reference oscillator current as I would expect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me back up for a second. I set up the module and attach an external 100 pF capacitor. When the prescaler and the measurement counter are set to one each and both currents are set to 2 uA this gives 100 counts, since the reference cap is 1 pF. I would expect that increasing the reference current would increase the counts in the same way. This is however not the case. Going to 4, 6, and 8 uA gives an almost linear increase, but above that the count pretty much stays the same.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Am I missing something fundamental here? Is this behavior within the expected tolerances and I am demanding something to unusual? Or should I suspect that my controller's TSI module is faulty? I would greatly appreciate any feedback and will gladly provide more information if needed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much and best regards,&lt;/P&gt;&lt;P&gt;FB.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 15 Dec 2017 23:43:13 GMT</pubDate>
    <dc:creator>fabianbrings</dc:creator>
    <dc:date>2017-12-15T23:43:13Z</dc:date>
    <item>
      <title>MK20DX256 TSI Calibration</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/MK20DX256-TSI-Calibration/m-p/725231#M44376</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Greetings everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a possibly odd question. I would like to try to use the MK20 TSI module to perform very small capacitance measurements. This of course implies some sort of calibration. While playing with the module I noticed something odd: The resulting count did not scale linearly with the reference oscillator current as I would expect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me back up for a second. I set up the module and attach an external 100 pF capacitor. When the prescaler and the measurement counter are set to one each and both currents are set to 2 uA this gives 100 counts, since the reference cap is 1 pF. I would expect that increasing the reference current would increase the counts in the same way. This is however not the case. Going to 4, 6, and 8 uA gives an almost linear increase, but above that the count pretty much stays the same.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Am I missing something fundamental here? Is this behavior within the expected tolerances and I am demanding something to unusual? Or should I suspect that my controller's TSI module is faulty? I would greatly appreciate any feedback and will gladly provide more information if needed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much and best regards,&lt;/P&gt;&lt;P&gt;FB.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Dec 2017 23:43:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/MK20DX256-TSI-Calibration/m-p/725231#M44376</guid>
      <dc:creator>fabianbrings</dc:creator>
      <dc:date>2017-12-15T23:43:13Z</dc:date>
    </item>
    <item>
      <title>Re: MK20DX256 TSI Calibration</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/MK20DX256-TSI-Calibration/m-p/725232#M44377</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry for the later reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you provide the detailed MK20X256 product part number and related mask set (You could find it at Chip surface silk print)?&lt;/P&gt;&lt;P&gt;Thank you for the help!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;best regards,&lt;/P&gt;&lt;P&gt;Mike&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Dec 2017 06:59:07 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/MK20DX256-TSI-Calibration/m-p/725232#M44377</guid>
      <dc:creator>Hui_Ma</dc:creator>
      <dc:date>2017-12-21T06:59:07Z</dc:date>
    </item>
    <item>
      <title>Re: MK20DX256 TSI Calibration</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/MK20DX256-TSI-Calibration/m-p/725233#M44378</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes of course I can provide that information. I am not entirely sure which are the relevant numbers, but in total it says on the part: MK20DX256VLH7 3N36B CTAY1428B. So I guess it's the 3N36B mask set.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your time and best regards,&lt;/P&gt;&lt;P&gt;FB.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Dec 2017 09:26:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/MK20DX256-TSI-Calibration/m-p/725233#M44378</guid>
      <dc:creator>fabianbrings</dc:creator>
      <dc:date>2017-12-21T09:26:08Z</dc:date>
    </item>
    <item>
      <title>Re: MK20DX256 TSI Calibration</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/MK20DX256-TSI-Calibration/m-p/725234#M44379</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I checked &lt;A href="https://www.nxp.com/docs/en/errata/KINETIS_K_3N36B.pdf"&gt;K20_72MHz mask set 3N36B related errata file&lt;/A&gt; with TSI e2638 item:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/32921i9F643E025CB6B187/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Please add a delay of 0.25ms or greater prior to accessing the counter registers.&lt;/P&gt;&lt;P&gt;Please let me know if there still with the same issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;best regards,&lt;/P&gt;&lt;P&gt;Mike&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Dec 2017 02:29:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/MK20DX256-TSI-Calibration/m-p/725234#M44379</guid>
      <dc:creator>Hui_Ma</dc:creator>
      <dc:date>2017-12-22T02:29:53Z</dc:date>
    </item>
    <item>
      <title>Re: MK20DX256 TSI Calibration</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/MK20DX256-TSI-Calibration/m-p/725235#M44380</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You are right, I forgot that part of the errata. I read out the register inside the TSI interrupt routine. However adding a delay of 1 ms does not change the result. For clarity I provide my sourcecode, it is in Arduino style, but I think the general functionality is still understandable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#define nscn 0 // number of scans&lt;/P&gt;&lt;P&gt;#define pres 0 // scan number prescaler&lt;/P&gt;&lt;P&gt;#define iele 0 // electrode dis-/charge current&lt;/P&gt;&lt;P&gt;#define iref 7 // reference oscillator dis-/charge current&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;uint16_t val;&lt;/P&gt;&lt;P&gt;double c;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;void tsi0_isr() {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;delay(1);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;val = (TSI0_CNTR9 &amp;gt;&amp;gt; 16) &amp;amp; 0xFFFF; // read content of the output register&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;TSI0_GENCS |= TSI_GENCS_EOSF;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;NVIC_CLEAR_PENDING(IRQ_TSI);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;void setup() {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Serial.begin(9600);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;SIM_SCGC5 |= SIM_SCGC5_TSI; // enable tsi clock&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;TSI0_GENCS = 0; // reset tsi module&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;TSI0_PEN = (1 &amp;lt;&amp;lt; 9); // enable channel 9 (pin 0) // set dis-/charge currents&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;TSI0_SCANC |= TSI_SCANC_REFCHRG(iref) | TSI_SCANC_EXTCHRG(iele); // set scan number + prescaler, activate module&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;TSI0_GENCS |= TSI_GENCS_NSCN(nscn) | TSI_GENCS_PS(pres);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;TSI0_GENCS |= TSI_GENCS_TSIIE | TSI_GENCS_ESOR;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;TSI0_GENCS |= TSI_GENCS_TSIEN; NVIC_ENABLE_IRQ(IRQ_TSI);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;void loop() {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;TSI0_GENCS |= TSI_GENCS_SWTS;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;delay(1000);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// using Figure 50-39. Equation 5 from the reference manual to calculate the capacitance&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;c = (double)val * (iele + 1) / ((nscn + 1) * (1 &amp;lt;&amp;lt; pres) * (iref + 1));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Serial.print(val); Serial.print(": "); Serial.print(c, 8); Serial.println(" pF");&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Dec 2017 02:51:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/MK20DX256-TSI-Calibration/m-p/725235#M44380</guid>
      <dc:creator>fabianbrings</dc:creator>
      <dc:date>2017-12-22T02:51:33Z</dc:date>
    </item>
    <item>
      <title>Re: MK20DX256 TSI Calibration</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/MK20DX256-TSI-Calibration/m-p/725236#M44381</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First of all, sorry for the later reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please try with below TSI parameter setting:&lt;/P&gt;&lt;P&gt;#define nscn 10 // number of scans&lt;/P&gt;&lt;P&gt;#define pres 3 // scan number prescaler&lt;/P&gt;&lt;P&gt;#define iele 3 // electrode dis-/charge current&lt;/P&gt;&lt;P&gt;#define iref 31 // reference oscillator dis-/charge current&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Wish it helps.&lt;/P&gt;&lt;P&gt;Mike&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Dec 2017 09:05:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/MK20DX256-TSI-Calibration/m-p/725236#M44381</guid>
      <dc:creator>Hui_Ma</dc:creator>
      <dc:date>2017-12-26T09:05:37Z</dc:date>
    </item>
  </channel>
</rss>

