<?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>Random SPI data shifting at ~72kB/s throughput</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/25959/random-spi-data-shifting-at-72kb-s-throughput</link><description>Hello, 
 I am using nRF52 with ADS1292, and i am trying to sample at 8kHz with data throughput of 72kB/s, but some data is being randomly shifted giving me random spikes. This occurs on all available clock speeds to some degree. I am using Easy DMA.</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 25 Jul 2018 10:28:59 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/25959/random-spi-data-shifting-at-72kb-s-throughput" /><item><title>RE: Random SPI data shifting at ~72kB/s throughput</title><link>https://devzone.nordicsemi.com/thread/141303?ContentTypeID=1</link><pubDate>Wed, 25 Jul 2018 10:28:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:250120b0-c976-41ec-a570-f50de36edbf7</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Sorry for the slow response. It is holiday season in Norway and a lot of the staff is out of office. Hence the response time might be slower than usual the next couple of weeks.&amp;nbsp;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Do you still have issue with the data being shifted?&lt;/li&gt;
&lt;li&gt;What SDK are you using?&lt;/li&gt;
&lt;li&gt;Is this only happening when you are using a Softdevice?&lt;/li&gt;
&lt;li&gt;Can you upload some code I can use to reproduce this?&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Random SPI data shifting at ~72kB/s throughput</title><link>https://devzone.nordicsemi.com/thread/140061?ContentTypeID=1</link><pubDate>Fri, 13 Jul 2018 12:10:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ed31a3fa-2b11-433e-8da4-914f7f9e7986</guid><dc:creator>Constantin</dc:creator><description>&lt;p&gt;Hi Martin,&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve just checked my code and tried with optimization off and on and both produce significant different results:&lt;/p&gt;
&lt;p&gt;1. Without optim there is a lot of jitter for 4 kHz (20 times a second) and the time between data ready interrupt and SPI CS goes to LOW is about 60 usec and jitters a lot.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/no_5F00_optim.png" /&gt;&lt;/p&gt;
&lt;p&gt;2. With optim1 there is much less jitter for the 4 kHz only once each 10 sec and the time between data ready interrupt and SPI CS goes to LOW is about 25 usec and jitters less.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/optim1s.png" /&gt;&lt;/p&gt;
&lt;p&gt;The data_ready handler looks like this:&lt;/p&gt;
&lt;p&gt;void drdy_handler(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;nrf_spi_mngr_schedule(&amp;amp;m_nrf_spi_mngr, &amp;amp;read_transaction);&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;So there is not much to optimize. The transaction is positioned in the RAM.&lt;/p&gt;
&lt;p&gt;Is there a way to stabilize the situation even more. Again increasing the SPI baudrate is not possible since the ADS1292 does only support higher rates with external clock which is not feasible for our PCB.&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Constantin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Random SPI data shifting at ~72kB/s throughput</title><link>https://devzone.nordicsemi.com/thread/136486?ContentTypeID=1</link><pubDate>Mon, 18 Jun 2018 07:52:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d78de764-8faa-4374-9c6e-1e11601412ad</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;&lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/ppi.html?cp=2_1_0_21#concept_sxf_21l_1s"&gt;PPI&lt;/a&gt; is perfect for this. You can prepare the SPI in advance and then use &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/gpiote.html?cp=2_1_0_20#concept_knz_kww_lr"&gt;GPIOTE&lt;/a&gt;&amp;nbsp;to start an SPI transfer on a DRDY signal from your slave. The SPI can then transfer one or more data sets directly to RAM using EasyDMA and finally, you can process the data on e.g. a SPI END event.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Random SPI data shifting at ~72kB/s throughput</title><link>https://devzone.nordicsemi.com/thread/136300?ContentTypeID=1</link><pubDate>Fri, 15 Jun 2018 08:55:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ba99f850-983a-4699-ad1b-d46acf328cd5</guid><dc:creator>Constantin</dc:creator><description>&lt;p&gt;I face the same issue that at higher sample rate the SPI communication is somehow shifted. My guess is that between the Interrupt from the DRDY pin is not directly executed with Softdevice enabled. Due to this issue the data inside the shift register at the ADS is already shifted one byte further sometimes and therefore read out erronous. Is there somehow a way to enable SPI communication without delay or directly by the DMA controller, like in the example here&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/Martinsbl/nrf5-mpu-examples/tree/master/nrf52-mpu-easydma-using-gpiote-and-registers"&gt;https://github.com/Martinsbl/nrf5-mpu-examples/tree/master/nrf52-mpu-easydma-using-gpiote-and-registers&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Random SPI data shifting at ~72kB/s throughput</title><link>https://devzone.nordicsemi.com/thread/102268?ContentTypeID=1</link><pubDate>Mon, 23 Oct 2017 08:21:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8e5bae8b-f956-49c7-be1a-0764b94d1b5c</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;What kind of SPI clock frequency do you use? If I read the datasheet correctly maximum frequency is ~2MHz. If you go faster I suppose it is possible to get garbage bad data.&lt;/p&gt;
&lt;p&gt;I think the input capacitance on the ADS1292 at 20pF is also relatively high. It might be worth a shot to configure the SPI pins in high drive to be able to source more current. You can do it by writing this &lt;em&gt;after&lt;/em&gt; you call nrf_drv_spi_init():&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;nrf_gpio_cfg(p_config-&amp;gt;sck_pin,
             NRF_GPIO_PIN_DIR_OUTPUT,
             NRF_GPIO_PIN_INPUT_CONNECT,
             NRF_GPIO_PIN_NOPULL,
             NRF_GPIO_PIN_H0H1,
             NRF_GPIO_PIN_NOSENSE);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If it still doesn&amp;#39;t work, I think it could be interesting to see your code and PCB layout. You can upload it in confidence on our official support portal, &lt;a href="https://www.nordicsemi.com/eng/nordic/mypage"&gt;MyPage&lt;/a&gt; if you prefer.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Random SPI data shifting at ~72kB/s throughput</title><link>https://devzone.nordicsemi.com/thread/102267?ContentTypeID=1</link><pubDate>Fri, 20 Oct 2017 19:55:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:97c96229-4ddb-45b8-b264-bc43571c221d</guid><dc:creator>Musa</dc:creator><description>&lt;p&gt;I&amp;#39;ll see if my department has an available logic analyzer. I think the problem improves slightly with less resource usage but the issue is still there. I do have EasyDMA enabled. Do you think it would help for me to share the code i am using?
The ADS1292 can generate a 1-Hz test signal so that a predictable output can be observed. I also tried shorting the inputs, for a ~0V measurement.&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Random SPI data shifting at ~72kB/s throughput</title><link>https://devzone.nordicsemi.com/thread/102271?ContentTypeID=1</link><pubDate>Thu, 19 Oct 2017 12:56:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4bc1ff56-79fc-4077-be08-213905226e7d</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;I think some measurements of the bus with an oscilloscope or logic analyzer could be very valuable.&lt;/p&gt;
&lt;p&gt;Does it occur if you disable all other resources and do nothing, but transfer data with SPI?&lt;/p&gt;
&lt;p&gt;How do you use the SPI? Are you using EasyDMA?&lt;/p&gt;
&lt;p&gt;What do you mean by &amp;quot; internally generated 1-Hz square wave&amp;quot; by the way?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Random SPI data shifting at ~72kB/s throughput</title><link>https://devzone.nordicsemi.com/thread/102270?ContentTypeID=1</link><pubDate>Wed, 18 Oct 2017 17:59:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9c929640-6cb7-4914-8f3c-13631af84fb4</guid><dc:creator>Musa</dc:creator><description>&lt;p&gt;Hello,
I don&amp;#39;t think wiring or ground is an issue. I am working with a PCB design that we have used for some time, with good results at lower sampling rate (lower throughput). It looks like not all transfers are completed correctly. Many times data are replaced with zeros, and other times it is just garbage data. I cannot pin down exactly what the issue is.&lt;/p&gt;
&lt;p&gt;Is there anything I should try to get more information?&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Random SPI data shifting at ~72kB/s throughput</title><link>https://devzone.nordicsemi.com/thread/102266?ContentTypeID=1</link><pubDate>Tue, 17 Oct 2017 07:02:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:beb4071a-23ce-43c2-bef2-e28622c1650d</guid><dc:creator>MartinBL</dc:creator><description>&lt;ol&gt;
&lt;li&gt;So in other words, you don&amp;#39;t know if it shifts a certain number of bytes either to the left or right? It could be shifted e.g. just one bit both ways?&lt;/li&gt;
&lt;li&gt;Is it possible that it is because of bad wiring? Have you remembered to connect both devices to common ground? With bad wires or grounding you can pick up noise that registers as bits. It would also behave quite random.&lt;/li&gt;
&lt;/ol&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Random SPI data shifting at ~72kB/s throughput</title><link>https://devzone.nordicsemi.com/thread/102269?ContentTypeID=1</link><pubDate>Mon, 16 Oct 2017 22:22:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:427a00d1-9470-4a69-91a1-357fffe88c56</guid><dc:creator>Musa</dc:creator><description>&lt;p&gt;Sorry about the lack of complete info:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;It is seemingly random; and does not happen on every transfer. I cannot find a consistent pattern or direction. In some cases part of the data is intact, and the rest is garbled or missing.
Since I don&amp;#39;t have the correct debugging tools at my disposal (logic analyzer), I am using the internally generated 1-Hz square wave.
&lt;a href="https://www.dropbox.com/s/gm8qy44o7hwomwp/bad_data_2017-10-16_18-16-55.png?dl=0"&gt;plot of bad data&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Using SDK 13.1.0&lt;/li&gt;
&lt;li&gt;I tried both non-blocking and blocking modes, giving same result.&lt;/li&gt;
&lt;li&gt;SPI drivers did not report any errors. All transfers returned NRF_SUCCESS. The first few BLE transfers return NRF_ERROR_RESOURCES, but eventually goes away.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Let me know if there is any other information I can provide that will help.&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Random SPI data shifting at ~72kB/s throughput</title><link>https://devzone.nordicsemi.com/thread/102272?ContentTypeID=1</link><pubDate>Mon, 16 Oct 2017 12:14:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b9995088-9334-4335-a434-99fe478b0e47</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Shifted how much and which way?&lt;/li&gt;
&lt;li&gt;What SDK are you using?&lt;/li&gt;
&lt;li&gt;Since you use Easy DMA I assume that you have not configured the SPI driver in &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v14.0.0/group__nrf__drv__spi.html#gab022e003c9e5f0f946a5ecff0b455405"&gt;non-blocking mode&lt;/a&gt;? That should make it less dangerous to call it too often, but you should wait and check the status of the transfer in the event callback anyway.&lt;/li&gt;
&lt;li&gt;Have you checked the return codes from the SPI driver function calls for errors &lt;a href="https://devzone.nordicsemi.com/question/40413/debugging-nrf51422-how-can-i-use-err_code-to-debug-my-nrf51422/"&gt;like this&lt;/a&gt;?&lt;/li&gt;
&lt;/ol&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>