<?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>nRF52840 SPIM and Toshiba SPI Nand Flash</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/47349/nrf52840-spim-and-toshiba-spi-nand-flash</link><description>I am using Nordic SDK 15.3 and nRF52840 to interface to a NAND flash TC58CVG2S0HRAIG. I&amp;#39;m new with the SDK and I have little experience with the SPI / SPIM functions. I started with the SDK SPI example. I possibly also could have started with the SPIM</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 20 May 2019 07:44:23 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/47349/nrf52840-spim-and-toshiba-spi-nand-flash" /><item><title>RE: nRF52840 SPIM and Toshiba SPI Nand Flash</title><link>https://devzone.nordicsemi.com/thread/187784?ContentTypeID=1</link><pubDate>Mon, 20 May 2019 07:44:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5f47d389-5c3f-4111-beb8-a83d5d3a96b7</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user="rodims"]Would it be different if I use the SPI peripheral instead of the SPIM ?[/quote]
&lt;p&gt;The SPI peripheral does not support DMA, do you would have to process every byte in and out continuously in SW. If that is what you want (&amp;quot;looping around a 1 byte transfer&amp;quot;) then it might be simpler than using 1 byte transfers with the SPIM peripheral (it should not be a big difference though, as the driver anyway abstracts away any differences).&lt;/p&gt;
&lt;p&gt;Generally, SPI is just a standard way of transferring data, and any meaning you put into this data (for instance if it is command, status or just dummy data) is application specific and depend on the chip you communicate with (TC58CVG2S0HRAIG). Therefor you will not find explicit support for any of this in the nRF HW or driver, but you have to implement the protocol for the external flash chip yourself (as you are doing).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 SPIM and Toshiba SPI Nand Flash</title><link>https://devzone.nordicsemi.com/thread/187597?ContentTypeID=1</link><pubDate>Thu, 16 May 2019 20:16:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:250dae38-7a32-482e-b52a-93ac0affaa01</guid><dc:creator>rodims</dc:creator><description>&lt;p&gt;Well, I do not want explicitly control the &amp;quot;SPI clock&amp;quot;.&amp;nbsp;&amp;nbsp; I can imagine not to use the drivers support for the chip select&lt;/p&gt;
&lt;p&gt;spi_config.ss_pin&amp;nbsp;&amp;nbsp; = NRF_DRV_SPI_PIN_NOT_USED;&lt;/p&gt;
&lt;p&gt;and instead set the CS pin manually.&amp;nbsp; Thus I could &lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a) set Flash CS line active
b) send my command 0x0F, 0xB0,   (using nrf_drv_spi_transfer)
c)  do
       send dummy 0xff to receive one (status) byte  from the Nand Flash (using nrf_drv_spi_transfer)
     while ( status byte == busy)
d) set Flash CS  line inactive &lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;It does not make sense to setup a transfer to receive e.g. 128 status bytes, and afterwards find out, that after e.g. 42 status queries the Nand Flash already was no longer busy.&amp;nbsp; So the question only is, how can I optimize (speed) the looping around a 1 byte transfer.&amp;nbsp; I will try my above idea.&lt;/p&gt;
&lt;p&gt;Would it be different if I use the SPI peripheral instead of the SPIM ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 SPIM and Toshiba SPI Nand Flash</title><link>https://devzone.nordicsemi.com/thread/187519?ContentTypeID=1</link><pubDate>Thu, 16 May 2019 11:34:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7e268a38-89de-45fc-9ed6-c3c86f6c66c5</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;a) The SPIM peripheral does not allow you to control the clock separately. Rather, you have to set up transactions where data (dummy or not) is transferred in and out. That is regardless of whether you control it directly via registers or use the driver. I recommend you use the driver, as that simplifies and makes the code more readable. Moreover, it is properly tested, so you will probably both save time and achieve better quality compared to writing yourself. Regarding the chip select signal you can use a SW controlled GPIO pin that you handle yourself if you need to control it in a flexible way.&lt;/p&gt;
&lt;p&gt;b) No, not as far as I can see.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>