<?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>the sampling rate of measurements using nrf 51822</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/49729/the-sampling-rate-of-measurements-using-nrf-51822</link><description>I am using nrf51822 chips and UART to communicate with my cellphone. I want to know if there are any ways to improve the sampling rate (reading and transmission) of measurement. I am doing the EEG stuff, so more date transitted is favorable. Thanks!</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 25 Jul 2019 15:43:45 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/49729/the-sampling-rate-of-measurements-using-nrf-51822" /><item><title>RE: the sampling rate of measurements using nrf 51822</title><link>https://devzone.nordicsemi.com/thread/200593?ContentTypeID=1</link><pubDate>Thu, 25 Jul 2019 15:43:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d52ecdb8-4053-4aca-af6e-69bedae4130c</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;This is not enough to help you with throughput. The throughput depends on the BLE configuration, which you have not included in above code. To be able to help you, I would need the entire project (including main/sdk_config.h/IDE project files).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: the sampling rate of measurements using nrf 51822</title><link>https://devzone.nordicsemi.com/thread/200144?ContentTypeID=1</link><pubDate>Tue, 23 Jul 2019 15:45:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:03a6b4b9-5be4-44e2-bbd2-56f47b4446de</guid><dc:creator>Fletchable</dc:creator><description>&lt;p&gt;Hi Jorgen, I attached my code here. I use two channels: one for temperature and the other for ECG.&amp;nbsp; Please help to take a look!&lt;pre class="ui-code" data-mode="text"&gt;void adc_1()
{
    // interrupt ADC
    NRF_ADC-&amp;gt;INTENSET = (ADC_INTENSET_END_Disabled &amp;lt;&amp;lt;
    ADC_INTENSET_END_Pos);                        /*!&amp;lt; Interrupt enabled. */

       // config ADC
       NRF_ADC-&amp;gt;CONFIG = (ADC_CONFIG_EXTREFSEL_None &amp;lt;&amp;lt; ADC_CONFIG_EXTREFSEL_Pos) /* Bits 17..16 :
       ADC external reference pin selection. */
                                           | (ADC_CONFIG_PSEL_AnalogInput2 &amp;lt;&amp;lt;
                                           ADC_CONFIG_PSEL_Pos)                 /*!&amp;lt; Use analog
                                           input 0 as analog input. */
                                           | (ADC_CONFIG_REFSEL_VBG &amp;lt;&amp;lt;
                                           ADC_CONFIG_REFSEL_Pos)                          /*!&amp;lt;
                                           Use internal 1.2V bandgap voltage as reference for
                                           conversion. */
                                           | (ADC_CONFIG_INPSEL_AnalogInputOneThirdPrescaling &amp;lt;&amp;lt;
                                           ADC_CONFIG_INPSEL_Pos) /*!&amp;lt; Analog input specified by
                                           PSEL with no prescaling used as input for the
                                           conversion. */
                                           | (ADC_CONFIG_RES_10bit &amp;lt;&amp;lt;
                                           ADC_CONFIG_RES_Pos);
                                           /*!&amp;lt; 10bit ADC resolution. */

       // enable ADC
       NRF_ADC-&amp;gt;ENABLE =
       ADC_ENABLE_ENABLE_Enabled;
               /* Bit 0 : ADC enable. */

       // start ADC conversion
       NRF_ADC-&amp;gt;TASKS_START = 1;

       // wait for conversion to end
       while (!NRF_ADC-&amp;gt;EVENTS_END)
       {}
       NRF_ADC-&amp;gt;EVENTS_END = 0;

     //Save your ADC result
     adc_result = NRF_ADC-&amp;gt;RESULT;
     tempvalue=-1481.96+sqrt(2196200+(1.8639-adc_result*3.3/1023)/0.00000388);
     //Use the STOP task to save current. Workaround for PAN_028 rev1.1 anomaly 1.
   NRF_ADC-&amp;gt;TASKS_STOP = 1;
}
void adc_2()
{
    // interrupt ADC
       NRF_ADC-&amp;gt;INTENSET = (ADC_INTENSET_END_Disabled &amp;lt;&amp;lt;
       ADC_INTENSET_END_Pos);                        /*!&amp;lt; Interrupt enabled. */

       // config ADC
       NRF_ADC-&amp;gt;CONFIG = (ADC_CONFIG_EXTREFSEL_None &amp;lt;&amp;lt; ADC_CONFIG_EXTREFSEL_Pos) /* Bits 17..16 :
       ADC external reference pin selection. */
                                           | (ADC_CONFIG_PSEL_AnalogInput4 &amp;lt;&amp;lt;
                                           ADC_CONFIG_PSEL_Pos)                 /*!&amp;lt; Use analog
                                           input 0 as analog input. */
                                           | (ADC_CONFIG_REFSEL_VBG &amp;lt;&amp;lt;
                                           ADC_CONFIG_REFSEL_Pos)                          /*!&amp;lt;
                                           Use internal 1.2V bandgap voltage as reference for
                                           conversion. */
                                           | (ADC_CONFIG_INPSEL_AnalogInputOneThirdPrescaling &amp;lt;&amp;lt;
                                           ADC_CONFIG_INPSEL_Pos) /*!&amp;lt; Analog input specified by
                                           PSEL with no prescaling used as input for the
                                           conversion. */
                                           | (ADC_CONFIG_RES_10bit &amp;lt;&amp;lt;
                                           ADC_CONFIG_RES_Pos);
                                           /*!&amp;lt; 10bit ADC resolution. */

       // enable ADC
       NRF_ADC-&amp;gt;ENABLE =
       ADC_ENABLE_ENABLE_Enabled;
               /* Bit 0 : ADC enable. */

       // start ADC conversion
       NRF_ADC-&amp;gt;TASKS_START = 1;

       // wait for conversion to end
       while (!NRF_ADC-&amp;gt;EVENTS_END)
       {}
       NRF_ADC-&amp;gt;EVENTS_END = 0;

     //Save your ADC result
     adc_output = NRF_ADC-&amp;gt;RESULT;
     //Use the STOP task to save current. Workaround for PAN_028 rev1.1 anomaly 1.
   NRF_ADC-&amp;gt;TASKS_STOP = 1;
}
/**@brief Application main function.
  */

