<?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>How is it possible that my app doesn&amp;#39;t start unless I start a debug?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/29527/how-is-it-possible-that-my-app-doesn-t-start-unless-i-start-a-debug</link><description>I am playing with example app from this tutorial devzone.nordicsemi.com/.../ 
I can see the app only when I start debugging. If I just power up my custom board, it doesn&amp;#39;t show the app in my smartphone. What do I explain such behavior? (Probably, some</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 24 Jan 2018 22:41:17 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/29527/how-is-it-possible-that-my-app-doesn-t-start-unless-i-start-a-debug" /><item><title>RE: How is it possible that my app doesn't start unless I start a debug?</title><link>https://devzone.nordicsemi.com/thread/117347?ContentTypeID=1</link><pubDate>Wed, 24 Jan 2018 22:41:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:319c0881-5f94-42e2-972d-69346b4c2f6a</guid><dc:creator>puff</dc:creator><description>&lt;p&gt;most likely, yes, that would cause a hardfault (because of timing, as far as I got). Since I am on nRF51, there is no monitor mode debug on that kernel ;-(, and it is sort of pain in the ass, when you have to start debugging over and over again to get to finally find the bug.  It gets even more complicated with segger, when it just gets out of debugging after a while (you have may be 10-20 second - and I have no idea to explain such strange behavior)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How is it possible that my app doesn't start unless I start a debug?</title><link>https://devzone.nordicsemi.com/thread/117346?ContentTypeID=1</link><pubDate>Wed, 24 Jan 2018 22:28:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e0ee6bb6-2f9f-4325-a52d-d9ac29ebb9ea</guid><dc:creator>Matt</dc:creator><description>&lt;p&gt;But if you DO put a breakpoint somewhere in your code, and the execution stops there, and when you hit the &amp;quot;go&amp;quot; again, you would run into a hard fault correct? That&amp;#39;s the case with nRF52 if one does not have the monitor mode debug running.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How is it possible that my app doesn't start unless I start a debug?</title><link>https://devzone.nordicsemi.com/thread/117345?ContentTypeID=1</link><pubDate>Wed, 24 Jan 2018 21:50:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d014cb07-91fc-4ebf-b46f-67fb4b391905</guid><dc:creator>puff</dc:creator><description>&lt;p&gt;what do you mean by single step? debug-&amp;gt;go worked just fine (even without uart_init() - it used some internal printf, specific to segger, but in normal mode it refused to work. i was too stupid, it  took me some time before realized it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How is it possible that my app doesn't start unless I start a debug?</title><link>https://devzone.nordicsemi.com/thread/117359?ContentTypeID=1</link><pubDate>Wed, 24 Jan 2018 21:48:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7ac7e6e9-ca0e-4539-afb3-1a080dd369fc</guid><dc:creator>puff</dc:creator><description>&lt;p&gt;I think the problem was (is) that I used Segger and there were printf in my code without uart_init(). In debug mode it was somehow retargeted to Segger console, without any errors, but when run in normal mode, it required uart_init().&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How is it possible that my app doesn't start unless I start a debug?</title><link>https://devzone.nordicsemi.com/thread/117349?ContentTypeID=1</link><pubDate>Fri, 19 Jan 2018 21:26:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c093d3cd-a915-43f3-b143-11a3b35bf210</guid><dc:creator>Matt</dc:creator><description>&lt;p&gt;So how would you attempt to single step in your &amp;quot;debugger&amp;quot;?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How is it possible that my app doesn't start unless I start a debug?</title><link>https://devzone.nordicsemi.com/thread/117348?ContentTypeID=1</link><pubDate>Fri, 19 Jan 2018 19:57:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1f0c8d3f-0a82-41ed-b701-627e0bd0c9d5</guid><dc:creator>puff</dc:creator><description>&lt;p&gt;monitor debug mode is not available on cortex m0, only m4, sadly..&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How is it possible that my app doesn't start unless I start a debug?</title><link>https://devzone.nordicsemi.com/thread/117358?ContentTypeID=1</link><pubDate>Thu, 18 Jan 2018 11:16:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8d0f4c53-5825-4573-9795-40da8e5d2ad1</guid><dc:creator>puff</dc:creator><description>&lt;p&gt;That was a hint in a right direction, thank you!
First, I searched for printf calls and removed them in another three lines in ourservices.c. It didn&amp;#39;t help. Then I did project settings-debug-RTT off, and it just started working!
Now, the next challenge, despite APP_ADV_TIMEOUT_IN_SECONDS is set to zero (which I assume should make it advertise forever), some time later, still, it gets invisible...
I&amp;#39;ll try to setup a scope to check its power consumption - probably, that way I&amp;#39;d get more info what actually happens to it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How is it possible that my app doesn't start unless I start a debug?</title><link>https://devzone.nordicsemi.com/thread/117355?ContentTypeID=1</link><pubDate>Thu, 18 Jan 2018 09:49:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:22136104-812f-439d-8770-d5cc6043ba15</guid><dc:creator>Andre</dc:creator><description>&lt;p&gt;Do you use semihosting to print the printf in the debugger? If so, such a printf will cause the code to hang if no debuger is connected&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How is it possible that my app doesn't start unless I start a debug?</title><link>https://devzone.nordicsemi.com/thread/117357?ContentTypeID=1</link><pubDate>Thu, 18 Jan 2018 02:02:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6fefd564-2dda-4e1b-990a-fd04ca3cc236</guid><dc:creator>Matt</dc:creator><description>&lt;p&gt;I&amp;#39;m not familiar with nRF51822 but I guess you need to enable monitor mode debugging if you want to single step your application. Search this forum for &amp;quot;monitor mode debug&amp;quot; and also read the chapter on monitor mode debugging in ~\SEGGER\JLink_V612e\Doc\Manuals\UM*_Jlink.pdf.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How is it possible that my app doesn't start unless I start a debug?</title><link>https://devzone.nordicsemi.com/thread/117356?ContentTypeID=1</link><pubDate>Wed, 17 Jan 2018 22:42:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1987844f-1479-4a1d-9b0c-d15165f49ac8</guid><dc:creator>puff</dc:creator><description>&lt;p&gt;Yes, I am trying to debug the board with jlink. My whole board is powered from jlink. When I connect the board and upload the firmware, it says &amp;#39;nothing done, firmware matches&amp;#39; (if I haven&amp;#39;t erased it before that). But I can&amp;#39;t see anything, unless i start debugging. BTW, see update.&lt;/p&gt;
&lt;p&gt;No, pin 10 LED only is on after I start debugging. Tracking down this weird behaviour I found out that even during debug sessions my applications get to hardfault (0x6B0). But I can&amp;#39;t figure out, what was the stack and from which line it gets there. Thinking of recording a screencast...
Anyway, even with this strange behavior I managed to control my led as I needed, but then the app dies again.
This was the case when I added that code to a working ble_beacon project I played with before that.
Now I decided to follow the latest segger tutorial, importing it from scratch. Still I got to hardfault in debug mode, still I can&amp;#39;t see app after the normal startup.
The board keeps restarting. See the video&lt;/p&gt;
&lt;p&gt;&lt;a href="https://youtu.be/GL3GwJUwPx8"&gt;https://youtu.be/GL3GwJUwPx8&lt;/a&gt;
&lt;a href="https://youtu.be/gBA1JsnluH0"&gt;https://youtu.be/gBA1JsnluH0&lt;/a&gt;
and this one with some more info on stack
&lt;a href="https://youtu.be/7aOtWxhuqk0"&gt;https://youtu.be/7aOtWxhuqk0&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How is it possible that my app doesn't start unless I start a debug?</title><link>https://devzone.nordicsemi.com/thread/117354?ContentTypeID=1</link><pubDate>Wed, 17 Jan 2018 20:34:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:214a8294-d057-4817-bc8d-cd7965b8b8da</guid><dc:creator>Matt</dc:creator><description>&lt;p&gt;So you have the Segger JLink connected to the SWD I/f of your custom board to &amp;quot;debug&amp;quot; your application correct? And when you remove the JLink unit does your pin 10 LED still light up when you power up your custom board now?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How is it possible that my app doesn't start unless I start a debug?</title><link>https://devzone.nordicsemi.com/thread/117353?ContentTypeID=1</link><pubDate>Wed, 17 Jan 2018 14:43:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d263b867-aa94-45d9-9bc8-77a6246e6c0a</guid><dc:creator>puff</dc:creator><description>&lt;p&gt;sorry. I didn&amp;#39;t think that could be so specific. It&amp;#39;s a custom board (bare minimum), SDK 11, S130.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How is it possible that my app doesn't start unless I start a debug?</title><link>https://devzone.nordicsemi.com/thread/117352?ContentTypeID=1</link><pubDate>Wed, 17 Jan 2018 14:25:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8e638c84-7eb3-49f6-aee2-f722feea00fd</guid><dc:creator>Matt</dc:creator><description>&lt;p&gt;With PCA10040 or your custom board? With SDK12? 13? 14? Just saying &amp;quot;it doesn&amp;#39;t start..&amp;quot; is not too helpful here.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How is it possible that my app doesn't start unless I start a debug?</title><link>https://devzone.nordicsemi.com/thread/117351?ContentTypeID=1</link><pubDate>Wed, 17 Jan 2018 13:02:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:568e02dd-351f-4ea6-926d-9db45821ce8e</guid><dc:creator>puff</dc:creator><description>&lt;p&gt;first I commented out
//err_code = bsp_btn_ble_sleep_mode_prepare();
then I commented out
//err_code = sd_power_system_off();
and still got the same behaviour.
I also though, that might somehow be related to buttons left in the air (neither pulled-down, nor pulled-up), so I even removed BSP_INIT_BUTTONS flag in bsp_init, but it didn&amp;#39;t help.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How is it possible that my app doesn't start unless I start a debug?</title><link>https://devzone.nordicsemi.com/thread/117361?ContentTypeID=1</link><pubDate>Wed, 17 Jan 2018 12:58:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:593f38a3-c4f8-4d09-baf3-41882435cd87</guid><dc:creator>puff</dc:creator><description>&lt;p&gt;That&amp;#39;s strange, but I don&amp;#39;t see sdk_config.h in any dependency lists in my project, and the search for that SEGGER_RTT_CONFIG_DEFAULT_MODE thoughout the entire solution said &amp;#39;no results&amp;#39;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How is it possible that my app doesn't start unless I start a debug?</title><link>https://devzone.nordicsemi.com/thread/117360?ContentTypeID=1</link><pubDate>Wed, 17 Jan 2018 12:47:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cf632e2e-18cd-497e-93b7-13c787651690</guid><dc:creator>Andy</dc:creator><description>&lt;p&gt;Check your sdk_config.h and make sure that&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#define SEGGER_RTT_CONFIG_DEFAULT_MODE 0
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;is not set to 2 (Blocking mode).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How is it possible that my app doesn't start unless I start a debug?</title><link>https://devzone.nordicsemi.com/thread/117350?ContentTypeID=1</link><pubDate>Wed, 17 Jan 2018 12:43:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b288fcb6-8a3d-4126-928c-e982d2a71e5c</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Have you updated the pinout to reflect the pinout on your board? I&amp;#39;m wondering if the BSP_EVENT_SLEEP (button event) could be accidentally triggered, hence causing the chip to enter system off (leads to system reset if you are in debug mode). Do you see the same behavior if you comment out the calls to  sleep_mode_enter() in your code?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>