<?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>NRF52 SPI CS Not working after wakeup</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/19972/nrf52-spi-cs-not-working-after-wakeup</link><description>We have used a logic analyser to verify this. 
 SPI initialised and talks nicely with an ADXL362 accelerometer part. 
 We have interrupts configured. 
 We go into sd_power_system_off() 
 Move board, interrupt fires, system wakes up (as no RAM retention</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sun, 26 Feb 2017 23:52:44 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/19972/nrf52-spi-cs-not-working-after-wakeup" /><item><title>RE: NRF52 SPI CS Not working after wakeup</title><link>https://devzone.nordicsemi.com/thread/77713?ContentTypeID=1</link><pubDate>Sun, 26 Feb 2017 23:52:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7a95181e-96fd-467f-b37d-acb3c20cf22e</guid><dc:creator>Marco</dc:creator><description>&lt;p&gt;We found the bug. We were using GPIO pin 12 for both a SPI and a TWI interface. The same initialisation procedure was performed both before and after System OFF. The only difference was in the order in which the interfaces were initialised: before System OFF the SPI was initialised first, after System OFF the TWI was first. By swapping the initialisation order, we set what interface is actually controlling (having priority over) the GPIO pins.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52 SPI CS Not working after wakeup</title><link>https://devzone.nordicsemi.com/thread/77712?ContentTypeID=1</link><pubDate>Sat, 25 Feb 2017 04:51:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:07aad236-26fc-4d43-8728-feccf78fff67</guid><dc:creator>Chris</dc:creator><description>&lt;p&gt;Hi Ole, we will produce this when we get back to the office. I had thought the same thing when I went home :-)&lt;/p&gt;
&lt;p&gt;It won&amp;#39;t take long to whip up the code so you can run it on the DK and we can confirm that we&amp;#39;re also seeing it without too much else in the way. Otherwise we&amp;#39;ll start cutting out code/re-introducing until the error show&amp;#39;s it self.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52 SPI CS Not working after wakeup</title><link>https://devzone.nordicsemi.com/thread/77711?ContentTypeID=1</link><pubDate>Fri, 24 Feb 2017 16:49:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:67ee147c-04d7-4b87-9d89-25e8023dce91</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;Do you have a stripped down version of the code that will reproduce the problem on a nrf52 DK (PCA10040)?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52 SPI CS Not working after wakeup</title><link>https://devzone.nordicsemi.com/thread/77710?ContentTypeID=1</link><pubDate>Fri, 24 Feb 2017 10:28:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cade57a2-58c6-40e0-9345-c4024f6f97df</guid><dc:creator>Marco</dc:creator><description>&lt;p&gt;I add some details in support to Chris. We had to run some tests on PCA10040 because it is easier to debug. When we try to read (command 11) the PARTID (register 2) or any other register from the ADXL263 on our device, we always get value 0x0.&lt;/p&gt;
&lt;p&gt;I am providing here few screenshots of some tests run on PCA10040 (without SX9300). Channel 0 to 3 are the SPI lines (Clock, SDI, SDO, Enable).&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/SPI-Works-Fine-Before-System-OFF.png" alt="image description" /&gt;&lt;/p&gt;
&lt;p&gt;In this first case everything works fine. Then we go into System OFF. Once we come back to System ON (triggering a GPIO pin) we perform the same SPI initialisation and try to read the same register. And this is what happens:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/After-System-OFF.png" alt="image description" /&gt;&lt;/p&gt;
&lt;p&gt;SPI is Enabled way before the actual read. Once the read is performed SPI Enable is deasserted. Those 2 spikes (Clock and SDI) correspond to the zoomed signals in the first picture.&lt;/p&gt;
&lt;p&gt;For additional testing we have then modified file &amp;quot;nrf_drv_spi.c&amp;quot;. Every time GPIO pin &amp;quot;p_cb-&amp;gt;ss_pin&amp;quot; is set/clear we do set/clear the output GPIO pin 20. And this is what we get (before and after System OFF):&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/Good-before-System-OFF-with-LED-tracking.png" alt="image description" /&gt;&lt;/p&gt;
&lt;p&gt;Before moving into System OFF pin 20 tracks properly SPI Enable signal.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/After-System-OFF-with-LED-Tracking.png" alt="image description" /&gt;&lt;/p&gt;
&lt;p&gt;And this is what happens after System OFF.&lt;/p&gt;
&lt;p&gt;UPDATE&lt;/p&gt;
&lt;p&gt;We have been running few tests.
We made a stripped down version of our code simply performing a SPI read and going into System OFF waiting for an interrupt on a GPIO line. And it works.
Then we tried our original code by just changing the GPIO pin assigned to SPI Enable signal (from GPIO 12 to GPIO 17) and it works as well (tested on PCA10040, no sensor actually connected to selected SPI GPIO lines): SPI Enable is going low allowing SPI transactions after coming out of System OFF (see following 2 screenshots).&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/Screen-Shot-2017_2D00_02_2D00_27-at-10.55.16-AM.png" alt="image description" /&gt;&lt;/p&gt;
&lt;p&gt;Channel 7 (GPIO 20) is still tracking SPI Enable (GPIO 17). And we still get the initial weird behaviour (GPIO 20 does not follow SPI Enable rising edge). But then we can actually complete the following SPI Read operation.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/Screen-Shot-2017_2D00_02_2D00_27-at-10.56.24-AM.png" alt="image description" /&gt;&lt;/p&gt;
&lt;p&gt;And this is the zoomed view of the SPI transaction.&lt;/p&gt;
&lt;p&gt;In our code GPIO 12 is only used for SPI Enable signal. And in case of mistaken multiple usage of it, I would expect an error to be reported back. But all APP_ERROR_CHECK() are successful.
We will now proceed analysing our code in order to track down where and what the error is.
Do you have any information about known bugs that might cause such wrong behaviour? It looks like something else is driving GPIO 12. While GPIO 17 is fine.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>