int main(void)
{
    uint32_t err_code;
    bool erase_bonds;
    uint8_t start_string[] = START_STRING;

       // Initialize.
       APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, false);
       uart_init();
       buttons_leds_init(&amp;amp;erase_bonds);
       ble_stack_init();
       gap_params_init();
       services_init();
       advertising_init();

       conn_params_init();
       printf(&amp;quot;%s&amp;quot;,start_string);
           printf(&amp;quot;\n\rADC HAL simple example\r\n&amp;quot;);
       printf(&amp;quot;Current sample value:\r\n&amp;quot;);
       err_code = ble_advertising_start(BLE_ADV_MODE_FAST);
       APP_ERROR_CHECK(err_code);
              // Enter main loop.
           while(true)
       {
                       adc_1();
                       adc_2();
                    // trigger next ADC conversion
                    //nrf_adc_start();
              // enter into sleep mode
              __SEV();
              __WFE();
              __WFE();
                       uint8_t str[4];
                       sprintf((char*)str, &amp;quot;ADC:%d TEMP: %.2f&amp;quot;, (int)adc_result,(float)tempvalue);//
                       out ADC result
                       ble_nus_string_send(&amp;amp;m_nus, str, strlen((char*)str));
                    nrf_delay_ms(2000);
                       sprintf((char*)str, &amp;quot;ECG-ADC: %d&amp;quot;, (int)adc_output);
                       ble_nus_string_send(&amp;amp;m_nus, str, strlen((char*)str));
                    nrf_delay_ms(2000);
                       power_manage();
       }


}


/**
 * @}
 */&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: the sampling rate of measurements using nrf 51822</title><link>https://devzone.nordicsemi.com/thread/200040?ContentTypeID=1</link><pubDate>Tue, 23 Jul 2019 11:54:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7be6d78d-522e-4387-bf1e-36a29816e892</guid><dc:creator>Fletchable</dc:creator><description>&lt;p&gt;Got you. I will give it a try.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: the sampling rate of measurements using nrf 51822</title><link>https://devzone.nordicsemi.com/thread/200038?ContentTypeID=1</link><pubDate>Tue, 23 Jul 2019 11:50:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1effd342-85c6-4aed-b01c-363d07cb9a1f</guid><dc:creator>awneil</dc:creator><description>[quote userid="81603" url="~/f/nordic-q-a/49729/the-sampling-rate-of-measurements-using-nrf-51822/200036"]Do you mean that the dongle used with the computer has a better throughput[/quote]
