<?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>SPIS data corrupted?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/51810/spis-data-corrupted</link><description>Hello, working on an incredibly frustrating problem. 
 We have a 2-chip system and the primary chip (non-nrf) communicates with the nrf52840 as a SPI master, and of course the nrf chip is configured as a SPI slave (SPIS). We had an issue with the cryptocell</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 06 Sep 2019 17:02:54 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/51810/spis-data-corrupted" /><item><title>RE: SPIS data corrupted?</title><link>https://devzone.nordicsemi.com/thread/208523?ContentTypeID=1</link><pubDate>Fri, 06 Sep 2019 17:02:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:23e19034-4340-4809-be13-84ada6f93633</guid><dc:creator>JeanMBoones</dc:creator><description>&lt;p&gt;Yup, I think this is the problem.&amp;nbsp; Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPIS data corrupted?</title><link>https://devzone.nordicsemi.com/thread/208522?ContentTypeID=1</link><pubDate>Fri, 06 Sep 2019 17:02:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bcf91164-65e0-4af2-853d-a16ec3d1cf9d</guid><dc:creator>JeanMBoones</dc:creator><description>&lt;p&gt;Yep, I think thats it.&amp;nbsp; I played around with longer delays on CSN and it resolved the issue.&amp;nbsp; Unfortunately our SPI peripheral isnt terribly flexible.&amp;nbsp; We will need to find a way to make it longer.&amp;nbsp; Thanks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPIS data corrupted?</title><link>https://devzone.nordicsemi.com/thread/208486?ContentTypeID=1</link><pubDate>Fri, 06 Sep 2019 13:47:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0f472313-a643-4c87-b319-76ca1b8b90c2</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The issue is probably caused by a too short delay between CSN is asserted and the first bit is clocked out on the bus. I see from your plot that it is about 2&amp;nbsp;μs, and so within that time you must fit the latency of the SPIS peripheral itself (~1&amp;nbsp;μs) and the startup time of the HF clock (~3&amp;nbsp;μs), and that does not work. So the solution here is to adjust the implementation on the SPI master device, increasing the time between the CSN is asserted and the start of the transaction.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPIS data corrupted?</title><link>https://devzone.nordicsemi.com/thread/208355?ContentTypeID=1</link><pubDate>Thu, 05 Sep 2019 23:33:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e581962b-7c51-4466-92b0-928f06dcd632</guid><dc:creator>wpaul</dc:creator><description>[quote userid="25970" url="~/f/nordic-q-a/51810/spis-data-corrupted"]We had an issue with the cryptocell where an interrupt flag was keeping the nrf chip from really sleeping.[/quote]
&lt;p&gt;Let me guess. Was it the floating point interrupt?&lt;/p&gt;
[quote userid="25970" url="~/f/nordic-q-a/51810/spis-data-corrupted"]The additional weirdness is that if the debugger is attached (isystems), everything works fine.&amp;nbsp; If I remove the debugger, the issue shows up.[/quote]
&lt;p&gt;When the debugger is connected, it prevents the CPU from going into low power sleep mode. I&amp;#39;m pretty sure this is because the CPU would no longer respond to the debugger otherwise.&lt;/p&gt;
&lt;p&gt;It can take the CPU a certain amount of time to come out of sleep mode and resume executing. For example any PLL clock circuits are powered down, you need to wait a certain amount of time for them to achieve lock when they power up again.&lt;/p&gt;
&lt;p&gt;My question to you was going to be &amp;quot;what exactly are you doing to trigger a wakeup on the slave&amp;quot; but it sounds like the answer is asserting the chip select line (CSN).&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t think you can eliminate or shorten the wake-up time of the slave. That means you need to take some action on the master side. After you assert the CSN pin on the master, add a delay to give the nRF52840 to wake up. _Then_ start the SPI transfer.&lt;/p&gt;
&lt;p&gt;-Bill&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPIS data corrupted?</title><link>https://devzone.nordicsemi.com/thread/208318?ContentTypeID=1</link><pubDate>Thu, 05 Sep 2019 17:20:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6282a283-e1c9-48b2-9596-e2a4d54bfe6d</guid><dc:creator>JeanMBoones</dc:creator><description>&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/bad.tif"&gt;devzone.nordicsemi.com/.../bad.tif&lt;/a&gt;&amp;nbsp; &amp;nbsp; &lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/good.tif"&gt;devzone.nordicsemi.com/.../good.tif&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Here are some scope images, it almost looks like in the bad.tif condition, the nrf chip waits 8 clocks before sending out the data.&amp;nbsp; Almost as if the SPI was not recognizing the CSN line until it was too late.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>