<?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>Kinetis MicrocontrollersのトピックKL02 SPI transmit error when using IO as CS pin</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/KL02-SPI-transmit-error-when-using-IO-as-CS-pin/m-p/608209#M35894</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;Hi experts&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;My Customer now using KL02 as a SPI master device in a BMS project, and the slave device which require keep cs pin low all the time during the data transmission otherwise it may lost data.&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;Our KL02 SPI auto SS function will pull high the cs pin after each byte transmit, so they cannot accept. then we use the PTA5 as GPIO to control the CS pin.&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;But we met strange issue:&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;We did our test based on two FRDM-KL02 and KSDK SPI polling sample code.&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;Just as normal SPI usage, after the basic configure, I pull low the CS pin before the data transmit, pull high after it finished. But I don't know why the destBuff would get an extra "0x00", then it made all data&amp;nbsp;in wrong order.&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="1.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/12927i2C80326D01FCAD94/image-size/large?v=v2&amp;amp;px=999" role="button" title="1.png" alt="1.png" /&gt;&lt;/span&gt; &amp;nbsp;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="2.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/12928i1230C7243C1F1092/image-size/large?v=v2&amp;amp;px=999" role="button" title="2.png" alt="2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;we checked the waveform, didn't find any issues.&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;(pic is not clear, yellow line is CS, green line is clock, blue line is data.)&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="4.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/12929i4F3415E3DCF70ACE/image-size/large?v=v2&amp;amp;px=999" role="button" title="4.png" alt="4.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;I use the blocking transfer directly, add GPIO operation.&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="7.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/12930i1F27B50D7B94E117/image-size/large?v=v2&amp;amp;px=999" role="button" title="7.png" alt="7.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;configure spi SS function.&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="9.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/12931i5DD5F8EE2F9E4BD0/image-size/large?v=v2&amp;amp;px=999" role="button" title="9.png" alt="9.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;/*******************************************************************************************************************************/&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;But if I simulate GPIO&amp;nbsp;as the auto-ss function, pull high every time after byte transmission, it could work.&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="3.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/12932i04B9B71DEACBA00F/image-size/large?v=v2&amp;amp;px=999" role="button" title="3.png" alt="3.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;Pull high CS every time.&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="8.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/12933i402E989294D9FA80/image-size/large?v=v2&amp;amp;px=999" role="button" title="8.png" alt="8.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="6.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/12934i20BABCF9BF3E7C9C/image-size/large?v=v2&amp;amp;px=999" role="button" title="6.png" alt="6.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;So, can KL02 keep CS low during data transmission which size larger than 1 byte? or it must be pulled high after each bytes transmit? it couldn't be. Anything I missed?&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;Please help on it, thanks a lot!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 07 Feb 2017 01:57:25 GMT</pubDate>
    <dc:creator>kehanqin-b46569</dc:creator>
    <dc:date>2017-02-07T01:57:25Z</dc:date>
    <item>
      <title>KL02 SPI transmit error when using IO as CS pin</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/KL02-SPI-transmit-error-when-using-IO-as-CS-pin/m-p/608209#M35894</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;Hi experts&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;My Customer now using KL02 as a SPI master device in a BMS project, and the slave device which require keep cs pin low all the time during the data transmission otherwise it may lost data.&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;Our KL02 SPI auto SS function will pull high the cs pin after each byte transmit, so they cannot accept. then we use the PTA5 as GPIO to control the CS pin.&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;But we met strange issue:&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;We did our test based on two FRDM-KL02 and KSDK SPI polling sample code.&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;Just as normal SPI usage, after the basic configure, I pull low the CS pin before the data transmit, pull high after it finished. But I don't know why the destBuff would get an extra "0x00", then it made all data&amp;nbsp;in wrong order.&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="1.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/12927i2C80326D01FCAD94/image-size/large?v=v2&amp;amp;px=999" role="button" title="1.png" alt="1.png" /&gt;&lt;/span&gt; &amp;nbsp;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="2.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/12928i1230C7243C1F1092/image-size/large?v=v2&amp;amp;px=999" role="button" title="2.png" alt="2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;we checked the waveform, didn't find any issues.&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;(pic is not clear, yellow line is CS, green line is clock, blue line is data.)&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="4.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/12929i4F3415E3DCF70ACE/image-size/large?v=v2&amp;amp;px=999" role="button" title="4.png" alt="4.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;I use the blocking transfer directly, add GPIO operation.&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="7.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/12930i1F27B50D7B94E117/image-size/large?v=v2&amp;amp;px=999" role="button" title="7.png" alt="7.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;configure spi SS function.&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="9.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/12931i5DD5F8EE2F9E4BD0/image-size/large?v=v2&amp;amp;px=999" role="button" title="9.png" alt="9.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;/*******************************************************************************************************************************/&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;But if I simulate GPIO&amp;nbsp;as the auto-ss function, pull high every time after byte transmission, it could work.&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="3.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/12932i04B9B71DEACBA00F/image-size/large?v=v2&amp;amp;px=999" role="button" title="3.png" alt="3.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;Pull high CS every time.&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="8.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/12933i402E989294D9FA80/image-size/large?v=v2&amp;amp;px=999" role="button" title="8.png" alt="8.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="6.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/12934i20BABCF9BF3E7C9C/image-size/large?v=v2&amp;amp;px=999" role="button" title="6.png" alt="6.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;So, can KL02 keep CS low during data transmission which size larger than 1 byte? or it must be pulled high after each bytes transmit? it couldn't be. Anything I missed?&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;Please help on it, thanks a lot!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Feb 2017 01:57:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/KL02-SPI-transmit-error-when-using-IO-as-CS-pin/m-p/608209#M35894</guid>
      <dc:creator>kehanqin-b46569</dc:creator>
      <dc:date>2017-02-07T01:57:25Z</dc:date>
    </item>
    <item>
      <title>Re: KL02 SPI transmit error when using IO as CS pin</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/KL02-SPI-transmit-error-when-using-IO-as-CS-pin/m-p/608210#M35895</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi K.h.Qin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Please modify the master and the slave CPHA to 1, then the problem will be solved.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; 1. Modify the master clock phase to 1.&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/15355iCEC42C4A4C8FE95E/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;&lt;/P&gt;&lt;P&gt;2. Modify the slave clock phase to 1&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_2.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/15395i32CEDBD29BB9A476/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_2.png" alt="pastedImage_2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. Test it.&lt;/P&gt;&lt;P&gt;The SPI wave is:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_3.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/15435i77B3DD6EA540DA0F/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_3.png" alt="pastedImage_3.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The Master printf data is:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_4.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/15482i6C882DC91BCC414A/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_4.png" alt="pastedImage_4.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;About the reason, you can find it from the KL02 reference manual:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_5.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/15526i624C511564902AE4/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_5.png" alt="pastedImage_5.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_6.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/15568iB0384BFDE59D94E7/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_6.png" alt="pastedImage_6.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;So, when use the GPIO as the CS, please use the default CPHA=1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Wish it helps you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;Kerry&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Feb 2017 06:04:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/KL02-SPI-transmit-error-when-using-IO-as-CS-pin/m-p/608210#M35895</guid>
      <dc:creator>kerryzhou</dc:creator>
      <dc:date>2017-02-14T06:04:10Z</dc:date>
    </item>
  </channel>
</rss>

