<?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>HardFault on sd_ble_gap_adv_stop()</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/48504/hardfault-on-sd_ble_gap_adv_stop</link><description>Hi, 
 I&amp;#39;m getting a Hardfault MemManage (IPSR 003) when calling sd_ble_gap_adv_stop(). The advertising handle I&amp;#39;m passing is 0. This is called after the advertising has started using the ble_advertising library. That takes care of calling sd_ble_gap_adv_set_configure</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 12 Jun 2019 14:00:30 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/48504/hardfault-on-sd_ble_gap_adv_stop" /><item><title>RE: HardFault on sd_ble_gap_adv_stop()</title><link>https://devzone.nordicsemi.com/thread/192429?ContentTypeID=1</link><pubDate>Wed, 12 Jun 2019 14:00:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:35cb49bd-07b1-47d6-b8ec-dc3047d9a4e1</guid><dc:creator>Andy</dc:creator><description>&lt;p&gt;Nice, thanks again!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HardFault on sd_ble_gap_adv_stop()</title><link>https://devzone.nordicsemi.com/thread/192418?ContentTypeID=1</link><pubDate>Wed, 12 Jun 2019 13:48:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eebaa86e-af5f-472f-8250-bb859ac6e6af</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Sure:)&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The last bits of the PSR register shows the current ISR number (&lt;a href="https://developer.arm.com/docs/ddi0337/e/programmers-model/registers/special-purpose-program-status-registers-xpsr"&gt;ARM doc&lt;/a&gt;):&amp;nbsp; So 0x01000016 corresponds to ISR number 0x16. Then I subtract this number by 16 as the non-programmable interrupts start at minus 15&lt;/p&gt;
&lt;p&gt;0x16 -&amp;gt; 22 - 16 = 6.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Then you can look up ISR number 6 in the nrf52.h/nrf52xx.h header file:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/* =========================================================================================================================== */
/* ================                                Interrupt Number Definition                                ================ */
/* =========================================================================================================================== */

typedef enum {
/* =======================================  ARM Cortex-M4 Specific Interrupt Numbers  ======================================== */
  Reset_IRQn                = -15,              /*!&amp;lt; -15  Reset Vector, invoked on Power up and warm reset                     */
  NonMaskableInt_IRQn       = -14,              /*!&amp;lt; -14  Non maskable Interrupt, cannot be stopped or preempted               */
  HardFault_IRQn            = -13,              /*!&amp;lt; -13  Hard Fault, all classes of Fault                                     */
  MemoryManagement_IRQn     = -12,              /*!&amp;lt; -12  Memory Management, MPU mismatch, including Access Violation
                                                     and No Match                                                              */
  BusFault_IRQn             = -11,              /*!&amp;lt; -11  Bus Fault, Pre-Fetch-, Memory Access Fault, other address/memory
                                                     related Fault                                                             */
  UsageFault_IRQn           = -10,              /*!&amp;lt; -10  Usage Fault, i.e. Undef Instruction, Illegal State Transition        */
  SVCall_IRQn               =  -5,              /*!&amp;lt; -5 System Service Call via SVC instruction                                */
  DebugMonitor_IRQn         =  -4,              /*!&amp;lt; -4 Debug Monitor                                                          */
  PendSV_IRQn               =  -2,              /*!&amp;lt; -2 Pendable request for system service                                    */
  SysTick_IRQn              =  -1,              /*!&amp;lt; -1 System Tick Timer                                                      */
/* ===========================================  nrf52 Specific Interrupt Numbers  ============================================ */
  POWER_CLOCK_IRQn          =   0,              /*!&amp;lt; 0  POWER_CLOCK                                                            */
  RADIO_IRQn                =   1,              /*!&amp;lt; 1  RADIO                                                                  */
  UARTE0_UART0_IRQn         =   2,              /*!&amp;lt; 2  UARTE0_UART0                                                           */
  SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQn=   3,  /*!&amp;lt; 3  SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0                                      */
  SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQn=   4,  /*!&amp;lt; 4  SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1                                      */
  NFCT_IRQn                 =   5,              /*!&amp;lt; 5  NFCT                                                                   */
  GPIOTE_IRQn               =   6,              /*!&amp;lt; 6  GPIOTE                                                                 */
  SAADC_IRQn                =   7,              /*!&amp;lt; 7  SAADC                                                                  */
  TIMER0_IRQn               =   8,              /*!&amp;lt; 8  TIMER0                                                                 */
  TIMER1_IRQn               =   9,              /*!&amp;lt; 9  TIMER1                                                                 */&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HardFault on sd_ble_gap_adv_stop()</title><link>https://devzone.nordicsemi.com/thread/192411?ContentTypeID=1</link><pubDate>Wed, 12 Jun 2019 13:37:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:03ffd989-930a-4b40-a9df-31b82114de26</guid><dc:creator>Andy</dc:creator><description>&lt;p&gt;Yep, this was it! Thanks again for your help &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Before I verify the answer, could you explain how were you able to tell that the call came from the GPIOTE IRQ handler? How can I use that information in the future?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HardFault on sd_ble_gap_adv_stop()</title><link>https://devzone.nordicsemi.com/thread/192400?ContentTypeID=1</link><pubDate>Wed, 12 Jun 2019 13:15:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dbe00a89-407e-4d98-bce5-22e31f613d69</guid><dc:creator>Andy</dc:creator><description>&lt;p&gt;You&amp;#39;re right! I&amp;#39;ll move the call out of the IRQ and will update in a bit. It sounds very likely that that&amp;#39;s the issue.&lt;/p&gt;
&lt;p&gt;Thanks for your speedy help! That&amp;#39;s a speed record for me :D&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HardFault on sd_ble_gap_adv_stop()</title><link>https://devzone.nordicsemi.com/thread/192396?ContentTypeID=1</link><pubDate>Wed, 12 Jun 2019 13:07:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e02e01c8-5184-4aa5-861a-53a3e2fb1c55</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;It appears to be called from your GPIOTE IRQ handler based on the PSR value. What&amp;#39;s the interrupt priority of this IRQ? I&amp;#39;m wondering if it might be higher than the SV call?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>