<?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>S110 Soft Device and Analog Inputs</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/2066/s110-soft-device-and-analog-inputs</link><description>I have an application that reads an nRF51822 pin configured as analog input and then sends that value using &amp;quot;ble uart&amp;quot; (included in Nordic&amp;#39;s sdk). Analog input is read in an interrupt 250 times per second, but only a few of those values are sent from</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 08 Apr 2014 10:48:50 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/2066/s110-soft-device-and-analog-inputs" /><item><title>RE: S110 Soft Device and Analog Inputs</title><link>https://devzone.nordicsemi.com/thread/8839?ContentTypeID=1</link><pubDate>Tue, 08 Apr 2014 10:48:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cf443a68-a4be-4c73-ac3d-4e02cbe7e656</guid><dc:creator>Jarmo</dc:creator><description>&lt;p&gt;Yes, logically thinking there must either be a higher priority interrupt running that clears the ADC END event, or the event doesn&amp;#39;t always work as it should.&lt;/p&gt;
&lt;p&gt;I switched to the solution you proposed, using ADC interrupt, and it seems to work. Thank you for helping!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: S110 Soft Device and Analog Inputs</title><link>https://devzone.nordicsemi.com/thread/8838?ContentTypeID=1</link><pubDate>Tue, 08 Apr 2014 10:24:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cc1d5849-9d3b-41f4-a1a3-2ca92a7f17e8</guid><dc:creator>Stefan Birnir Sverrisson</dc:creator><description>&lt;p&gt;Hi Jarmo&lt;/p&gt;
&lt;p&gt;I am not certain why this is failing actually. However, if you are getting stuck on that loop, it may be because the ADC END event flag is cleared somewhere else in your code.&lt;/p&gt;
&lt;p&gt;Make sure you explicitly set the interupt priority to LOW for the interrupt that you call this ADC handler from. You can see how to set interrupt priority low in the example I posted earlier on this thread, in the ADC init routine.&lt;/p&gt;
&lt;p&gt;I have implemented the example above in a non polling way, i.e. I start the ADC sampling with a timer and then handle the ADC result in the ADC interrupt handler. With that implementation I have not come across any problems. Perhaps you can consider that if the problem persists.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: S110 Soft Device and Analog Inputs</title><link>https://devzone.nordicsemi.com/thread/8837?ContentTypeID=1</link><pubDate>Tue, 08 Apr 2014 07:49:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:75cfd449-1dcc-4ae1-b362-2a827911ca55</guid><dc:creator>Jarmo</dc:creator><description>&lt;p&gt;Thanks for all replies! Now it looks like the problem with ADC might be here:&lt;/p&gt;
&lt;p&gt;uint32_t nrf_adc_read(void)
{
uint32_t adc_data;
NRF_ADC-&amp;gt;TASKS_START = 1;
while(NRF_ADC-&amp;gt;EVENTS_END == 0); // note the loop!
NRF_ADC-&amp;gt;EVENTS_END = 0;
adc_data = NRF_ADC-&amp;gt;RESULT;
return adc_data;
}&lt;/p&gt;
&lt;p&gt;I am using the above function from an interrupt running 250 times a second. At the same time there is S110 BLE connection (&amp;quot;UART&amp;quot; ) active and I am sending data over that. It is done in the main loop and not from interrupt, indeed. Also, the data is printed out using wired UART.&lt;/p&gt;
&lt;p&gt;The system works from ten seconds to several minutes before getting stuck. I have been debugging this issue now several days and finally found a modification that seems to solve the issue: when I comment away the while() -loop in the above function the stucking does not happen any more (at least it hasn&amp;#39;t been happening yet).&lt;/p&gt;
&lt;p&gt;// while(NRF_ADC-&amp;gt;EVENTS_END == 0); // it seems that stucking happens here?!?&lt;/p&gt;
&lt;p&gt;Any explanations for this behaviour?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: S110 Soft Device and Analog Inputs</title><link>https://devzone.nordicsemi.com/thread/8836?ContentTypeID=1</link><pubDate>Mon, 07 Apr 2014 14:36:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9e3ae9a1-8272-4b7b-90ed-59ebdbd5524b</guid><dc:creator>Stefan Birnir Sverrisson</dc:creator><description>&lt;p&gt;Perhaps you can look at &lt;a href="http://devzone.nordicsemi.com/index.php/uart-to-ble-transfer-data-issue#reply-6430"&gt;this thread&lt;/a&gt; in order to realize better how to operate the UART when the softdevice is enabled.&lt;/p&gt;
&lt;p&gt;For the ADC, why are you re-initializing it? Are you using perhaps multiple analog input pins. Perhaps you can share more about your scenario.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: S110 Soft Device and Analog Inputs</title><link>https://devzone.nordicsemi.com/thread/8835?ContentTypeID=1</link><pubDate>Fri, 04 Apr 2014 11:57:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9ace92f5-318d-4940-9be5-ee93064c56c4</guid><dc:creator>Jarmo</dc:creator><description>&lt;p&gt;The reason for getting wrong value from ADC was that the HRM implementation was also using ADC to measure battery voltage. I removed that and now it works.&lt;/p&gt;
&lt;p&gt;However, there is still the blocking issue if I want to re-initialize ADC during BTLE connection. As well the system hangs up if I use TWI or UART when BTLE is active. This happens regularly after about 15 seconds when the connection is established.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: S110 Soft Device and Analog Inputs</title><link>https://devzone.nordicsemi.com/thread/8834?ContentTypeID=1</link><pubDate>Thu, 03 Apr 2014 08:18:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f9d25051-a55a-4eeb-abe4-110eeb35484d</guid><dc:creator>Stefan Birnir Sverrisson</dc:creator><description>&lt;p&gt;Hi Jarmo&lt;/p&gt;
&lt;p&gt;Yes, it is somewhat more complicated when using the softdevice. This is mainly because the softdevice and the application share the same CPU. Softdevice operations generally have higher priority than the application in order to maintain the BLE protocol. Therefore, when doing periodic events in the application, you must be aware of how the BLE connection events work and how the softdevice blocks the CPU during a connection event.  so that the softdevice and the application can effectively utilize the CPU together. Periodic application events are typically ADC sampling or SPI/UART/TWI communication.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: S110 Soft Device and Analog Inputs</title><link>https://devzone.nordicsemi.com/thread/8833?ContentTypeID=1</link><pubDate>Wed, 02 Apr 2014 13:13:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:38bf9177-0993-45e9-895c-ee7dc994eac5</guid><dc:creator>Jarmo</dc:creator><description>&lt;p&gt;Thanks, I have to take a closer look on that. The issue is not yet solved. Looks like the Soft Devices makes everything twice as complicated :( I really cannot understand the underlying reason - how it is possible that a software module (S110) causes everything else to work differently...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: S110 Soft Device and Analog Inputs</title><link>https://devzone.nordicsemi.com/thread/8832?ContentTypeID=1</link><pubDate>Wed, 02 Apr 2014 11:24:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:56ecf35e-04b1-4199-bd3e-cf226b82f659</guid><dc:creator>Stefan Birnir Sverrisson</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;Have you looked at &lt;a href="http://devzone.nordicsemi.com/index.php/adc-softdevice-sample-rate-on-nrf51822#reply-1791"&gt;this thread&lt;/a&gt;? It discusses a bit about ADC sampling when softdevice is enabled.
I also attach a ADC example with S110 softdevice enabled. There are two archieves, one for SDK 5.1.0 and one for SDK 5.2.0. How to operate the example is explained at the top of the main file.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/4617.ble_5F00_app_5F00_hrs_5F00_with_5F00_adc_5F00_sample_5F00_ain.zip"&gt;ble_app_hrs_with_adc_sample_ain.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/ble_5F00_app_5F00_hrs_5F00_adc_5F00_sample_5F00_ain_5F00_sdk_5F00_5_5F00_2_5F00_0.zip"&gt;ble_app_hrs_adc_sample_ain_sdk_5_2_0.zip&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: S110 Soft Device and Analog Inputs</title><link>https://devzone.nordicsemi.com/thread/8831?ContentTypeID=1</link><pubDate>Wed, 02 Apr 2014 09:10:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9ced4d9e-3d64-464c-a53b-7f04b63b5c0a</guid><dc:creator>wlgrd</dc:creator><description>&lt;p&gt;Looking at the S110 spec, the ADC is not used by the softdevice.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>