<?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: Unknown error in spi example in MQX Software Solutions</title>
    <link>https://community.nxp.com/t5/MQX-Software-Solutions/Unknown-error-in-spi-example/m-p/652503#M17232</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/danielchen@fsl"&gt;danielchen@fsl&lt;/A&gt;‌ I am sure the instructions are same,I have checked the datasheet.I am using W25Q64FV spi flash device in the custom board.&lt;/P&gt;&lt;P&gt;Now I think the routing of spi1 is not correct.I defined the pins in init_gpio.c as below&lt;/P&gt;&lt;P&gt;case 1:&lt;BR /&gt; /* Configure GPIOE for SPI1 peripheral function */&lt;BR /&gt; pctl = (PORT_MemMapPtr)PORTE_BASE_PTR;&lt;/P&gt;&lt;P&gt;pctl-&amp;gt;PCR[1] = PORT_PCR_MUX(2); /* SPI1.SOUT */&lt;BR /&gt; pctl-&amp;gt;PCR[2] = PORT_PCR_MUX(2); /* SPI1.SCK */&lt;BR /&gt; pctl-&amp;gt;PCR[3] = PORT_PCR_MUX(2); /* SPI1.SIN */&lt;BR /&gt; pctl-&amp;gt;PCR[0] = PORT_PCR_MUX(2); /* SPI1.PCS0 */&lt;/P&gt;&lt;P&gt;/* Enable clock gate to DSPI1 module */&lt;BR /&gt; sim-&amp;gt;SCGC6 |= SIM_SCGC6_SPI1_MASK;&lt;BR /&gt; break;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 28 Sep 2016 04:18:48 GMT</pubDate>
    <dc:creator>yadhukrishnanvm</dc:creator>
    <dc:date>2016-09-28T04:18:48Z</dc:date>
    <item>
      <title>Unknown error in spi example</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Unknown-error-in-spi-example/m-p/652499#M17228</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 am working with my K60N512 custom board. Now I am trying to create output for spi example in mqx folder.I found read error like below&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;-------------- SPI driver example -------------- &lt;BR /&gt; &lt;BR /&gt;This example application demonstrates usage of SPI driver. &lt;BR /&gt;It transfers data to/from external memory over SPI bus. &lt;BR /&gt;The default settings in memory.h apply to TWR-MEM flash memory. &lt;BR /&gt;Current baud rate ... 9600000 Hz &lt;BR /&gt;Changing the baud rate to 500000 Hz ... OK &lt;BR /&gt;Current baud rate ... 500000 Hz &lt;BR /&gt;Setting clock mode to SPI_CLK_POL_PHA_MODE0 ... OK &lt;BR /&gt;Getting clock mode ... SPI_CLK_POL_PHA_MODE0 &lt;BR /&gt;Setting endian to SPI_DEVICE_BIG_ENDIAN ... OK &lt;BR /&gt;Getting endian ... SPI_DEVICE_BIG_ENDIAN &lt;BR /&gt;Setting transfer mode to SPI_DEVICE_MASTER_MODE ... OK &lt;BR /&gt;Getting transfer mode ... SPI_DEVICE_MASTER_MODE &lt;BR /&gt;Clearing statistics ... OK &lt;BR /&gt;Getting statistics: &lt;BR /&gt;Rx packets: 0 &lt;BR /&gt;Tx packets: 0 &lt;BR /&gt; &lt;BR /&gt;Read memory status ... 0x00 &lt;BR /&gt;Enable write latch in memory ... OK &lt;BR /&gt;Read memory status ... 0x00 &lt;BR /&gt;Write unprotect memory ... OK &lt;BR /&gt;Enable write latch in memory ... OK &lt;BR /&gt;Read memory status ... 0x00 &lt;BR /&gt;Write unprotect memory ... OK &lt;BR /&gt;Enable write latch in memory ... OK &lt;BR /&gt;Read memory status ... 0x00 &lt;BR /&gt;Erase whole memory chip: &lt;BR /&gt;Read memory status ... 0x00 &lt;BR /&gt;Erase chip ... OK &lt;BR /&gt; &lt;BR /&gt;Enable write latch in memory ... OK &lt;BR /&gt;Read memory status ... 0x00 &lt;BR /&gt;Write byte 0xba to location 0x000000f0 in memory ... done &lt;BR /&gt;Read memory status ... 0x00 &lt;BR /&gt;Read byte from location 0x000000f0 in memory ... 0x00 &lt;BR /&gt;Byte test ... ERROR &lt;BR /&gt;Getting statistics: &lt;BR /&gt;Rx packets: 8 &lt;BR /&gt;Tx packets: 25 &lt;BR /&gt; &lt;BR /&gt;IO_IOCTL_SPI_READ_WRITE ... OK &lt;BR /&gt;Simultaneous write and read - memory read from 0x000000f0 (10): &lt;BR /&gt;Write: 0x03 0x00 0x00 0xf0 0x00 0x00 0x00 0x00 0x00 0x00 &lt;BR /&gt;Read : 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 &lt;BR /&gt;Simultaneous read/write (data == 0x00) ... ERROR &lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt;-------------- End of example --------------&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have asked this 2 times in nxp community nobody answered my questions.&lt;/P&gt;&lt;P&gt;I found strange thing which is like a bug in KDS. In the spi example there is a part of code to define the memory channel:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#if BSP_SPI_MEMORY_CHANNEL == 0&lt;/P&gt;&lt;P&gt;#if ! BSPCFG_ENABLE_SPI0&lt;BR /&gt; #error This application requires BSPCFG_ENABLE_SPI0 defined non-zero in user_config.h. Please recompile kernel with this option.&lt;BR /&gt; #else&lt;BR /&gt; #define TEST_CHANNEL "spi0:"&lt;BR /&gt; #endif&lt;/P&gt;&lt;P&gt;#elif BSP_SPI_MEMORY_CHANNEL == 1&lt;/P&gt;&lt;P&gt;#if ! BSPCFG_ENABLE_SPI1&lt;BR /&gt; #error This application requires BSPCFG_ENABLE_SPI1 defined non-zero in user_config.h. Please recompile kernel with this option.&lt;BR /&gt; #else&lt;BR /&gt; #define TEST_CHANNEL "spi1:"&lt;BR /&gt; #endif&lt;/P&gt;&lt;P&gt;#elif BSP_SPI_MEMORY_CHANNEL == 2&lt;/P&gt;&lt;P&gt;#if ! BSPCFG_ENABLE_SPI2&lt;BR /&gt; #error This application requires BSPCFG_ENABLE_SPI2 defined non-zero in user_config.h. Please recompile kernel with this option.&lt;BR /&gt; #else&lt;BR /&gt; #define TEST_CHANNEL "spi2:"&lt;BR /&gt; #endif&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have defined the macro &amp;nbsp;#define BSP_SPI_MEMORY_CHANNEL &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(1) &amp;nbsp; in the &amp;lt;board&amp;gt;.h file but look at this screen shot. When I right click on SPI_MEMORY_CHANNEL and click on explore declaratio I found this. That is the macro defined for memory channel two.But I have defined it as 1 in bsp files why is this happening please help...&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/7732i353008B0CE9ADAA9/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_2.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/7778i693AB3547A289EDB/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_2.png" alt="pastedImage_2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Sep 2016 13:34:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Unknown-error-in-spi-example/m-p/652499#M17228</guid>
      <dc:creator>yadhukrishnanvm</dc:creator>
      <dc:date>2016-09-26T13:34:08Z</dc:date>
    </item>
    <item>
      <title>Re: Unknown error in spi example</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Unknown-error-in-spi-example/m-p/652500#M17229</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A _jive_internal="true" class="" data-content-finding="Community" data-userid="285686" data-username="yadhukrishnanvm" href="https://community.nxp.com/people/yadhukrishnanvm"&gt;Yadhukrishnan&lt;/A&gt;:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Did you make clean all and rebuild your BSP ?&lt;/P&gt;&lt;P&gt;If you still think BSP_SPI_MEMORY_CHANNEL not right, I suggest you&amp;nbsp; print out this Macro to check it's real value&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>Tue, 27 Sep 2016 09:59:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Unknown-error-in-spi-example/m-p/652500#M17229</guid>
      <dc:creator>danielchen</dc:creator>
      <dc:date>2016-09-27T09:59:57Z</dc:date>
    </item>
    <item>
      <title>Re: Unknown error in spi example</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Unknown-error-in-spi-example/m-p/652501#M17230</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/danielchen@fsl"&gt;danielchen@fsl&lt;/A&gt;‌&lt;/P&gt;&lt;P&gt;I did what you said and I got&amp;nbsp;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;BSP_SPI_MEMORY_CHANNEL as 1. I did the spi example in different computers and I got the same read error.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;Please check is there any bug in this revision.I don't know why is this happening.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Sep 2016 12:05:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Unknown-error-in-spi-example/m-p/652501#M17230</guid>
      <dc:creator>yadhukrishnanvm</dc:creator>
      <dc:date>2016-09-27T12:05:50Z</dc:date>
    </item>
    <item>
      <title>Re: Unknown error in spi example</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Unknown-error-in-spi-example/m-p/652502#M17231</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 tested this demo with TWR-K65F180M, TWR-K60D100M, TWR-K60N512, not found issue, please see the picture , this is tested with K60N512.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/7iB633CDF96856D5D1/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since you are using your custom board,&amp;nbsp; I suggest you check the 4-wire SPI connection. Does your SPI1 routed to the Memory board correctly?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I checked your error message, it seems the SPI read operation is not right. I remember you are using W25Q64 spi flash, I think you need to check the SPI serial memory instructions from the datasheet, maybe you need to modify them according to your custom board.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* The SPI serial memory instructions */&lt;BR /&gt;#define SPI_MEMORY_WRITE_STATUS 0x01&lt;BR /&gt;#define SPI_MEMORY_WRITE_DATA 0x02&lt;BR /&gt;#define SPI_MEMORY_READ_DATA 0x03&lt;BR /&gt;#define SPI_MEMORY_WRITE_LATCH_DISABLE 0x04&lt;BR /&gt;#define SPI_MEMORY_READ_STATUS 0x05&lt;BR /&gt;#define SPI_MEMORY_WRITE_LATCH_ENABLE 0x06&lt;BR /&gt;#define SPI_MEMORY_CHIP_ERASE 0xC7&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>Tue, 27 Sep 2016 14:19:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Unknown-error-in-spi-example/m-p/652502#M17231</guid>
      <dc:creator>danielchen</dc:creator>
      <dc:date>2016-09-27T14:19:10Z</dc:date>
    </item>
    <item>
      <title>Re: Unknown error in spi example</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Unknown-error-in-spi-example/m-p/652503#M17232</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/danielchen@fsl"&gt;danielchen@fsl&lt;/A&gt;‌ I am sure the instructions are same,I have checked the datasheet.I am using W25Q64FV spi flash device in the custom board.&lt;/P&gt;&lt;P&gt;Now I think the routing of spi1 is not correct.I defined the pins in init_gpio.c as below&lt;/P&gt;&lt;P&gt;case 1:&lt;BR /&gt; /* Configure GPIOE for SPI1 peripheral function */&lt;BR /&gt; pctl = (PORT_MemMapPtr)PORTE_BASE_PTR;&lt;/P&gt;&lt;P&gt;pctl-&amp;gt;PCR[1] = PORT_PCR_MUX(2); /* SPI1.SOUT */&lt;BR /&gt; pctl-&amp;gt;PCR[2] = PORT_PCR_MUX(2); /* SPI1.SCK */&lt;BR /&gt; pctl-&amp;gt;PCR[3] = PORT_PCR_MUX(2); /* SPI1.SIN */&lt;BR /&gt; pctl-&amp;gt;PCR[0] = PORT_PCR_MUX(2); /* SPI1.PCS0 */&lt;/P&gt;&lt;P&gt;/* Enable clock gate to DSPI1 module */&lt;BR /&gt; sim-&amp;gt;SCGC6 |= SIM_SCGC6_SPI1_MASK;&lt;BR /&gt; break;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Sep 2016 04:18:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Unknown-error-in-spi-example/m-p/652503#M17232</guid>
      <dc:creator>yadhukrishnanvm</dc:creator>
      <dc:date>2016-09-28T04:18:48Z</dc:date>
    </item>
    <item>
      <title>Re: Unknown error in spi example</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Unknown-error-in-spi-example/m-p/652504#M17233</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/danielchen@fsl"&gt;danielchen@fsl&lt;/A&gt;‌&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/1034i587CAA04E35BC16F/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;These are the pins I am using in the custom board.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Sep 2016 04:32:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Unknown-error-in-spi-example/m-p/652504#M17233</guid>
      <dc:creator>yadhukrishnanvm</dc:creator>
      <dc:date>2016-09-28T04:32:22Z</dc:date>
    </item>
    <item>
      <title>Re: Unknown error in spi example</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Unknown-error-in-spi-example/m-p/652505#M17234</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;&lt;/P&gt;&lt;P&gt;Since you are use PTE4 and PTE5&amp;nbsp; as&amp;nbsp; SPI1_HLD and SPI1_WP, &amp;nbsp; did you configure PTE4 and PTE5 ?&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another thing you need to check is the SPI instructions and it's sequence. On TWR-MEM board, SPI serial memory is AT26DF081A, Please see the details at&amp;nbsp; &lt;A class="link-titled" href="http://www.atmel.com/Images/doc3600.pdf" title="http://www.atmel.com/Images/doc3600.pdf"&gt;http://www.atmel.com/Images/doc3600.pdf&lt;/A&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You need to check the difference between them and do some modifications according to your SPI memory chip.&lt;/P&gt;&lt;P&gt;(spi_memory.c&amp;nbsp; and spi_memory.h)&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>Thu, 29 Sep 2016 06:32:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Unknown-error-in-spi-example/m-p/652505#M17234</guid>
      <dc:creator>danielchen</dc:creator>
      <dc:date>2016-09-29T06:32:40Z</dc:date>
    </item>
  </channel>
</rss>

