<?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 Code hangs after SUCCESSFULLY sending notification to central</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/66892/application-code-hangs-after-successfully-sending-notification-to-central</link><description>Hi All. 
 I am writing an application that has several notifiable characteristics, and up until now they have been sending data just fine, however the other day I was cleaning up some code and i decided to change the function that handles the notification</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 09 Oct 2020 14:46:23 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/66892/application-code-hangs-after-successfully-sending-notification-to-central" /><item><title>RE: Application Code hangs after SUCCESSFULLY sending notification to central</title><link>https://devzone.nordicsemi.com/thread/274083?ContentTypeID=1</link><pubDate>Fri, 09 Oct 2020 14:46:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a3c9bdd9-ec40-407d-bbbe-9c90d33cd8e6</guid><dc:creator>patjshan</dc:creator><description>&lt;p&gt;Ah! the other service that i am using as responding to the hvx tx complete evt but causing an issue because it wasnt the one that had sent the notificaton, that line was left over rom when someone else had written the profile for a related project, so thats why I didn&amp;#39;t catch it&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks so much for your help Vindar!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Application Code hangs after SUCCESSFULLY sending notification to central</title><link>https://devzone.nordicsemi.com/thread/274081?ContentTypeID=1</link><pubDate>Fri, 09 Oct 2020 14:41:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:36407c92-f3d2-4473-8c19-88401521fdea</guid><dc:creator>patjshan</dc:creator><description>&lt;p&gt;Not really, up until recently I didn&amp;#39;t care about the tx complete evt so I wasn&amp;#39;t handling it anywhere. Since I had the problem I&amp;#39;ve added a debug line that just prints out that the evt has happened but it never gets that far&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Application Code hangs after SUCCESSFULLY sending notification to central</title><link>https://devzone.nordicsemi.com/thread/274080?ContentTypeID=1</link><pubDate>Fri, 09 Oct 2020 14:38:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dcf30c64-239e-4a2a-96c1-95f262418050</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;That&amp;#39;s good, it makes debugging a bit easier. The hardfault seems to be occuring in the the SD_EVT_IRQn context (ie. inside one of the softdevice handlers) according to the PSR register (ISR number = 0x26 - 0x10 = SWI2_EGU2_IRQn) . And the fault itself is caused by the program jumping to address 0x0 I think.&lt;/p&gt;
