<?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: S08-Incorrect method in SPI Driver in CodeWarrior for MCU</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/S08-Incorrect-method-in-SPI-Driver/m-p/401109#M11552</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello pawan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I know your meaning .&lt;/P&gt;&lt;P&gt;After i checked the Data sheet , i think there is not the flag to show finish the data send .&lt;/P&gt;&lt;P&gt;While , for&amp;nbsp; the SPI is full duplex , so we can use the read flag (SPRF) , After the&amp;nbsp; SPRF to be set , then read teh SPIX_D, then togging the GPIO.&lt;/P&gt;&lt;P&gt;The detail information you can refer to here :&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.nxp.com/docs/DOC-100784"&gt;L-Series SPI GPIO CS/SS&lt;/A&gt;&amp;nbsp; . this doc is for kinetis L series chip, while the theory is the same , you can test it .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;Alice&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>Mon, 03 Aug 2015 09:27:14 GMT</pubDate>
    <dc:creator>Alice_Yang</dc:creator>
    <dc:date>2015-08-03T09:27:14Z</dc:date>
    <item>
      <title>S08-Incorrect method in SPI Driver</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/S08-Incorrect-method-in-SPI-Driver/m-p/401106#M11549</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Friends,&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since 4 weeks, I have been exploring with MC9S08DZ60. I have two queries. I will be specific to the SPI related question here. &lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have configured the SPI in Master mode, with Mode fault indication disabled. I am trying to use the Slave Select bit as a GPIO in order to control the pin Manually. &lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's a shabby code which works well to transmit data to the slave. Please find my question below the code snippet.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;void SPISendChar (unsigned char data)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; while (!SPIS_SPTEF);&amp;nbsp; /* wait until transmit buffer is empty*/&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SPID = data;&amp;nbsp; /* Transmit counter*/&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; while(!SPIS_SPTEF);&lt;/P&gt;&lt;P&gt; }&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;void dacfeed(char value)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp; led1=1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; led2=0;&lt;/P&gt;&lt;P&gt;&amp;nbsp; ss=0x01;&lt;/P&gt;&lt;P&gt;&amp;nbsp; SPISendChar(0x0F);&lt;/P&gt;&lt;P&gt;&amp;nbsp; delaysmall(50);&lt;/P&gt;&lt;P&gt;&amp;nbsp; SPISendChar(value);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //To Toggle the SS pin after the Data Transmit is over, I need to wait for delaysmall(50);&lt;/P&gt;&lt;P&gt;&amp;nbsp; delaysmall(50);&lt;/P&gt;&lt;P&gt;&amp;nbsp; ss=0x00;&lt;/P&gt;&lt;P&gt;&amp;nbsp; delaysmall(1);&lt;/P&gt;&lt;P&gt;&amp;nbsp; ss=0x01;&lt;/P&gt;&lt;P&gt;&amp;nbsp; led2=1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; led1=0;&lt;/P&gt;&lt;P&gt;&amp;nbsp; delaysmall(10);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;void delaysmall(int time)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp; int a;&lt;/P&gt;&lt;P&gt;&amp;nbsp; for(a=0;a&amp;lt;time;a++);&lt;/P&gt;&lt;P&gt; }&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The flag SPIS_SPTEF goes high immediately (within 2 SPI Clock cycles) . I could observe this through an oscilloscope. So, I need to purposefully introduce a delay with trial and error to make the protocol work suitably for a Slave DAC device. Is there no flag indicating that all the 8 clock cycles are over? Or is there any novel method to write this driver code?&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My feeling is that there is some flag indication because the Automatic Slave select works beautifully well.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would sincerely thank any help provided as I have been struggling a lot throughout this phase.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Thank You.&lt;BR /&gt;Pawan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 Jul 2015 05:44:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/S08-Incorrect-method-in-SPI-Driver/m-p/401106#M11549</guid>
      <dc:creator>pawankumar</dc:creator>
      <dc:date>2015-07-31T05:44:21Z</dc:date>
    </item>
    <item>
      <title>Re: S08-Incorrect method in SPI Driver</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/S08-Incorrect-method-in-SPI-Driver/m-p/401107#M11550</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Pawan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(1) About "Is there no flag indicating that all the 8 clock cycles are over?" , the bit of SPTEF of SPIS register is . You can refer to the Data Sheet of S08DZ60.&lt;/P&gt;&lt;P&gt;"&lt;/P&gt;&lt;P&gt;SPTEF is automatically set when a data byte transfers from the transmit buffer into the transmit shift register.&lt;/P&gt;&lt;P&gt;"&lt;/P&gt;&lt;P&gt;(2) Sorry i do not clearly know your demand , what problem does your code have ? Does it can not transform data ? or what ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;Alice&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Aug 2015 03:19:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/S08-Incorrect-method-in-SPI-Driver/m-p/401107#M11550</guid>
      <dc:creator>Alice_Yang</dc:creator>
      <dc:date>2015-08-03T03:19:02Z</dc:date>
    </item>
    <item>
      <title>Re: S08-Incorrect method in SPI Driver</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/S08-Incorrect-method-in-SPI-Driver/m-p/401108#M11551</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Alice,&lt;/P&gt;&lt;P&gt; Thanks for the reply. Am sorry that I wasn't able to make it clear. Let me try to describe my issue in brief.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;After I check for &lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;SPTEF flag, I transmit data to SPID register. Again, I wait till the &lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;SPTEF flag gets '1'.&amp;nbsp; Now, this event happens at the 2nd SPI clock cycle, not waiting till all the 8 clock cycles get completed. I am manually toggling the GPIO for Slave Select. &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;I want to implement a proper function for this without me introducing a random calculated delay till the 8 clock cycles get complete.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;Your help would be useful to me.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;Pawan.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Aug 2015 05:08:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/S08-Incorrect-method-in-SPI-Driver/m-p/401108#M11551</guid>
      <dc:creator>pawankumar</dc:creator>
      <dc:date>2015-08-03T05:08:45Z</dc:date>
    </item>
    <item>
      <title>Re: S08-Incorrect method in SPI Driver</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/S08-Incorrect-method-in-SPI-Driver/m-p/401109#M11552</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello pawan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I know your meaning .&lt;/P&gt;&lt;P&gt;After i checked the Data sheet , i think there is not the flag to show finish the data send .&lt;/P&gt;&lt;P&gt;While , for&amp;nbsp; the SPI is full duplex , so we can use the read flag (SPRF) , After the&amp;nbsp; SPRF to be set , then read teh SPIX_D, then togging the GPIO.&lt;/P&gt;&lt;P&gt;The detail information you can refer to here :&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.nxp.com/docs/DOC-100784"&gt;L-Series SPI GPIO CS/SS&lt;/A&gt;&amp;nbsp; . this doc is for kinetis L series chip, while the theory is the same , you can test it .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;Alice&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>Mon, 03 Aug 2015 09:27:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/S08-Incorrect-method-in-SPI-Driver/m-p/401109#M11552</guid>
      <dc:creator>Alice_Yang</dc:creator>
      <dc:date>2015-08-03T09:27:14Z</dc:date>
    </item>
    <item>
      <title>Re: S08-Incorrect method in SPI Driver</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/S08-Incorrect-method-in-SPI-Driver/m-p/401110#M11553</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Alice,&lt;/P&gt;&lt;P&gt;This work around seems interesting.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just had a glimpse of the article. Am now going to read it fully and experiment on it.&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;Update : Thank you so much Alice! This solution works perfectly for me... Keep helping me!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pawan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Aug 2015 10:20:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/S08-Incorrect-method-in-SPI-Driver/m-p/401110#M11553</guid>
      <dc:creator>pawankumar</dc:creator>
      <dc:date>2015-08-03T10:20:44Z</dc:date>
    </item>
  </channel>
</rss>

