<?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>strange behaviour of spi handler</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/16472/strange-behaviour-of-spi-handler</link><description>Hi, 
 I&amp;#39;m using the SDK11 and SD130 on a custom board which has a nrf51822.
I connected via SPI to a DSP that sends and receive audio.
My handler of the SPI is as it follows 
 /**********************************
 * @brief SPI user event handler </description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 26 Sep 2016 10:52:20 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/16472/strange-behaviour-of-spi-handler" /><item><title>RE: strange behaviour of spi handler</title><link>https://devzone.nordicsemi.com/thread/63060?ContentTypeID=1</link><pubDate>Mon, 26 Sep 2016 10:52:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b87f9dcf-175f-40ca-88f3-aabe9bc18c7d</guid><dc:creator>Jorge</dc:creator><description>&lt;p&gt;It was a timing issue. The toggle of the &lt;code&gt;WAKEUP_PIN&lt;/code&gt; was to update the sampling rate on the DSP, but it was wrongly configured there. And so only with the &amp;quot;delay&amp;quot; of the prints the sampling rate on both sides would match.&lt;/p&gt;
&lt;p&gt;Now with that fixed I can delete the prints and the sound has good quality!
Thank you all for the help&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: strange behaviour of spi handler</title><link>https://devzone.nordicsemi.com/thread/63059?ContentTypeID=1</link><pubDate>Mon, 19 Sep 2016 10:42:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6f3c5ba5-6dd2-4295-bfb7-6f61eb4e110b</guid><dc:creator>butch</dc:creator><description>&lt;p&gt;I am suggesting that the printf could be writing beyond its buffer (buffer overrun.)  If you think it is timing related, substitute a delay for the printf.   Also, your while loop could be a buffer overrun.  Inside the loop you increment spi_counter without checking that it is less than the end of the buffer?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: strange behaviour of spi handler</title><link>https://devzone.nordicsemi.com/thread/63057?ContentTypeID=1</link><pubDate>Mon, 19 Sep 2016 08:35:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:39db60d7-3722-4825-9593-d0881b6eb918</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;I agree there seems to be some timing related issue here- Try to change the priority of the spi_event_handler APP_IRQ_PRIORITY_HIGH and see if it improves.&lt;/p&gt;
&lt;p&gt;This is defined in &lt;code&gt;nrf_drv_spi_config_t&lt;/code&gt; and used in &lt;code&gt;nrf_drv_spi_init&lt;/code&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: strange behaviour of spi handler</title><link>https://devzone.nordicsemi.com/thread/63056?ContentTypeID=1</link><pubDate>Mon, 19 Sep 2016 07:31:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b1f03f62-50e4-4d62-b135-c51f69d26283</guid><dc:creator>Jorge</dc:creator><description>&lt;p&gt;Hi butch,&lt;/p&gt;
&lt;p&gt;the printf() are there because they were on the example and it seems that this only works when they are there. I&amp;#39;m not even printing this to anyplace.
Regarding the memset and memcpy, I need this because in the end of my project I&amp;#39;m going to take out the memcpy, he is only here for debug purposes.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: strange behaviour of spi handler</title><link>https://devzone.nordicsemi.com/thread/63058?ContentTypeID=1</link><pubDate>Sat, 17 Sep 2016 10:59:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:24c19569-691e-4940-b590-7c5662cd0417</guid><dc:creator>butch</dc:creator><description>&lt;p&gt;I agree it probably is timing related, but I don&amp;#39;t have any experience.  I do have other ideas:  you are treating the buf as a null-terminated string in the call to printf(), is it really null-terminated?  Also, you don&amp;#39;t need the memset(0) since right after that you memcpy over the zeros?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>