<?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>using ADC and SD Streaming</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/3552/using-adc-and-sd-streaming</link><description>Hi, 
 I&amp;#39;ve set up a streaming solution that is easily streaming 4+kBytes/s to an iPhone. I&amp;#39;ve also set up an ADC service that is sampling at 2,083 Hz 10 bit mode, using a PPI channel from timer2-&amp;gt;compare[0] event to ADC-&amp;gt;TASKS_START event. I&amp;#39;ve kept</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 22 Aug 2014 10:46:15 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/3552/using-adc-and-sd-streaming" /><item><title>RE: using ADC and SD Streaming</title><link>https://devzone.nordicsemi.com/thread/12871?ContentTypeID=1</link><pubDate>Fri, 22 Aug 2014 10:46:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4c3926d7-5e0d-45d8-b885-b0789fc4c741</guid><dc:creator>Stefan Birnir Sverrisson</dc:creator><description>&lt;p&gt;I have added to my former reply in order to answer your questions.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: using ADC and SD Streaming</title><link>https://devzone.nordicsemi.com/thread/12869?ContentTypeID=1</link><pubDate>Fri, 22 Aug 2014 10:45:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f761b9c2-5fd2-46c8-bc2a-5c3453b042ad</guid><dc:creator>Stefan Birnir Sverrisson</dc:creator><description>&lt;p&gt;The third revision hardware will be pin compatible with the current second revision. for your other question/questions, I recommend to create other thread/threads to make it easier for other users to find our questions and answers, see     &lt;a href="https://devzone.nordicsemi.com/blogs/5/how-should-i-use-comments/"&gt;devzone.nordicsemi.com/.../&lt;/a&gt;       &lt;a href="https://devzone.nordicsemi.com/blogs/7/how-should-i-ask-my-question/"&gt;devzone.nordicsemi.com/.../&lt;/a&gt;       &lt;a href="https://devzone.nordicsemi.com/blogs/6/how-do-i-know-where-i-should-ask-my-question/"&gt;devzone.nordicsemi.com/.../&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: using ADC and SD Streaming</title><link>https://devzone.nordicsemi.com/thread/12870?ContentTypeID=1</link><pubDate>Thu, 21 Aug 2014 16:49:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0e4d903c-f55c-419c-ab14-4586daa28b28</guid><dc:creator>Scott Buchanan</dc:creator><description>&lt;p&gt;A follow up question as well.&lt;/p&gt;