&lt;p&gt;Are you doing anything interesting inside the HVX_TX_Complete event?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Application Code hangs after SUCCESSFULLY sending notification to central</title><link>https://devzone.nordicsemi.com/thread/274077?ContentTypeID=1</link><pubDate>Fri, 09 Oct 2020 14:20:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d26c9831-12a7-4c72-9672-184a95397b55</guid><dc:creator>patjshan</dc:creator><description>&lt;p&gt;I fixed the logger, a macro was being redefined and I hadn&amp;#39;t noticed the first time. Now the output looks like this (i tried to attach this as a screenshot but it wouldn&amp;#39;t allow me to):&lt;/p&gt;
&lt;p&gt;&amp;lt;error&amp;gt; hardfault: HARD FAULT at 0x00000000&lt;br /&gt;&amp;lt;error&amp;gt; hardfault: R0: 0x2000FE9C R1: 0x20003234 R2: 0x2000FE9C R3: 0x00000000&lt;br /&gt;&amp;lt;error&amp;gt; hardfault: R12: 0x0000000D LR: 0x0003D1D9 PSR: 0x20000026&lt;br /&gt;&amp;lt;error&amp;gt; hardfault: Cause: The processor has attempted to execute an instruction that makes illegal use of the EPSR.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Application Code hangs after SUCCESSFULLY sending notification to central</title><link>https://devzone.nordicsemi.com/thread/274064?ContentTypeID=1</link><pubDate>Fri, 09 Oct 2020 14:03:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c923da1b-dfad-4636-a909-cdd81fa8d407</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hm, not sure why the logging isn&amp;#39;t working, but could you try to log the PC register value as well, then look up the PC address in the disassembly view to see if it points to the faulting instruction.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m also happy to try debugging this here in case you are able to share a minimal version of your project.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;*Edit* Here is a screenshot showing what it may look like when logging is enabled&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1602253197547v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Application Code hangs after SUCCESSFULLY sending notification to central</title><link>https://devzone.nordicsemi.com/thread/274055?ContentTypeID=1</link><pubDate>Fri, 09 Oct 2020 13:41:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4ee4c9ad-64b2-41bb-9b58-d4ec8623c5a6</guid><dc:creator>patjshan</dc:creator><description>&lt;p&gt;Thanks for the info! I enabled all of the macros and included the files in my project, but the NRF_ERROR_LOG statements still weren&amp;#39;t being executed and I&amp;#39;m not sure why. I know I&amp;#39;m probably not supposed to but in the interest of time I switch the error log call in the for loop in hardfault_implementation to a printf() just to see which error log&amp;nbsp; I got and it printed this:&lt;/p&gt;
&lt;p&gt;&amp;quot;Cause: The processor has attempted to execute an instruction that makes illegal use of the EPSR.&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;any thoughts on what this means?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Patrick&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Application Code hangs after SUCCESSFULLY sending notification to central</title><link>https://devzone.nordicsemi.com/thread/274029?ContentTypeID=1</link><pubDate>Fri, 09 Oct 2020 12:09:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4ccbec82-22ba-4efa-a32d-3bba1d4ba0cf</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I can&amp;#39;t think of any obvious reasons as to why the hardfault exception gets&amp;nbsp; triggered when you attempt to send notifications from your main loop. It also sounds like the issue is possibly not directly related to the hvx call iteself since it is returning back application. Anyway, I think my best suggestion to further troubleshoot is to include the &lt;span&gt;&lt;a title="HardFault handling library" href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/lib_hardfault.html?cp=7_1_3_22"&gt;HardFault handling library&lt;/a&gt;&lt;/span&gt; in your project and see if you could get some more details about what caused the fault.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Steps to enable the Hardfault handling libary&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;1. make sure the following two source files are included in the project:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="xml"&gt;      &amp;lt;file file_name=&amp;quot;../../../../../../components/libraries/hardfault/hardfault_implementation.c&amp;quot; /&amp;gt;
      &amp;lt;file file_name=&amp;quot;../../../../../../components/libraries/hardfault/nrf52/handler/hardfault_handler_gcc.c&amp;quot; /&amp;gt;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;2. Apply the following sdk_config.h settings to enable hardfault handler and RTT logging in debug terminal&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;HARDFAULT_HANDLER_ENABLED 1
NRF_FPRINTF_FLAG_AUTOMATIC_CR_ON_LF_ENABLED 0
NRF_LOG_BACKEND_RTT_ENABLED 1
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;3. Select the debug configuration to prevent the hardfault handler from performing a system reset.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/8780.pastedimage1602244875948v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;4. Optional: disable &amp;#39;hardfault&amp;#39; breakpoint to prevent the debugger from halting inside the MBR&amp;#39;s hardfault handler at 0xa60. Alternatively, you can press the &amp;quot;play&amp;quot; button to continue execution from this address.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/5008.pastedimage1602245091776v2.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Application Code hangs after SUCCESSFULLY sending notification to central</title><link>https://devzone.nordicsemi.com/thread/273873?ContentTypeID=1</link><pubDate>Thu, 08 Oct 2020 20:56:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ebb91f99-f2bc-42fc-b292-84f179b3c439</guid><dc:creator>patjshan</dc:creator><description>&lt;p&gt;Another new development: if I change the characteristic back to being indicatable instead of notifiable, then everything works out fine. It seems also that when the characteristic was notifiable the sd_ble_gatt_hvx call was not raising the HVX_TX_Complete ble event, but again the err_code from the call is successful so i don&amp;#39;t know what the problem is&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Application Code hangs after SUCCESSFULLY sending notification to central</title><link>https://devzone.nordicsemi.com/thread/273860?ContentTypeID=1</link><pubDate>Thu, 08 Oct 2020 18:04:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:18198a67-7664-46e6-80a5-7f578346aa14</guid><dc:creator>patjshan</dc:creator><description>&lt;p&gt;Another interesting point: there is another service that I use in this application that also has notifications, and those go off without a hitch. i&amp;#39;m assuming this means I should be looking at the profile setup where i am configure the characteristic and adding it to the service but so far i don&amp;#39;t see anything strange there&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>