<?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>ADC + ble connection</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/3487/adc-ble-connection</link><description>I am using nrf51_sdk_v6_0_0_43681 and s110_nrf51822_7.0.01 wiht nrf51822, and I modifiy code based on ble_app_uart. 
 Here I am trying to launch a continous ADC sample with a repeated mode timer, the timer interval is 1ms or 2ms or 4ms. Meanwhile I disconnect</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 21 Aug 2014 06:53:44 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/3487/adc-ble-connection" /><item><title>RE: ADC + ble connection</title><link>https://devzone.nordicsemi.com/thread/12632?ContentTypeID=1</link><pubDate>Thu, 21 Aug 2014 06:53:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:974bbb30-0a03-4138-aebb-07a6567bb508</guid><dc:creator>Stefan Birnir Sverrisson</dc:creator><description>&lt;p&gt;With the code and settings you have revealed on this thread I am having no problems on my side. Are you willing to share your whole project with me through a support case. For that purpose, create a support case in our support portal on www.nordicsemi.no. Go to the bottom of the page and click Technical Support Team. Attach your code with your case and refer to this thread.  Any additional description of the problem would be helpful. Include what chip version you are having (i.e. the chip markings on your nRF51 chip) and if you are using development kit, evaluation kit or your custom PCB.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ADC + ble connection</title><link>https://devzone.nordicsemi.com/thread/12631?ContentTypeID=1</link><pubDate>Wed, 20 Aug 2014 12:32:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9a345226-0ed2-4c76-ba89-139dc780554e</guid><dc:creator>frank zhang</dc:creator><description>&lt;p&gt;Hi Stefan,
I just include math.h, sin/cos/sqrt  can be available.
Below is my connection parameters:
#define MIN_CONN_INTERVAL               24
#define MAX_CONN_INTERVAL               90
#define SLAVE_LATENCY                   0
#define CONN_SUP_TIMEOUT                400
#define FIRST_CONN_PARAMS_UPDATE_DELAY  APP_TIMER_TICKS(5000, APP_TIMER_PRESCALER)
#define NEXT_CONN_PARAMS_UPDATE_DELAY   APP_TIMER_TICKS(30000, APP_TIMER_PRESCALER)
#define MAX_CONN_PARAMS_UPDATE_COUNT    3
#define APP_ADV_INTERVAL                128
#define APP_ADV_TIMEOUT_IN_SECONDS      0&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ADC + ble connection</title><link>https://devzone.nordicsemi.com/thread/12630?ContentTypeID=1</link><pubDate>Wed, 20 Aug 2014 07:34:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5ae09a4f-5bf3-4c8b-ac99-77b5ea37b8b4</guid><dc:creator>Stefan Birnir Sverrisson</dc:creator><description>&lt;p&gt;What math library do you use for the cos/sin functions? What is your connection parameters, i.e. connection interval, slave latency and timeout?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ADC + ble connection</title><link>https://devzone.nordicsemi.com/thread/12629?ContentTypeID=1</link><pubDate>Tue, 19 Aug 2014 13:26:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:68082112-0e2b-4f38-8e31-3b12f2fa0817</guid><dc:creator>frank zhang</dc:creator><description>&lt;p&gt;Hi Stefan,
I think that I have found the key problem.
Nrf51822 has problem with process dyadic array.   Please see xxx_process() as below, it is just a test case. If I enable dyadic array, the system will crash when connecting/disconnecting, if I disable dyadic array, it should be OK. I think that it should be a bug. Please check and confirm it.
void xxx_process(void)
{
long N,M;
long  i,j,s,r,t;
float	 temp;
long  k1,k2;
float	 u,v,w;
float Re[256];
float Am[256];
float Im[256][256];
float pi = 3.1416;&lt;/p&gt;
&lt;p&gt;for(i=0;i&amp;lt;256;i++)
{
for(j=0;j&amp;lt;256;j++)
{
Re[i]=i;
Am[i]=i;
//Im[i][j]=j;
}
}&lt;/p&gt;
&lt;p&gt;for(i = 0; i&amp;lt;256;i++)
{
for(j = 0; j&amp;lt;20000;j++)
{
u = Re[i]&lt;em&gt;cos(2&lt;/em&gt;j&lt;em&gt;pi/256)+ Am[i]&lt;em&gt;sin(2&lt;/em&gt;j&lt;/em&gt;pi/256);
v = Re[i]&lt;em&gt;cos(2&lt;/em&gt;j&lt;em&gt;pi/256)- Am[i]&lt;em&gt;sin(2&lt;/em&gt;j&lt;/em&gt;pi/256);&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;	 //w = sqrt(u*u+v*v);
	 w = sqrt(u*u+v*v)+Im[i][j];
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;}
main() { ..... //initialization for (;;) { xxx_process();
nrf_delay_ms(5);
power_manage();&lt;/p&gt;
&lt;p&gt;}
}&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ADC + ble connection</title><link>https://devzone.nordicsemi.com/thread/12628?ContentTypeID=1</link><pubDate>Mon, 18 Aug 2014 15:34:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1dbbed93-7992-42e7-bc3b-9b1145a35155</guid><dc:creator>scytulip</dc:creator><description>&lt;p&gt;Try using scheduler.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ADC + ble connection</title><link>https://devzone.nordicsemi.com/thread/12627?ContentTypeID=1</link><pubDate>Mon, 18 Aug 2014 14:28:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:df56a002-568b-4c87-b0b0-de4d6548e731</guid><dc:creator>Stefan Birnir Sverrisson</dc:creator><description>&lt;p&gt;You could disconnect before the algorithm executes, then advertise when it finishes in order to connect again. You can also set the slave latency to a relatively high number so that the nRF51 device is not required to respond to the phone for a number of connection events. What I am curious to know however, why is the device crashing when you press connect/disconnect. The code that you execute in the main function has lowest priority and should not interrupt any softdevice activity.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ADC + ble connection</title><link>https://devzone.nordicsemi.com/thread/12626?ContentTypeID=1</link><pubDate>Mon, 18 Aug 2014 13:18:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:97477da6-c800-4475-a7e2-a40392afa863</guid><dc:creator>frank zhang</dc:creator><description>&lt;p&gt;Hi Stefan,
Great thanks for your answer.Here I found that continously ADC sampling is not the root cause of system crash.
I have an function xxx_process in main loop runtine as below.  It is a complicated algorithm， sometimes it will take about 2 second to finish it.  When algorithm is running, and I connect/disconnect the board with my cellphone, it will cause system crash.
Here I want to know if I can disable ble response before algorithm running and enable ble response after algorithm finish.&lt;/p&gt;
&lt;p&gt;main()
{
.....      //initialization
for (;;)
{
xxx_process();
power_manage();&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;Thanks
Frank&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ADC + ble connection</title><link>https://devzone.nordicsemi.com/thread/12625?ContentTypeID=1</link><pubDate>Fri, 15 Aug 2014 08:52:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ddde09b9-9e45-4ba5-81a9-13b2354a564d</guid><dc:creator>Stefan Birnir Sverrisson</dc:creator><description>&lt;p&gt;Hi Frank&lt;/p&gt;
&lt;p&gt;Take a look at &lt;a href="https://github.com/NordicSemiconductor/nrf51-ADC-examples/tree/master/adc-example-with-softdevice"&gt;this example code&lt;/a&gt; on Github where the ADC is continuously sampling when the softevice is advertising/connected. As you describe you problem, I suspect the problem might be the priority of your ADC interrupt handler, you must explicitly set the priority when you initialize the ADC&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>