<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>spi problem</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/8274/spi-problem</link><description>Hi: 
 I use spi0(0x40003000) to wirte data to external flash(W25Q64) with SD8.0(sdk8.0.if I write data without sd, it is OK), and when program run to rx_data[number_of_txd_bytes]=(uint8_t)spi_base-&amp;gt;RXD in spi_master.c.and program can&amp;#39;t continue running</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 24 Jul 2015 09:20:01 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/8274/spi-problem" /><item><title>RE: spi problem</title><link>https://devzone.nordicsemi.com/thread/29809?ContentTypeID=1</link><pubDate>Fri, 24 Jul 2015 09:20:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b60cf105-ddd0-4c0c-afcc-9db0e687a707</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;@jerly: Your chip is the latest one (XLR3). So what was the issue when you test with the SPI library from SDK v8.0 ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: spi problem</title><link>https://devzone.nordicsemi.com/thread/29808?ContentTypeID=1</link><pubDate>Thu, 23 Jul 2015 15:13:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:21d60fff-85b0-4880-9782-6717cccbdadc</guid><dc:creator>jerly</dc:creator><description>&lt;p&gt;Hung.thank you for answer.i want to write and read data from external flash(W25Q64).i have test it with DK.the chip revision is N51422 QFACA1 1442AB&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: spi problem</title><link>https://devzone.nordicsemi.com/thread/29807?ContentTypeID=1</link><pubDate>Thu, 23 Jul 2015 12:20:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:37495f63-8d0f-4d7e-9ac2-3b91f8d8fcb2</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;@jerly: No, it&amp;#39;s from SDK v5.2 not SDKv6.0. As I mentioned it&amp;#39;s too old.&lt;/p&gt;
&lt;p&gt;Please let me now what&amp;#39;s the issue you had with SDK v8.0 ? Also which chip revision are you using ? Please read the laser mark on top of the chip to find the chip revision.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: spi problem</title><link>https://devzone.nordicsemi.com/thread/29806?ContentTypeID=1</link><pubDate>Thu, 23 Jul 2015 01:20:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b7fafe02-f250-4630-8ec9-fd4d86d573ee</guid><dc:creator>jerly</dc:creator><description>&lt;p&gt;Hi Hung Bui:
yes. it is from sdk6.0.but i have used spi from sdk8.0,and the code run away when CS was pulled up.so i revised sdk6.0&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: spi problem</title><link>https://devzone.nordicsemi.com/thread/29810?ContentTypeID=1</link><pubDate>Tue, 21 Jul 2015 15:22:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:64d69c13-30e3-4c75-ba78-cb6ae63bc747</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;@jerly: Are you sure you are testing with SDK 8.0 and the code is from the file spi_master.c in \components\drivers_nrf\spi_master ? I can&amp;#39;t find the same code in my SDK 8.0.&lt;/p&gt;
&lt;p&gt;The code looks like it&amp;#39;s from SDK v5.2.0 which is very old and should not be used with S110 v8.0
I attached the spi_master.c in SDK 8.0 in my answer for your reference.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: spi problem</title><link>https://devzone.nordicsemi.com/thread/29805?ContentTypeID=1</link><pubDate>Tue, 21 Jul 2015 14:51:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:20038b64-2850-4276-88d1-5ecadaee0c82</guid><dc:creator>jerly</dc:creator><description>&lt;p&gt;Hi Hung Bui:
following the code:
bool spi_master_tx_rx(uint32_t *spi_base_address, uint32_t transfer_size, const uint8_t *tx_data, uint8_t *rx_data)
{
uint32_t counter = 0;
uint16_t number_of_txd_bytes = 0;
/*lint -e{826} //Are too small pointer conversion */
NRF_SPI_Type *spi_base = (NRF_SPI_Type *)spi_base_address;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;while(number_of_txd_bytes &amp;lt; transfer_size)
{
    spi_base-&amp;gt;TXD = (uint32_t)(tx_data[number_of_txd_bytes]);

    /* Wait for the transaction complete or timeout (about 10ms - 20 ms) */
    while ((spi_base-&amp;gt;EVENTS_READY == 0U) &amp;amp;&amp;amp; (counter &amp;lt; TIMEOUT_COUNTER))
    {
        counter++;
    }

    if (counter == TIMEOUT_COUNTER)
    {
        /* timed out, disable slave (slave select active low) and return with error */
        return false;
    }
    else
    {   /* clear the event to be ready to receive next messages */
        spi_base-&amp;gt;EVENTS_READY = 0U;
    }


    rx_data[number_of_txd_bytes] = (uint8_t)spi_base-&amp;gt;RXD;


    number_of_txd_bytes++;
};

/* disable slave (slave select active low) */

return true;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;}&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: spi problem</title><link>https://devzone.nordicsemi.com/thread/29804?ContentTypeID=1</link><pubDate>Tue, 21 Jul 2015 09:08:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:45ab02bd-247c-4601-9bf6-029b11f9976f</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;@jerly: I can&amp;#39;t find this code rx_data[number_of_txd_bytes]=(uint8_t)spi_base-&amp;gt;RXD in our spi_master.c in SDK v8.0. I dont think reading  spi_base-&amp;gt;RXD  would cause any trouble. Could you attach your code ?&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/spi_5F00_master.c"&gt;spi_master.c&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>