&lt;p&gt;If you use the Nordic Dongle, the BLE code is running on the dongle itself - so it is not subject to any restrictions that the host OS might impose.&lt;/p&gt;
&lt;p&gt;The same would apply to using a Nordic Dev Kit .&lt;/p&gt;
&lt;p&gt;Or other custom board ...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: the sampling rate of measurements using nrf 51822</title><link>https://devzone.nordicsemi.com/thread/200036?ContentTypeID=1</link><pubDate>Tue, 23 Jul 2019 11:45:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:230a6fcf-d813-4ace-bac2-3ea240633367</guid><dc:creator>Fletchable</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Thanks for your suggestions. I will keep these in mind. Do you mean that the dongle used with the computer has a better throughput?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: the sampling rate of measurements using nrf 51822</title><link>https://devzone.nordicsemi.com/thread/199960?ContentTypeID=1</link><pubDate>Tue, 23 Jul 2019 08:59:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:27c9bfb4-b6ba-45ef-aee2-8378515cd75d</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;If you can post the project, I can try to help you. There are also many threads on DevZone related to the same question.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: the sampling rate of measurements using nrf 51822</title><link>https://devzone.nordicsemi.com/thread/199881?ContentTypeID=1</link><pubDate>Mon, 22 Jul 2019 18:21:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e15b7c4f-6a1f-4c6b-8e9a-bf963c7b3982</guid><dc:creator>Fletchable</dc:creator><description>&lt;p&gt;Hi Jorgen,&lt;/p&gt;
&lt;p&gt;Thanks for the good point. I guess you mean 1000/7.5*6=800. Could you provide some suggestions on how to modify the code? Appreciate it!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: the sampling rate of measurements using nrf 51822</title><link>https://devzone.nordicsemi.com/thread/199731?ContentTypeID=1</link><pubDate>Mon, 22 Jul 2019 10:32:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:35766247-3a00-41e3-a6ee-827e14a9a718</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;The question is whether it is the sample rate of the ADC that is the limitation, or if it is the BLE throughput. You will not be able to send 2k packets each second, you will have to buffer up multiple samples and send these at a lower interval. Remember that the minimum connection interval in BLE is 7.5 ms, and the phone may limit this even further. With bandwidth configuration of the connection set to HIGH (6 packets per connection interval), you could send up to 800 packets each second (given that the other side of the link support this).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: the sampling rate of measurements using nrf 51822</title><link>https://devzone.nordicsemi.com/thread/199718?ContentTypeID=1</link><pubDate>Mon, 22 Jul 2019 09:37:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eeea76ea-20ac-4a18-97ec-c4fcd6140540</guid><dc:creator>awneil</dc:creator><description>[quote userid="81603" url="~/f/nordic-q-a/49729/the-sampling-rate-of-measurements-using-nrf-51822/199621"]I am using an APP called &amp;quot;Bluefruit&amp;quot;[/quote]
&lt;p&gt;You mean this:&amp;nbsp;&lt;a href="https://learn.adafruit.com/bluefruit-le-connect/ios-setup"&gt;https://learn.adafruit.com/bluefruit-le-connect/ios-setup&lt;/a&gt;&amp;nbsp;?&lt;/p&gt;
&lt;p&gt;It&amp;#39;s always helpful to give a link, rather than expect people to just know or have to google for you.&lt;/p&gt;
&lt;p&gt;Especially as there may be many hits; eg,&amp;nbsp;&lt;a href="https://www.bluefruit.co.uk/"&gt;https://www.bluefruit.co.uk/&lt;/a&gt;&lt;/p&gt;
[quote userid="81603" url="~/f/nordic-q-a/49729/the-sampling-rate-of-measurements-using-nrf-51822/199621"]What is the issue?[/quote]
&lt;p&gt;You really need to ask Adafruit about that; it&amp;#39;s &lt;em&gt;their&lt;/em&gt; app - nothing to do with Nordic!&lt;/p&gt;
&lt;p&gt;But do note that phones often limit the available BLE throughput ...&lt;/p&gt;
[quote userid="81603" url="~/f/nordic-q-a/49729/the-sampling-rate-of-measurements-using-nrf-51822/199621"]Any other Apps to recommend[/quote]
&lt;p&gt;Have you looked at nRF Connect?&lt;/p&gt;
&lt;p&gt;&lt;a href="https://www.nordicsemi.com/Software-and-Tools/Development-Tools/nRF-Connect-for-desktop"&gt;www.nordicsemi.com/.../nRF-Connect-for-desktop&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://www.nordicsemi.com/Software-and-Tools/Development-Tools/nRF-Connect-for-mobile"&gt;https://www.nordicsemi.com/Software-and-Tools/Development-Tools/nRF-Connect-for-mobile&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: the sampling rate of measurements using nrf 51822</title><link>https://devzone.nordicsemi.com/thread/199621?ContentTypeID=1</link><pubDate>Sat, 20 Jul 2019 14:51:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0212fc8c-64b1-4195-8cc9-7e2e5296a059</guid><dc:creator>Fletchable</dc:creator><description>&lt;p&gt;Thanks for this useful information. I am using the softdevice and I think 2KHz is enough for my applications. I am using an APP called &amp;quot;Bluefruit&amp;quot; to receive data but found the data is far coarse than expected (less than 2KHz). What is the issue? Any other Apps to recommend?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: the sampling rate of measurements using nrf 51822</title><link>https://devzone.nordicsemi.com/thread/199612?ContentTypeID=1</link><pubDate>Fri, 19 Jul 2019 22:46:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:36d012d6-4639-435b-9759-e8db0207058b</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;The maximum sample rate of the ADC in nRF51 series is 50 kHz, but this is heavily limited by the BLE activity if a softdevice is enabled. See &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/8774/utilizing-multiple-adcs-on-one-channel-for-high-sample-rate/32173#32173"&gt;this post&lt;/a&gt; for more details.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: the sampling rate of measurements using nrf 51822</title><link>https://devzone.nordicsemi.com/thread/199604?ContentTypeID=1</link><pubDate>Fri, 19 Jul 2019 21:09:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:68f6ac27-3b26-471e-8792-b60526b346e0</guid><dc:creator>Fletchable</dc:creator><description>&lt;p&gt;The analog signal was input to nrf51822 ADC and then transmitted through Bluetooth. A cellphone was used as the terminal to receive data. I am wondering the maximal data the cellphone can receive per second. Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: the sampling rate of measurements using nrf 51822</title><link>https://devzone.nordicsemi.com/thread/199085?ContentTypeID=1</link><pubDate>Wed, 17 Jul 2019 20:20:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c6205925-8a5e-4db9-ac82-d7a784a7ca0e</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;I know what it means - but &lt;em&gt;which&lt;/em&gt; particular &amp;quot;sampling rate&amp;quot; are you referring to?&lt;/p&gt;
&lt;p&gt;the sampling &lt;em&gt;&lt;strong&gt;of&lt;/strong&gt; &lt;/em&gt;what and &lt;em&gt;&lt;strong&gt;by&lt;/strong&gt; &lt;/em&gt;what ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: the sampling rate of measurements using nrf 51822</title><link>https://devzone.nordicsemi.com/thread/199080?ContentTypeID=1</link><pubDate>Wed, 17 Jul 2019 19:07:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5d12ae08-35f1-4e1d-91fd-3d58121b784b</guid><dc:creator>Fletchable</dc:creator><description>&lt;p&gt;Hi, Sampling rate relates to how many data collected in one second. More data collected in one second is preferred in my application.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: the sampling rate of measurements using nrf 51822</title><link>https://devzone.nordicsemi.com/thread/198246?ContentTypeID=1</link><pubDate>Fri, 12 Jul 2019 19:57:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b0b1ae0c-24c6-4239-817b-1d1a252b2474</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;What &amp;quot;sampling rate&amp;quot; ?&lt;/p&gt;
&lt;p&gt;Whether anything can be &lt;em&gt;improved&lt;/em&gt; depends on where it&amp;#39;s currently at - and we have no idea about that!&lt;/p&gt;
&lt;p&gt;The nRF51822 &lt;strong&gt;Product Specification&lt;/strong&gt; will tell you the capabilities of the chip.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>