<?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 readings are shifted, inconsistent (nRF Master, FPGA Slave)</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/15028/spi-readings-are-shifted-inconsistent-nrf-master-fpga-slave</link><description>I&amp;#39;ll try to simplify my project as much as possible to make this understandable.
I&amp;#39;m wiring an nRF52 PCA10040 board to an iCE5LP (Lattice) FPGA. 
 I&amp;#39;m having an issue with the bytes coming in to the MCU (MISO line), here&amp;#39;s the course of action: 
 </description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 21 Mar 2017 17:39:54 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/15028/spi-readings-are-shifted-inconsistent-nrf-master-fpga-slave" /><item><title>RE: SPI readings are shifted, inconsistent (nRF Master, FPGA Slave)</title><link>https://devzone.nordicsemi.com/thread/57339?ContentTypeID=1</link><pubDate>Tue, 21 Mar 2017 17:39:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ecc560ee-a95d-40ea-b10f-c41efc17d005</guid><dc:creator>User1321</dc:creator><description>&lt;p&gt;Is there any solution to this issue that it is not just simply decreasing the SPI speed?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI readings are shifted, inconsistent (nRF Master, FPGA Slave)</title><link>https://devzone.nordicsemi.com/thread/57338?ContentTypeID=1</link><pubDate>Fri, 08 Jul 2016 12:00:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ed951ce9-6863-4bf4-91dd-8f23f12c60a2</guid><dc:creator>RemySphere</dc:creator><description>&lt;p&gt;See &lt;a href="http://electronics.stackexchange.com/questions/244972/spi-readings-are-shifted-inconsistent-nrf-master-fpga-slave"&gt;here&lt;/a&gt; for the answer (credits to Mast)&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The difference between your
acquisition speed and data speed is
not enough. Increasing the speed of
the FPGA or decreasing the speed of
the SPI does fix the alignment
problem.&lt;/p&gt;
&lt;p&gt;Your SPI clock and FPGA clock are not
synchronized. This means your FPGA
clock needs to run at minimum twice as
fast as the SPI clock. However, since
SPI is an external signal, it may not
be entirely clean. There&amp;#39;s likely
jitter on your clock and/or data. A
factor of 2 as difference is simply
cutting it too close.&lt;/p&gt;
&lt;p&gt;You have a factor of 3. When in doubt
about the validity of your signals,
keep in mind that this is close to the
bare minimum. Increase the factor. As
you indicated, factor 12 works. Your
threshold is likely at 8 (12 / 8 = 1.5
MHz).&lt;/p&gt;
&lt;p&gt;Also, you most probably don&amp;#39;t need
such a high speed. Data integrity is
likely much more important. Build it
safe first, worry about speed
optimization later.&lt;/p&gt;
&lt;/blockquote&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI readings are shifted, inconsistent (nRF Master, FPGA Slave)</title><link>https://devzone.nordicsemi.com/thread/57337?ContentTypeID=1</link><pubDate>Fri, 08 Jul 2016 10:00:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ef64d439-57d2-4811-9ace-aca9932fad52</guid><dc:creator>RemySphere</dc:creator><description>&lt;p&gt;The code formatting is acting weird... don&amp;#39;t mind the &lt;pre&gt;, if I take it off it fails to format everything somehow&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>