<?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 How to shoot the trouble? in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-shoot-the-trouble/m-p/341014#M16417</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I create a project in KDS, and it use MK10DX256VLH7. Now, I have a question to ask for your help.&lt;/P&gt;&lt;P&gt;I use PE to initial a SPI component, which involve Input interrupt and Output interrupt,and at the initial progress, PE auto enable SPI component also.Then, I define two variables, &lt;EM&gt;&lt;STRONG&gt;spi_tx_fin&lt;/STRONG&gt; &lt;/EM&gt;and &lt;EM&gt;&lt;STRONG&gt;spi_rx_fin&lt;/STRONG&gt;. &lt;/EM&gt;In the project, PE create two event functions, &lt;EM&gt;&lt;STRONG&gt;void SPI_OnBlockReceived(LDD_TUserData *UserDataPtr)&lt;/STRONG&gt; &lt;/EM&gt;and &lt;STRONG&gt;&lt;EM&gt;void SPI_OnBlockSent(LDD_TUserData *UserDataPtr). &lt;/EM&gt;&lt;/STRONG&gt;For the convenience of polling SPI transmit and/or receive progress success or not, I write the code: &lt;EM&gt;&lt;STRONG&gt;spi_tx&lt;/STRONG&gt;&lt;/EM&gt;&lt;STRONG&gt;&lt;EM&gt;_fin&lt;/EM&gt;&lt;EM&gt; = Yes &lt;/EM&gt;&lt;/STRONG&gt;and&lt;EM&gt; &lt;EM&gt;&lt;STRONG&gt;spi_rx_fin&lt;/STRONG&gt;&lt;/EM&gt;&lt;STRONG&gt; = Yes&amp;nbsp; (Macro: Yes=1, No=0) &lt;/STRONG&gt;&lt;/EM&gt;in the two event functions respectively. Afterward, I define another function &lt;STRONG&gt;&lt;EM&gt;MotorInit()&lt;/EM&gt;&lt;/STRONG&gt;, which call function&amp;nbsp; &lt;STRONG&gt;&lt;EM&gt;LDD_TError SPI_SendBlock(LDD_TDeviceData *DeviceDataPtr, LDD_TData *BufferPtr, uint16_t Size) &lt;/EM&gt;&lt;/STRONG&gt;generated by PE to transmit data on the SPI module. The code as follows:&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;STRONG&gt;&lt;EM&gt; spi_tx_fin = No;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;&amp;nbsp; SPI_SendBlock(pSPI,if_configuration_429.buffer,4);&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;&amp;nbsp; while(spi_tx_fin == No);&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately, when debug program, the progress was blocked here &lt;STRONG&gt;&lt;EM&gt; while(spi_tx_fin == No);&lt;/EM&gt;&lt;/STRONG&gt; I checked the debug progress and was sure in the event function &lt;STRONG&gt;&lt;EM&gt;void SPI_OnBlockSent(LDD_TUserData *UserDataPtr) &lt;/EM&gt;&lt;/STRONG&gt;the variable &lt;STRONG&gt;&lt;EM&gt;spi_tx_fin&lt;/EM&gt;&lt;/STRONG&gt; was set &lt;EM&gt;&lt;STRONG&gt;Yes&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;By the way, I offer my project to you. Thank you!&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Original Attachment has been moved to: &lt;A _jive_internal="true" href="https://community.nxp.com/docs/DOC-337635"&gt;workspace.kds.rar&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 14 Nov 2014 11:35:25 GMT</pubDate>
    <dc:creator>guohuoping</dc:creator>
    <dc:date>2014-11-14T11:35:25Z</dc:date>
    <item>
      <title>How to shoot the trouble?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-shoot-the-trouble/m-p/341014#M16417</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I create a project in KDS, and it use MK10DX256VLH7. Now, I have a question to ask for your help.&lt;/P&gt;&lt;P&gt;I use PE to initial a SPI component, which involve Input interrupt and Output interrupt,and at the initial progress, PE auto enable SPI component also.Then, I define two variables, &lt;EM&gt;&lt;STRONG&gt;spi_tx_fin&lt;/STRONG&gt; &lt;/EM&gt;and &lt;EM&gt;&lt;STRONG&gt;spi_rx_fin&lt;/STRONG&gt;. &lt;/EM&gt;In the project, PE create two event functions, &lt;EM&gt;&lt;STRONG&gt;void SPI_OnBlockReceived(LDD_TUserData *UserDataPtr)&lt;/STRONG&gt; &lt;/EM&gt;and &lt;STRONG&gt;&lt;EM&gt;void SPI_OnBlockSent(LDD_TUserData *UserDataPtr). &lt;/EM&gt;&lt;/STRONG&gt;For the convenience of polling SPI transmit and/or receive progress success or not, I write the code: &lt;EM&gt;&lt;STRONG&gt;spi_tx&lt;/STRONG&gt;&lt;/EM&gt;&lt;STRONG&gt;&lt;EM&gt;_fin&lt;/EM&gt;&lt;EM&gt; = Yes &lt;/EM&gt;&lt;/STRONG&gt;and&lt;EM&gt; &lt;EM&gt;&lt;STRONG&gt;spi_rx_fin&lt;/STRONG&gt;&lt;/EM&gt;&lt;STRONG&gt; = Yes&amp;nbsp; (Macro: Yes=1, No=0) &lt;/STRONG&gt;&lt;/EM&gt;in the two event functions respectively. Afterward, I define another function &lt;STRONG&gt;&lt;EM&gt;MotorInit()&lt;/EM&gt;&lt;/STRONG&gt;, which call function&amp;nbsp; &lt;STRONG&gt;&lt;EM&gt;LDD_TError SPI_SendBlock(LDD_TDeviceData *DeviceDataPtr, LDD_TData *BufferPtr, uint16_t Size) &lt;/EM&gt;&lt;/STRONG&gt;generated by PE to transmit data on the SPI module. The code as follows:&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;STRONG&gt;&lt;EM&gt; spi_tx_fin = No;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;&amp;nbsp; SPI_SendBlock(pSPI,if_configuration_429.buffer,4);&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;&amp;nbsp; while(spi_tx_fin == No);&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately, when debug program, the progress was blocked here &lt;STRONG&gt;&lt;EM&gt; while(spi_tx_fin == No);&lt;/EM&gt;&lt;/STRONG&gt; I checked the debug progress and was sure in the event function &lt;STRONG&gt;&lt;EM&gt;void SPI_OnBlockSent(LDD_TUserData *UserDataPtr) &lt;/EM&gt;&lt;/STRONG&gt;the variable &lt;STRONG&gt;&lt;EM&gt;spi_tx_fin&lt;/EM&gt;&lt;/STRONG&gt; was set &lt;EM&gt;&lt;STRONG&gt;Yes&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;By the way, I offer my project to you. Thank you!&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Original Attachment has been moved to: &lt;A _jive_internal="true" href="https://community.nxp.com/docs/DOC-337635"&gt;workspace.kds.rar&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Nov 2014 11:35:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-shoot-the-trouble/m-p/341014#M16417</guid>
      <dc:creator>guohuoping</dc:creator>
      <dc:date>2014-11-14T11:35:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to shoot the trouble?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-shoot-the-trouble/m-p/341015#M16418</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Guo Huoping,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think i would come from the global optimization by C Compiler. Therefore,&lt;/P&gt;&lt;P&gt;&amp;nbsp; while(spi_tx_fin == No);&lt;/P&gt;&lt;P&gt;would be always true (not exit from whle loop) because of the above statement as&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; spi_tx_fin = No;.&lt;/P&gt;&lt;P&gt;Do you add 'volatile' key word to declaration of the&amp;nbsp; spi_tx_fin and spi_rx_fin? If not, by adding 'volatile' to those variable declarations, it would go well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;BR /&gt;Yasuhiko Koumoto.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Nov 2014 11:19:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-shoot-the-trouble/m-p/341015#M16418</guid>
      <dc:creator>yasuhikokoumoto</dc:creator>
      <dc:date>2014-11-17T11:19:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to shoot the trouble?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-shoot-the-trouble/m-p/341016#M16419</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you！Your advice is good, I have shoot the trouble!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Nov 2014 10:04:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-shoot-the-trouble/m-p/341016#M16419</guid>
      <dc:creator>guohuoping</dc:creator>
      <dc:date>2014-11-26T10:04:58Z</dc:date>
    </item>
  </channel>
</rss>

