<?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 optimization</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/10330/spi-optimization</link><description>Hello
I want to optimize SPI com as fast I can do:
First I am using the fast spi data rate by SPI_FREQUENCY_FREQUENCY_M8 variable and I want to reduce at first the timing between the falling Chip Select edge and my first clock tick, and of course reduce</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 11 Dec 2015 14:13:09 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/10330/spi-optimization" /><item><title>RE: SPI optimization</title><link>https://devzone.nordicsemi.com/thread/38351?ContentTypeID=1</link><pubDate>Fri, 11 Dec 2015 14:13:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ae757b05-7c94-41ad-9036-4b5b83d4e241</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;It is good to hear that the driver made the difference ;)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI optimization</title><link>https://devzone.nordicsemi.com/thread/38350?ContentTypeID=1</link><pubDate>Thu, 10 Dec 2015 12:37:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ff67f473-785a-4d7e-9e4a-e67ca69a8acf</guid><dc:creator>Emil</dc:creator><description>&lt;p&gt;Thank you so much. The driver shipped with the SDK was simply not enough to do big multibyte reads on the ADXL362. With your fast SPI driver, it solved the problem!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI optimization</title><link>https://devzone.nordicsemi.com/thread/38348?ContentTypeID=1</link><pubDate>Thu, 26 Nov 2015 15:29:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1066bc1b-a914-4760-a556-216210dfade9</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;I am happy to help  :)&lt;/p&gt;
&lt;p&gt;Feel free to accept my answer if you are happy with the response.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI optimization</title><link>https://devzone.nordicsemi.com/thread/38349?ContentTypeID=1</link><pubDate>Wed, 25 Nov 2015 10:50:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a35a7ef5-db88-4feb-928e-cbbfeb98cde5</guid><dc:creator>valdev</dc:creator><description>&lt;p&gt;Many thanks for your help!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI optimization</title><link>https://devzone.nordicsemi.com/thread/38347?ContentTypeID=1</link><pubDate>Fri, 20 Nov 2015 14:41:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:85c864e3-edbf-4b47-9069-9e13f300da6b</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;The official driver is interrupt based, and this adds a bit of overhead to each byte transfer.
I wrote a polling based driver a while back, and it will be significantly quicker when running at higher bitrates:
&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/spi_5F00_master_5F00_fast.zip"&gt;spi_master_fast.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;As mentioned above the SPI master is only ratified up to 4MHz, and the reason for this is that we can not guarantee that the fall/rise times of the GPIO&amp;#39;s will be quick enough to support 8MHz operation under all circumstances. By using the SPI at 8MHz you risk getting a system that works fine on one board, but fails on another for instance.&lt;/p&gt;
&lt;p&gt;Under testing I find the library to give you a bitrate of approximately 4.2Mbps at 8MHz, and 3.5Mbps at 4MHz, so you are not gaining a lot of speed by using the 8MHz mode either.&lt;/p&gt;
&lt;p&gt;At 4MHz the driver runs at about 90% of the ideal bitrate, and at 2MHz or lower it runs at 100%.&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;
Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI optimization</title><link>https://devzone.nordicsemi.com/thread/38346?ContentTypeID=1</link><pubDate>Wed, 18 Nov 2015 15:09:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:19324cb4-59ab-423a-820a-bbb7095e8471</guid><dc:creator>valdev</dc:creator><description>&lt;p&gt;Thanks I gonna work on it!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI optimization</title><link>https://devzone.nordicsemi.com/thread/38345?ContentTypeID=1</link><pubDate>Wed, 18 Nov 2015 14:57:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:37563bd7-735f-4051-afbe-d2c16ae7b226</guid><dc:creator>EDJ</dc:creator><description>&lt;p&gt;Hello: there are NORDIC drivers that are good but somewhat heavy in their overhead. The drivers employ software FIFOs, critical sections, etc. If you are sending a small number of bytes, and can wait for the transfer to complete, then it can be much faster to assert chip select, write 2 bytes to the SPI data register (it is double buffered), wait for two bytes to come back, and repeat until your transfer is done;  then de-assert CS.  Do this with interrupts enabled so that RF processes and timers can continue to run.  You can still use the SPI driver init function, but disable ints from the SPI port after initializing, since you will be polling.&lt;/p&gt;
&lt;p&gt;Also, it helps to have a logic analyzer on the SPI port; you can infer from that where the SW delays reside.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI optimization</title><link>https://devzone.nordicsemi.com/thread/38344?ContentTypeID=1</link><pubDate>Wed, 18 Nov 2015 14:41:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ed4693e7-2b36-4195-9ccd-a5e6c9441f78</guid><dc:creator>Wojtek</dc:creator><description>&lt;p&gt;I cannot help you with the case you asked, but there is one thing about spi: according to newest product specification (i assume you are using nrf51822) the max frequency is 4M, NOT 8M (although it is defined in SDK). You shouldn&amp;#39;t go above 4mbps (i don&amp;#39;t know exact reason why it is like that...) Some info &lt;a href="https://devzone.nordicsemi.com/question/2990/spi-master-speed-of-nrf51822/"&gt;here.&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>