&lt;p&gt;Despite the warnings in the documentation I tried setting the priority to the ADC handling routine to _HIGH.  The ADC start task is tied to the timer2 cpm[0] through ppi channel 0 as shown below.  With this arrangement the BLE works fine but I&amp;#39;m still dropping the point during the transmission.&lt;/p&gt;
&lt;p&gt;My expectation would have been either to not drop points as the interrupt is HIGH or to have the BLE not work as it was interfering with the radio.&lt;/p&gt;
&lt;p&gt;I had thought the PPI channels and peripherals were independent of the CPU and therefore timer2 would trigger the ADC even during the radio usage AND given that the interrupt priority of the ADC was high the interrupt would get serviced resulting in one of the two above results.&lt;/p&gt;
&lt;p&gt;My question is why did neither of the two possible outcome occur?  It seems like the SD is suppressing PPI channel 0?  Is that correct?&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;void ars_audio_init() {
NRF_ADC-&amp;gt;INTENSET   = ADC_INTENSET_END_Msk;
NRF_ADC-&amp;gt;CONFIG =   (ADC_CONFIG_RES_10bit               &amp;lt;&amp;lt; ADC_CONFIG_RES_Pos)     |
                    (MICROPHONE_INPUT_PRESCALING        &amp;lt;&amp;lt; ADC_CONFIG_INPSEL_Pos)  |
                    (MICROPHONE_REFERENCE_PRESCALING    &amp;lt;&amp;lt; ADC_CONFIG_REFSEL_Pos)  |
                    (MICROPHONE_ANALOG_INPUT            &amp;lt;&amp;lt; ADC_CONFIG_PSEL_Pos)    |
                    (ADC_CONFIG_EXTREFSEL_None          &amp;lt;&amp;lt; ADC_CONFIG_EXTREFSEL_Pos);
NRF_ADC-&amp;gt;EVENTS_END = 0;
NRF_ADC-&amp;gt;ENABLE     = ADC_ENABLE_ENABLE_Enabled;

// Enable ADC interrupt
NVIC_ClearPendingIRQ(ADC_IRQn);
NVIC_SetPriority(ADC_IRQn, NRF_APP_PRIORITY_HIGH);
NVIC_EnableIRQ(ADC_IRQn);

//Setup the power control for the microphone

//Also set up microphone pin with high drive

NRF_GPIO-&amp;gt;PIN_CNF[MICROPHONE_POWER_PIN_NUMBER] = 0x301;  //output and high drive
nrf_gpio_pin_clear(MICROPHONE_POWER_PIN_NUMBER);

sd_ppi_channel_assign(0, &amp;amp;(NRF_TIMER2-&amp;gt;EVENTS_COMPARE[0]), &amp;amp;(NRF_ADC-&amp;gt;TASKS_START));
sd_ppi_channel_enable_clr(0x1);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;}&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: using ADC and SD Streaming</title><link>https://devzone.nordicsemi.com/thread/12868?ContentTypeID=1</link><pubDate>Thu, 21 Aug 2014 15:10:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a25a90e6-3177-45f9-9575-47f3064cf92b</guid><dc:creator>Scott Buchanan</dc:creator><description>&lt;p&gt;Stefan,&lt;/p&gt;
&lt;p&gt;Thanks.  That helps a lot.  Is there information available on the new hardware.  I can sign an NDA.&lt;/p&gt;
&lt;p&gt;Specifically, is it pin compatible with the current hardware so we could re-work our current prototypes?&lt;/p&gt;
&lt;p&gt;Also, how do I sent the number of packets/transmission?  I can&amp;#39;t find a reference for that.&lt;/p&gt;
&lt;p&gt;Thanks again&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: using ADC and SD Streaming</title><link>https://devzone.nordicsemi.com/thread/12867?ContentTypeID=1</link><pubDate>Thu, 21 Aug 2014 09:32:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9166bc52-65dc-4e14-9483-7ecc383b2e26</guid><dc:creator>Stefan Birnir Sverrisson</dc:creator><description>&lt;p&gt;Hi Scott&lt;/p&gt;
&lt;p&gt;Sampling rate of 2kHz with the ADC not possible with the current softdevice and the current hardware. The reasons behind that are discussed on &lt;a href="https://devzone.nordicsemi.com/question/1771/adc-softdevice-sample-rate-on-nrf51822/#reply-1791"&gt;this thread&lt;/a&gt;. However, it should be possible to sample with several kHz with the third revision nRF51 hardware that will be released in a few weeks.&lt;/p&gt;
&lt;p&gt;It does not help in this case to set the priority of the ADC interrupt to &amp;quot;Application High&amp;quot;, because the radio interrupts related to the BLE protocol still have higher priority. The BLE radio interrupts run with LowerStack priority, see figures 76 and 77 in the nRF51 Series Reference Manual v2.1.&lt;/p&gt;
&lt;p&gt;You are correct, by enabling PPI, you are independent of the CPU, but for the ADC sampling, you are using the PPI in one step and the CPU in another step. First, TIMER2 will start the ADC sampling, independent of the CPU, by triggering the ADC-&amp;gt;START task (NRF_ADC-&amp;gt;TASKS_START) and this is done via PPI channel. The ADC will use 68us to create the sample and then put the result in the ADC-&amp;gt;RESULT register. The ADC-&amp;gt;RESULT register only contains one sample, so you need the CPU to extract data from the ADC-&amp;gt;RESULT register before the ADC samples again (typically performed in the ADC interrupt handler), if you fail to do so, the data in the ADC-&amp;gt;RESULT register will be overridden. The CPU is blocked for ca 0.8-6.0 seconds by the S110 BLE softdevice because of BLE connection event. How long the CPU is blocked depends on the amount of data that are sent over the BLE link in each BLE connection event. This means that the CPU is not able to extract data from the ADC-&amp;gt;RESULT register when it is blocked by the softdevice.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>