<?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のトピックHow to determine when SPI trnsaction completed</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-determine-when-SPI-trnsaction-completed/m-p/314125#M13699</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using the PCS signals on the SPI interface on a Kinetis device (MK20 or MK64).&lt;/P&gt;&lt;P&gt;The signal correctly changes so that's not a problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But... how do you determine when the entire transaction has completed i.e. when the &lt;STRONG&gt;PCS&lt;/STRONG&gt; signals has returned to its idle state?&lt;/P&gt;&lt;P&gt;The &lt;STRONG&gt;SR.TCF&lt;/STRONG&gt; bit only indicates that the last bit has been shifted out.&amp;nbsp; This (obviously) occurs before the &lt;STRONG&gt;PCS&lt;/STRONG&gt; signal returns to idle. &lt;/P&gt;&lt;P&gt;I had thought the &lt;STRONG&gt;SR.TXRXS&lt;/STRONG&gt; signal might be useful but it doesn't seem to be the case.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Currently I'm polling the &lt;STRONG&gt;PCS&lt;/STRONG&gt; signal through the port &lt;STRONG&gt;PDIR&lt;/STRONG&gt; register but this is less than elegant - It requires custom code depending on which pin the PCS is mapped to.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any suggestions?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 01 Jul 2014 07:41:47 GMT</pubDate>
    <dc:creator>pgo</dc:creator>
    <dc:date>2014-07-01T07:41:47Z</dc:date>
    <item>
      <title>How to determine when SPI trnsaction completed</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-determine-when-SPI-trnsaction-completed/m-p/314125#M13699</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using the PCS signals on the SPI interface on a Kinetis device (MK20 or MK64).&lt;/P&gt;&lt;P&gt;The signal correctly changes so that's not a problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But... how do you determine when the entire transaction has completed i.e. when the &lt;STRONG&gt;PCS&lt;/STRONG&gt; signals has returned to its idle state?&lt;/P&gt;&lt;P&gt;The &lt;STRONG&gt;SR.TCF&lt;/STRONG&gt; bit only indicates that the last bit has been shifted out.&amp;nbsp; This (obviously) occurs before the &lt;STRONG&gt;PCS&lt;/STRONG&gt; signal returns to idle. &lt;/P&gt;&lt;P&gt;I had thought the &lt;STRONG&gt;SR.TXRXS&lt;/STRONG&gt; signal might be useful but it doesn't seem to be the case.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Currently I'm polling the &lt;STRONG&gt;PCS&lt;/STRONG&gt; signal through the port &lt;STRONG&gt;PDIR&lt;/STRONG&gt; register but this is less than elegant - It requires custom code depending on which pin the PCS is mapped to.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any suggestions?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Jul 2014 07:41:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-determine-when-SPI-trnsaction-completed/m-p/314125#M13699</guid>
      <dc:creator>pgo</dc:creator>
      <dc:date>2014-07-01T07:41:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to determine when SPI trnsaction completed</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-determine-when-SPI-trnsaction-completed/m-p/314126#M13700</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;When you transfer data you need to write to the PUSHR which looks like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="PUSHR.PNG"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/44671iB2979DDDA601D98F/image-size/large?v=v2&amp;amp;px=999" role="button" title="PUSHR.PNG" alt="PUSHR.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;It has 2 bytes of command and 2 bytes of data; every time you transfer you need to write completely to this register and when you write your last data you need to set the EOQ bit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can check for this bit in the SPIx_SR register and also check for the TFFF flag which indicates that the TX fifo is full. You can implement this with this code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; while(!(SPI0_SR &amp;amp; SPI_SR_TFFF_MASK)) {} //wait till TX fifo not full&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; while(!(SPI0_SR &amp;amp; SPI_SR_EOQF_MASK)) {} //wait till the las entry has been transmitted&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SPI0_SR&amp;nbsp; |= SPI_SR_EOQF_MASK; //clear EOQF flag&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SPI0_SR&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |= SPI_SR_TFFF_MASK; //clear TFFF flag&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This when you are transmitting data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this information can help you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;Note: If this post answers your question, please click the Correct Answer button. It would be nice!&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Jul 2014 21:34:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-determine-when-SPI-trnsaction-completed/m-p/314126#M13700</guid>
      <dc:creator>adriancano</dc:creator>
      <dc:date>2014-07-01T21:34:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to determine when SPI trnsaction completed</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-determine-when-SPI-trnsaction-completed/m-p/314127#M13701</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 don't know whether it is possible to "see" when the automatic Chip select control has negated the CS line after sending the final byte of data (apart from monitoring the state of the pin). However if I were doing it (and didn't find a better method) I would consider controlling the CS line in SW as a GPIO instead of automatically (unless there is some special timing performed by the automatic mode). Then you could monitor the RX flag which indicates that the last Rx bit has been clocked in (even if no rx is used) and then negate the CS manually. You would at least know exactly when the CS line negates.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Jul 2014 21:54:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-determine-when-SPI-trnsaction-completed/m-p/314127#M13701</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2014-07-01T21:54:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to determine when SPI trnsaction completed</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-determine-when-SPI-trnsaction-completed/m-p/314128#M13702</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Adrian,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't believe the approach you suggested would indicate that the CS bit has been negated.&amp;nbsp; It would effectively wait for the transmission to complete which is earlier i.e. when the last bit has been clocked out..&amp;nbsp; However I will spend some time checking this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the suggestion.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;bye&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Jul 2014 06:53:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-determine-when-SPI-trnsaction-completed/m-p/314128#M13702</guid>
      <dc:creator>pgo</dc:creator>
      <dc:date>2014-07-02T06:53:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to determine when SPI trnsaction completed</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-determine-when-SPI-trnsaction-completed/m-p/314129#M13703</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mark,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes using a manual approach on the CS bit would work fine but it has the same problem as the method I'm using - namely that there is extra code that has to know about which port pin is being used.&lt;/P&gt;&lt;P&gt;Not a big deal but the automatic PCS function is useful and I was hoping for an&amp;nbsp; "elegant solution".&amp;nbsp; (For some arbitrary, possibly unrealistic, level of elegant :smileyhappy:.)&lt;/P&gt;&lt;P&gt;I'm just re-reading the discussion of operating mode for the SPI and there is some information there that might mean that I could use the &lt;STRONG&gt;SR.TXRXS&lt;/STRONG&gt; bits if I set thing up correctly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'll have a play with this a post any progress.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;bye&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Jul 2014 07:02:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-determine-when-SPI-trnsaction-completed/m-p/314129#M13703</guid>
      <dc:creator>pgo</dc:creator>
      <dc:date>2014-07-02T07:02:38Z</dc:date>
    </item>
  </channel>
</rss>

