<?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>Application crash after disconnection</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/25429/application-crash-after-disconnection</link><description>Hi, 
 I have an application with an accelerometer. This one communicate in I2C (TWI ). The accelerometer send a &amp;quot;data ready&amp;quot; signal every 20ms. I&amp;#39;m using the GPIOTE module to detect this signal and read the acceleration (I2C). 
 Each time I disconnect</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 28 Sep 2017 09:19:30 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/25429/application-crash-after-disconnection" /><item><title>RE: Application crash after disconnection</title><link>https://devzone.nordicsemi.com/thread/100231?ContentTypeID=1</link><pubDate>Thu, 28 Sep 2017 09:19:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e3496544-d4c9-4d40-b638-55384c8143c7</guid><dc:creator>Martin Tverdal</dc:creator><description>&lt;p&gt;It&amp;#39;s very frustrating to not understand whats going on indeed.
Those addresses looks good to me.&lt;/p&gt;
&lt;p&gt;If you want to take more time to debug this, a very good next step would be to see what is causing the HardFault by examining the call-stack. To do that, the best thing would be to set a break point at that address (0x6B0).
Lets say SP is 0x2000400C when you hit the breakpoint. The interesting values to know (post them here, or examine yourself) would be 20003FFF0 - 0x2000400C.&lt;/p&gt;
&lt;p&gt;If you see here:
&lt;a href="http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0497a/Babefdjc.html"&gt;infocenter.arm.com/.../index.jsp&lt;/a&gt;
Whatever is located at address 0x20004004 (PC), will be the address that caused the HardFault. If that is inside the SoftDeivce ie &amp;lt; 0x1B000. It was the SoftDevice that caused the HardFault. If it is &amp;gt; 0x1B000, the HardFault is caused by the application.&lt;/p&gt;
&lt;p&gt;Let me know if you try this, and what the result is.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Application crash after disconnection</title><link>https://devzone.nordicsemi.com/thread/100230?ContentTypeID=1</link><pubDate>Wed, 27 Sep 2017 21:08:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5d04e2ce-54b8-40ff-b1a6-f71f2c09da45</guid><dc:creator>julienh</dc:creator><description>&lt;p&gt;Thanks to my functional needs, I don&amp;#39;t need the accelerometer when the device is connected in Bluetooth. I implemented a sequence to disable the data_ready interruption and GPIOTE and now it seems to work fine.
I&amp;#39;m a little bit frustrated to not understand what&amp;#39;s happened but I have to deliver this code ASAP so I will not try to go back to see what is happening.&lt;/p&gt;
&lt;p&gt;By &amp;quot;chance&amp;quot; (not sure that this is the word), I talked with a colleague which had the same behavior (same SDK and SD) but in a totally different project (nothing related with my project and product). I asked him to check the 2 registers that you asked for.
He had :
0x1B00C -&amp;gt; C3 B0 01
0x20000000 -&amp;gt; 00 10 00 00 00 B0 01 00 01 00 08 00 87 00 59 00 03 00 05 00 07&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Application crash after disconnection</title><link>https://devzone.nordicsemi.com/thread/100232?ContentTypeID=1</link><pubDate>Tue, 26 Sep 2017 14:38:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a3f93762-70f3-476b-9059-fae8b4d3b8f1</guid><dc:creator>Martin Tverdal</dc:creator><description>&lt;p&gt;at address 0x6B0 in the SoftDevice is code for handling HardFaults. Both HardFaults generated by the application and the SoftDevice will be handled first by code at this address.&lt;/p&gt;
&lt;p&gt;So, the first question is, what generated the HardFault. That should be possible to see by examining the callstack to see what was running before the HardFault happened.&lt;/p&gt;
&lt;p&gt;Second question is why the SoftDevice is not handling it as expected. If it was a application hardfault, it should of forwarded it to the application.&lt;/p&gt;
&lt;p&gt;When this happens, and you are debugging, could you tell me the value of address 0x20000000, ie the first word in ram? And also could you tell me the value at address 0x1B00C (should be the applications HardFault handler)?&lt;/p&gt;
&lt;p&gt;Are you using a bootloader?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Application crash after disconnection</title><link>https://devzone.nordicsemi.com/thread/100229?ContentTypeID=1</link><pubDate>Tue, 26 Sep 2017 10:30:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fb636d20-c0ee-4417-8a57-a4be6878ee3a</guid><dc:creator>julienh</dc:creator><description>&lt;ol&gt;
&lt;li&gt;Yes I&amp;#39;m using S130 V2.0.1 which is in the SDK bundle (12.3).&lt;/li&gt;
&lt;li&gt;I&amp;#39;m getting the message in debugger mode from Segger Embedded studio. When I disconnect the bluetooth, the execution is stopped with select active call frame &amp;quot;unknown function at 0x000006B0&amp;quot;. In the call stack, the last called address is 0x000006B0.
I tried a lot of things since yersterday but nothing to do... Still the same issue when I disconnect (and start again the advertising). If I don&amp;#39;t start the advertising again, no problem.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Is that helpful if I create a case with my code?&lt;/p&gt;
&lt;p&gt;GPIOTE is in low accuracy.
TWI IRQ priority low.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Application crash after disconnection</title><link>https://devzone.nordicsemi.com/thread/100235?ContentTypeID=1</link><pubDate>Tue, 26 Sep 2017 10:05:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:89b3eae3-8139-4346-b6fd-326c85fabd60</guid><dc:creator>MartinBL</dc:creator><description>&lt;ol&gt;
&lt;li&gt;Are you using S130 v2.0.1 that is bundled with SDK 12.3?&lt;/li&gt;
&lt;li&gt;Are you getting the &amp;quot;Unknown funtion 0x000006B0&amp;quot; message from a debugger?&lt;/li&gt;
&lt;/ol&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Application crash after disconnection</title><link>https://devzone.nordicsemi.com/thread/100234?ContentTypeID=1</link><pubDate>Mon, 25 Sep 2017 12:24:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8b3eaaaa-bce2-4659-97df-17aecbaaa3db</guid><dc:creator>julienh</dc:creator><description>&lt;p&gt;What is &amp;quot;Unknown funtion 0x000006B0&amp;quot; and how is that possible to end in this unknown function?
Do you have any example to use the ble_debug_assert_handler as explained on the previous topic?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Application crash after disconnection</title><link>https://devzone.nordicsemi.com/thread/100233?ContentTypeID=1</link><pubDate>Mon, 25 Sep 2017 12:22:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e3b2e9f7-1ebc-440b-ba70-d16e8294ef98</guid><dc:creator>julienh</dc:creator><description>&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Nothing directly related to the disconnection event but an interruption on the GPIOTE can occur (accelerometer data ready signal) every 20ms.
The gpiote interruption handler is really short (just changing a &amp;quot;data_ready&amp;quot; flag to true). Then I&amp;#39;m checking data_ready in the main loop and read the accelerometer value if a new data is available (I2C).
Due to the unsynchronized interruption, I tried to disable this when I have the BLE_GAP_EVT_DISCONNECTED event but that doesn&amp;#39;t solve the problem.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;This is what I thought but in fact the TWI is already configured to low level as follow in the sdk_config.c&lt;/p&gt;
&lt;p&gt;TWI_DEFAULT_CONFIG_IRQ_PRIORITY 3&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;I don&amp;#39;t call any SD function from my TWI module neither from a GPIOTE interruption handler or something like that.&lt;/p&gt;
&lt;ol start="3"&gt;
&lt;li&gt;DEBUG is defined and I&amp;#39;m actually in debugging level 2 and optimization level 1. I tried before other without success. Will try again.&lt;/li&gt;
&lt;/ol&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Application crash after disconnection</title><link>https://devzone.nordicsemi.com/thread/100228?ContentTypeID=1</link><pubDate>Mon, 25 Sep 2017 08:50:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3857870c-85ab-4d3d-8081-1fd58f04f292</guid><dc:creator>MartinBL</dc:creator><description>&lt;ol&gt;
&lt;li&gt;Do you do anything special when you disconnect? Like reading from your sensor or print something to a serial terminal?&lt;/li&gt;
&lt;li&gt;Could it be an &lt;a href="https://devzone.nordicsemi.com/question/79226/can-ble_nus_string_send-be-called-from-a-twi-callback/"&gt;issue with interrupt priorities&lt;/a&gt;?&lt;/li&gt;
&lt;li&gt;Are you debugging with &lt;a href="https://devzone.nordicsemi.com/question/60125/my-device-is-freezing-and-restarting/"&gt;optimization level -O0 and DEBUG defined&lt;/a&gt;?&lt;/li&gt;
&lt;/ol&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>