<?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>MQX Software SolutionsのトピックMQX 4.2 SPI CLK doesn't work while reading</title>
    <link>https://community.nxp.com/t5/MQX-Software-Solutions/MQX-4-2-SPI-CLK-doesn-t-work-while-reading/m-p/508750#M16251</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I try to send a command via SPI from MCU (K60) with MQX 4.2 to a slave device and receive a response from it.&lt;/P&gt;&lt;P&gt;the command size is 6 bytes (cmdSize)&lt;/P&gt;&lt;P&gt;the response size is 10 bytes (dataSize)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for this operation I've written the code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;EM&gt;int Result = fwrite(cmd, 1, cmdSize, m_SpiHndl);&lt;/EM&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (Result != cmdSize)&lt;/EM&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp; &lt;/EM&gt;&lt;/TD&gt;&lt;TD&gt;&lt;EM&gt; return false;&lt;/EM&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Result = fread(data, 1, dataSize, m_SpiHndl);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp; fflush(m_SpiHndl);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem is that Master MCU CLK works only for fwrite and doesn't work for fread.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It looks like:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="2016-04-16_spi.jpg"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/32322i432D948D1B530F37/image-size/large?v=v2&amp;amp;px=999" role="button" title="2016-04-16_spi.jpg" alt="2016-04-16_spi.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;But in the SPI registers (SPI2_TCR) it's set that 16 bytes were transferred (6 for cmd and 10 for receiving data):&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="2016-04-16_spi_regs.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/32370iA103B9BC2E1D96CB/image-size/large?v=v2&amp;amp;px=999" role="button" title="2016-04-16_spi_regs.png" alt="2016-04-16_spi_regs.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What can I do in order to solve this problem?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yours faithfully,&lt;/P&gt;&lt;P&gt;Serge&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 15 Apr 2016 22:42:53 GMT</pubDate>
    <dc:creator>SergeMaslenniko</dc:creator>
    <dc:date>2016-04-15T22:42:53Z</dc:date>
    <item>
      <title>MQX 4.2 SPI CLK doesn't work while reading</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/MQX-4-2-SPI-CLK-doesn-t-work-while-reading/m-p/508750#M16251</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I try to send a command via SPI from MCU (K60) with MQX 4.2 to a slave device and receive a response from it.&lt;/P&gt;&lt;P&gt;the command size is 6 bytes (cmdSize)&lt;/P&gt;&lt;P&gt;the response size is 10 bytes (dataSize)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for this operation I've written the code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;EM&gt;int Result = fwrite(cmd, 1, cmdSize, m_SpiHndl);&lt;/EM&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (Result != cmdSize)&lt;/EM&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp; &lt;/EM&gt;&lt;/TD&gt;&lt;TD&gt;&lt;EM&gt; return false;&lt;/EM&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Result = fread(data, 1, dataSize, m_SpiHndl);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp; fflush(m_SpiHndl);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem is that Master MCU CLK works only for fwrite and doesn't work for fread.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It looks like:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="2016-04-16_spi.jpg"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/32322i432D948D1B530F37/image-size/large?v=v2&amp;amp;px=999" role="button" title="2016-04-16_spi.jpg" alt="2016-04-16_spi.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;But in the SPI registers (SPI2_TCR) it's set that 16 bytes were transferred (6 for cmd and 10 for receiving data):&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="2016-04-16_spi_regs.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/32370iA103B9BC2E1D96CB/image-size/large?v=v2&amp;amp;px=999" role="button" title="2016-04-16_spi_regs.png" alt="2016-04-16_spi_regs.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What can I do in order to solve this problem?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yours faithfully,&lt;/P&gt;&lt;P&gt;Serge&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Apr 2016 22:42:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/MQX-4-2-SPI-CLK-doesn-t-work-while-reading/m-p/508750#M16251</guid>
      <dc:creator>SergeMaslenniko</dc:creator>
      <dc:date>2016-04-15T22:42:53Z</dc:date>
    </item>
    <item>
      <title>Re: MQX 4.2 SPI CLK doesn't work while reading</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/MQX-4-2-SPI-CLK-doesn-t-work-while-reading/m-p/508751#M16252</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Serge:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;These lines also exist in MQX spi demo code&lt;/P&gt;&lt;P&gt;&amp;nbsp; C:\Freescale\Freescale_MQX_4_2\mqx\examples\spi\spi_memory.c.&amp;nbsp; In function memory_read_status,&lt;/P&gt;&lt;P&gt;.....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Write instruction */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; result = fwrite (buffer, 1, 1, spifd);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (result != 1)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Stop transfer */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf ("ERROR (tx)\n");&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return state;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Read memory status */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; result = fread (&amp;amp;state, 1, 1, spifd);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Deactivate CS */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fflush (spifd);&lt;/P&gt;&lt;P&gt;.....&lt;/P&gt;&lt;P&gt;Can you run this demo well?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Apr 2016 07:39:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/MQX-4-2-SPI-CLK-doesn-t-work-while-reading/m-p/508751#M16252</guid>
      <dc:creator>danielchen</dc:creator>
      <dc:date>2016-04-25T07:39:39Z</dc:date>
    </item>
    <item>
      <title>Re: MQX 4.2 SPI CLK doesn't work while reading</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/MQX-4-2-SPI-CLK-doesn-t-work-while-reading/m-p/508752#M16253</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Daniel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Recently I've found that it works without my oscilloscope connected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But the strange thing is:&lt;/P&gt;&lt;P&gt;1. when I call &lt;EM&gt;fwrite it's &lt;/EM&gt;possible to see CLK with oscilloscope&lt;/P&gt;&lt;P&gt;2. when I call &lt;EM&gt;fread &lt;/EM&gt;it's possible to see CLK with oscilloscope&lt;/P&gt;&lt;P&gt;3. when I call &lt;EM&gt;fwrite&lt;/EM&gt; and then&lt;EM&gt; &lt;/EM&gt;&lt;EM&gt;fread &lt;/EM&gt;it is not possible to see CLK with oscilloscope, but without oscilloscope connected it's working well&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Perhaps this situation is fault of my oscilloscope (pico 72205A)?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Serge&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Apr 2016 18:49:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/MQX-4-2-SPI-CLK-doesn-t-work-while-reading/m-p/508752#M16253</guid>
      <dc:creator>SergeMaslenniko</dc:creator>
      <dc:date>2016-04-27T18:49:49Z</dc:date>
    </item>
  </channel>
</rss>

