<?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>Start scaning right after starting advertising.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/9424/start-scaning-right-after-starting-advertising</link><description>I use sdk 9.0.0, softdevice s130, nrf51422_xxac. In my application I have to both scan and advertise. When I start one of them (scanning or advertising) application starts running properly but when I start them both my application not always starts executing</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 22 Oct 2015 07:54:15 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/9424/start-scaning-right-after-starting-advertising" /><item><title>RE: Start scaning right after starting advertising.</title><link>https://devzone.nordicsemi.com/thread/34792?ContentTypeID=1</link><pubDate>Thu, 22 Oct 2015 07:54:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eead86d1-b0a4-4d7d-ad46-4641edea1456</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;First of all, vrey sorry for coming back to you so late. This thread somehow lost its visibility : (
instead of watchpoints, i guess it useful to insert conditional breakpoints.
There is an interesting discussion &lt;a href="http://stackoverflow.com/questions/1354637/how-do-i-set-persistent-and-conditional-watchpoints-on-locally-scoped-variables"&gt;here&lt;/a&gt; and look for the comments from DaveR&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Instead of watching the value whe it equals a specific value; you should set a conditional break point  on the line where you want to check the value of var1. This should effectively have the same effect&lt;/p&gt;
&lt;p&gt;e.g.
(gdb) break main.c:123 if (var1 == 0)&lt;/p&gt;
&lt;/blockquote&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Start scaning right after starting advertising.</title><link>https://devzone.nordicsemi.com/thread/34791?ContentTypeID=1</link><pubDate>Thu, 15 Oct 2015 12:51:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c0997e29-7890-4c17-b96a-c08d5e6b9e95</guid><dc:creator>Al Bundy</dc:creator><description>&lt;p&gt;I use Linux so my debugging tool is arm-none-eabi-gdb. I have tried &lt;code&gt;watch uart_count if uart_count &amp;gt; 100&lt;/code&gt; to stop my program to see when this value gets so high. Unfortunately gdb stops every time uart_count is changed but because of active soft device I got into hard fault after long breaks. I know that cortex M0 supports hardware watchpoints but do you know if supporting conditional hardware watchpoints is something else ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Start scaning right after starting advertising.</title><link>https://devzone.nordicsemi.com/thread/34790?ContentTypeID=1</link><pubDate>Fri, 09 Oct 2015 21:06:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3f3384f0-2f23-41fb-8240-c07dd8e98925</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;no need to apologize ... it good that you managed to narrow down the source of the problem.
softdevice RAM address space and application RAM address space is different. If you believe it is a RAM corruption then i am almost sure that it is not the softdevice. Softdevice is compiled with fixed RAM space and if there is a stack corruption, it should be in the lower side of rhe RAM address space and not into the application RAM address space. Softdevice does not use heap memory.&lt;/p&gt;
&lt;p&gt;I think the application has sent the address of an uninitialized pointer or similar. If you are using KEIL, you can set a breakpoint on uart_counter with a condition to see what has set the variable to such a high value.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Start scaning right after starting advertising.</title><link>https://devzone.nordicsemi.com/thread/34789?ContentTypeID=1</link><pubDate>Fri, 09 Oct 2015 13:31:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:676b7f70-88f5-4a4a-b71d-675936485ff9</guid><dc:creator>Al Bundy</dc:creator><description>&lt;p&gt;I have made some investigation today and first of all I have to apologize to you. Application crashes also when I start only one of scanning or advertising but it is much more in these cases, it only has 100% correct execution when neither advertising nor scanning is started. In my application I have static variable (uart_counter) which is changed whenever I want to send something using uart. There are only two functions that modifies this value. When program went buggy I stopped it with gdb and it occurred that uart_counter was equal to some huge value thats why almost whole RAM is sent. I init uart and start sending before calling ble_advertising_start and ble_scan_start. Is it possible that softdevice may change value of static variable or automatic variable of function that was interrupted by softdevice ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Start scaning right after starting advertising.</title><link>https://devzone.nordicsemi.com/thread/34788?ContentTypeID=1</link><pubDate>Wed, 07 Oct 2015 13:25:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:060650e4-a91a-46f1-b76b-972e9386fa87</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;you said that the uart sends the whole ram when buggy, I would very much like to know the source of this problem. Please update this thread when you find out. If you need more help, posting some code snippets will speed up our analysis.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Start scaning right after starting advertising.</title><link>https://devzone.nordicsemi.com/thread/34787?ContentTypeID=1</link><pubDate>Wed, 07 Oct 2015 11:19:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:250a975c-2f48-4bd6-87b3-aedb550f2a26</guid><dc:creator>Al Bundy</dc:creator><description>&lt;p&gt;Sorry for responding so late. Ok, here is what happens. In my application I use app_uart_fifo.c and I sniff my UART communication that&amp;#39;s how I know something is wrong. When application starts correctly I sent just one sentence but sometimes when it gets into that buggy style nordic sends the same sentence but then it sends whole RAM content and gets into Hard Fault. Debugging is rather impossible when softdevice is working and the problems does not appear when I just start one of scanning or advertising. When I stop program in buggy execution Program Counter is in Soft Device or app_uart_fifo.c or some scheduler functions and that&amp;#39;s why I still consider it as bug in my code. So far I have added watchdog so that my application restarts when it enters buggy path.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Start scaning right after starting advertising.</title><link>https://devzone.nordicsemi.com/thread/34786?ContentTypeID=1</link><pubDate>Wed, 30 Sep 2015 10:51:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6fd6863e-6609-4c90-8310-92ec83af9b8c</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;This should have worked fine, I would like to know the what errors you get. Is it possible that the problem is somewhere else?  because if there is a problem with this, it should not have worked sometimes.
Try to debug and tell us little more clearly what you mean by &amp;quot;sometimes it looks like processor is executing total mess and I have to restart it&amp;quot;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Start scaning right after starting advertising.</title><link>https://devzone.nordicsemi.com/thread/34785?ContentTypeID=1</link><pubDate>Mon, 28 Sep 2015 21:25:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:45ad7394-e5fe-460e-bdc7-4fdad4c43901</guid><dc:creator>Al Bundy</dc:creator><description>&lt;pre&gt;&lt;code&gt;/**&amp;lt; Determines scan interval in units of 0.625 millisecond. */                  
#define SCAN_INTERVAL 0x00A0    /** &amp;lt; 0.1 s */  

                                 
/**&amp;lt; Determines scan window in units of 0.625 millisecond. */                    
#define SCAN_WINDOW 0x0050      /** &amp;lt; 0.05 s */                                  
                                                                             
