<?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中的主题 Re: SPi Flash Memory Read error</title>
    <link>https://community.nxp.com/t5/MQX-Software-Solutions/SPi-Flash-Memory-Read-error/m-p/471071#M15600</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Soledad,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your support.&lt;/P&gt;&lt;P&gt;David Zhou&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 15 Apr 2016 12:23:42 GMT</pubDate>
    <dc:creator>davidzhou</dc:creator>
    <dc:date>2016-04-15T12:23:42Z</dc:date>
    <item>
      <title>SPi Flash Memory Read error</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/SPi-Flash-Memory-Read-error/m-p/471067#M15596</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have K60 tower. I tried example code in the folder Freescale_MQX_4_2\mqx\examples\spi_legacy&lt;/P&gt;&lt;P&gt;I have three issues:&lt;/P&gt;&lt;P&gt;1. in spi.c code, I have to comment out the following code snippet:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;if (SPI_OK == ioctl (spifd, IO_IOCTL_SPI_GET_STATS, &amp;amp;stats))&amp;nbsp;&amp;nbsp; {&amp;nbsp;&amp;nbsp; &lt;/TD&gt;&lt;TD&gt; // Get statistics&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; printf ("Interrupts:&amp;nbsp;&amp;nbsp; %d\n", stats.INTERRUPTS);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; printf ("Rx packets:&amp;nbsp;&amp;nbsp; %d\n", stats.RX_PACKETS);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; printf ("Rx overflow:&amp;nbsp; %d\n", stats.RX_OVERFLOWS);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; printf ("Tx packets:&amp;nbsp;&amp;nbsp; %d\n", stats.TX_PACKETS);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; printf ("Tx aborts :&amp;nbsp;&amp;nbsp; %d\n", stats.TX_ABORTS);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; printf ("Tx underflow: %d\n", stats.TX_UNDERFLOWS);&lt;/P&gt;&lt;P&gt;} &lt;/P&gt;&lt;P&gt;because the stats structure doesn't include INTERRUPTS, RX_OVERFLOWS, TX_ABORTS, and TX_UNDERFLOWS.&lt;/P&gt;&lt;P&gt;After commented out, it runs. I have SPI0 channel enabled. Program runs with Write Returns successfully, and Read Back as 0's.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2.&lt;/P&gt;&lt;P&gt;Read memory status ... 0x00&lt;/P&gt;&lt;P&gt;Enable write latch in memory ... OK&lt;/P&gt;&lt;P&gt;Read memory status ... 0x00&lt;/P&gt;&lt;P&gt;Write unprotect memory ... OK&lt;/P&gt;&lt;P&gt;Enable write latch in memory ... OK&lt;/P&gt;&lt;P&gt;Read memory status ... 0x00&lt;/P&gt;&lt;P&gt;Erase whole memory chip:&lt;/P&gt;&lt;P&gt;Read memory status ... 0x00&lt;/P&gt;&lt;P&gt;Erase chip ...OK&lt;/P&gt;&lt;P&gt;Enable write latch in memory ... OK&lt;/P&gt;&lt;P&gt;Read memory status ... 0x00&lt;/P&gt;&lt;P&gt;Write byte to location 0x00100000 in memory ... [0xBA] &lt;/P&gt;&lt;P&gt;Read memory status ... 0x00&lt;/P&gt;&lt;P&gt;Read byte from location 0x00100000 in memory ... [0x00]&lt;/P&gt;&lt;P&gt;Writing [Hello,World!]&lt;/P&gt;&lt;P&gt;Enable write latch in memory ... OK&lt;/P&gt;&lt;P&gt;Read memory status ... 0x00&lt;/P&gt;&lt;P&gt;Page write 12 bytes to location 0x001001f0 in memory:&lt;/P&gt;&lt;P&gt;Hello,World!&lt;/P&gt;&lt;P&gt;Read memory status ... 0x00&lt;/P&gt;&lt;P&gt;Reading 12 bytes from location 0x001001f0 in memory: &lt;/P&gt;&lt;P&gt;Read []&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- Error Here --- it shall read back Hello,World!, instead of empty string &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Enable write latch in memory ... OK&lt;/P&gt;&lt;P&gt;Read memory status ... 0x00&lt;/P&gt;&lt;P&gt;Page write 16 bytes to location 0x001002f0 in memory:&lt;/P&gt;&lt;P&gt;ABCDEFGHIJKLMNOP&lt;/P&gt;&lt;P&gt;Enable write latch in memory ... OK&lt;/P&gt;&lt;P&gt;Read memory status ... 0x00&lt;/P&gt;&lt;P&gt;Page write 56 bytes to location 0x00100300 in memory:&lt;/P&gt;&lt;P&gt;QRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz1234567890&lt;/P&gt;&lt;P&gt;Read memory status ... 0x00&lt;/P&gt;&lt;P&gt;Reading 72 bytes from location 0x001002f0 in memory: &lt;/P&gt;&lt;P&gt;IO_IOCTL_SPI_READ_WRITE ... OK&lt;/P&gt;&lt;P&gt;Simultaneous write and read - memory read from 0x00100000 (10):&lt;/P&gt;&lt;P&gt;Write: 0x03 0x10 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 &lt;/P&gt;&lt;P&gt;Read : 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 &lt;/P&gt;&lt;P&gt;Simultaneous read/write (data == 0x00) ... ERROR&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. In Interrupt Mode, according to the readme.pdf in the spi_legacy folder, BSPCFG_ENABLE_ISPI0 macros must be set to non-zero in the user_config.h&lt;/P&gt;&lt;P&gt;I have problems with BSPCFG_ENABLE_ISPI0. The parameter is not defined in the user_config.h file, if I added a line after #define BSPCFG_ENABLE_SPI0&amp;nbsp; 1&lt;/P&gt;&lt;P&gt;#define BSPCFG_ENABLE_ISPI0&amp;nbsp; 1&lt;/P&gt;&lt;P&gt;then it seems has problem with graphical view of the user_config.h, at least the BSPCFG_ENABLE_ISPI0 is not displayed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;David Zhou&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Mar 2016 20:13:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/SPi-Flash-Memory-Read-error/m-p/471067#M15596</guid>
      <dc:creator>davidzhou</dc:creator>
      <dc:date>2016-03-31T20:13:10Z</dc:date>
    </item>
    <item>
      <title>Re: SPi Flash Memory Read error</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/SPi-Flash-Memory-Read-error/m-p/471068#M15597</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello David:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you explain a little more the questions 1 and 2??&lt;/P&gt;&lt;P&gt;For question 3, the example shows two mechanisms associated with SPI peripheral module: polling and interrupt.&lt;/P&gt;&lt;P&gt;If you want to select polling mode you need to enable only&amp;nbsp; the spi0&amp;nbsp; #define BSPCFG_ENABLE_SPI0&amp;nbsp; 1&lt;/P&gt;&lt;P&gt;if you want to select interrupt mode you need to enable only isp0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #define BSPCFG_ENABLE_ISPI0&amp;nbsp; 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have a great day,&lt;BR /&gt; Sol &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, 04 Apr 2016 21:02:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/SPi-Flash-Memory-Read-error/m-p/471068#M15597</guid>
      <dc:creator>soledad</dc:creator>
      <dc:date>2016-04-04T21:02:24Z</dc:date>
    </item>
    <item>
      <title>Re: SPi Flash Memory Read error</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/SPi-Flash-Memory-Read-error/m-p/471069#M15598</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sol,&lt;/P&gt;&lt;P&gt;Sorry for not making myself clear.&lt;/P&gt;&lt;P&gt;1. in the spi.c code (from mqx/example/spi_legacy, or spi folder),&lt;/P&gt;&lt;P&gt;&amp;nbsp; the stats variable is defined as SPI_STATISTICS_STRUCT type. But the struct SPI_STATISTICS_STRUCT is defined in the spi.h as following:&lt;/P&gt;&lt;P&gt;/*&lt;/P&gt;&lt;P&gt;** SPI_STATISTICS_STRUCT&lt;/P&gt;&lt;P&gt;**&lt;/P&gt;&lt;P&gt;** This is used to get statistics data from SPI device using IO_IOCTL_SPI_GET_STATS.&lt;/P&gt;&lt;P&gt;*/&lt;/P&gt;&lt;P&gt;typedef struct spi_statistics_struct&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; /* Number of valid frames received (not dummy receives) */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; uint32_t&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RX_PACKETS;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; /* Number of valid frames transmitted (not dummy transmits) */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; uint32_t&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TX_PACKETS;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;} SPI_STATISTICS_STRUCT, * SPI_STATISTICS_STRUCT_PTR;&lt;/P&gt;&lt;P&gt;which doesn't have stats.INTERRUPTS, etc. members. Only two members RX_PACKETS and TX_PACKETS are defined in the &lt;/P&gt;&lt;P&gt;SPI_STATISTICS_STRUCT structure. So original spi.c in the example folder can not be compiled. I had to comment these lines out, in order to compile the example code. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Those are the messages output from the spi.c example program. The only change I made was the flash address to 0x100000. You can see that all outputs are OK, until&lt;/P&gt;&lt;P&gt;Write byte to location 0x00100000 in memory ... [0xBA]&amp;nbsp;&amp;nbsp; --0xBA is the byte written into memory 0x00100000 on flash &lt;/P&gt;&lt;P&gt;Read memory status ... 0x00&lt;/P&gt;&lt;P&gt;Read byte from location 0x00100000 in memory ... [0x00]&amp;nbsp; - this shall be 0xBA, but it reads beack [0x00]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. this is minor issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;David Zhou&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Apr 2016 12:54:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/SPi-Flash-Memory-Read-error/m-p/471069#M15598</guid>
      <dc:creator>davidzhou</dc:creator>
      <dc:date>2016-04-05T12:54:37Z</dc:date>
    </item>
    <item>
      <title>Re: SPi Flash Memory Read error</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/SPi-Flash-Memory-Read-error/m-p/471070#M15599</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello David,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry for my delay.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;There are two spi.h files one for the new spi driver (C:\Freescale\Freescale_MQX_4_2\mqx\source\io\spi) and the other one for the legacy spi (C:\Freescale\Freescale_MQX_4_2\mqx\source\io\spi_legacy).&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;MQX v4.2 supports the new SPI driver so if you enable the spi0 in the user_confing.h (#define BSPCFG_ENABLE_SPI0 0) you are implementing the new spi driver. This means that when you create a new project and uses the #include &amp;lt;spi.h&amp;gt; the project is pointing to the new spi.h file.&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;Please check the below thread and let me know if this helps.&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;A _jive_internal="true" href="https://community.nxp.com/thread/331576"&gt;https://community.freescale.com/thread/331576&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt; Sol &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>Thu, 14 Apr 2016 21:44:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/SPi-Flash-Memory-Read-error/m-p/471070#M15599</guid>
      <dc:creator>soledad</dc:creator>
      <dc:date>2016-04-14T21:44:18Z</dc:date>
    </item>
    <item>
      <title>Re: SPi Flash Memory Read error</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/SPi-Flash-Memory-Read-error/m-p/471071#M15600</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Soledad,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your support.&lt;/P&gt;&lt;P&gt;David Zhou&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Apr 2016 12:23:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/SPi-Flash-Memory-Read-error/m-p/471071#M15600</guid>
      <dc:creator>davidzhou</dc:creator>
      <dc:date>2016-04-15T12:23:42Z</dc:date>
    </item>
  </channel>
</rss>