static ble_gap_adv_params_t bc_adv_params;                                       
                                                                                 
static const ble_gap_scan_params_t scan_params = { 0,// Active scanning not set  
                                                 0,// Selective scanning not set. 
                                                NULL, // White-list not set.     
                                 (uint16_t)SCAN_INTERVAL, // Scan interval.       
                                (uint16_t)SCAN_WINDOW,   // Scan window.         
                         0 /* Never stop scanning unless explicitly asked to */};

#define APP_ADV_FAST_INTERVAL            0x0028 // 25 ms                         
#define APP_ADV_SLOW_INTERVAL            0x0C80 // 2 sec                         
#define APP_ADV_FAST_TIMEOUT             0 // sec                                
#define APP_ADV_SLOW_TIMEOUT             0 
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I use fast advertising. Sorry Aryan I have not answered in comment but it was easier and more clear.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Start scaning right after starting advertising.</title><link>https://devzone.nordicsemi.com/thread/34784?ContentTypeID=1</link><pubDate>Fri, 25 Sep 2015 08:13:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:177b71c7-4b27-44b2-af65-5f583ca4daa2</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;This should work OK, ofcourse the main factors are the ADV interval and SCAN intervals/Window size.
Can you give more details about these settings. if the interval is slow then these two events will compete less with each other for RADIO and CPU resources.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>