<?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>SDK V12.2.0 sleep mode issue</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/46130/sdk-v12-2-0-sleep-mode-issue</link><description>We have written an application based on SDK V12.2.0 using S132_V3.1.0 for the nRF52832 and have been dealing with an issue where the module constantly enters a hardfault. Unfortunately debugging is not an option as the problem seems to be resolved when</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 16 Apr 2019 07:07:58 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/46130/sdk-v12-2-0-sleep-mode-issue" /><item><title>RE: SDK V12.2.0 sleep mode issue</title><link>https://devzone.nordicsemi.com/thread/182249?ContentTypeID=1</link><pubDate>Tue, 16 Apr 2019 07:07:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e9ecfb5b-a9fe-47bb-a679-ac89153934ae</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;I talked to my colleagues on the matter, and there has been an issue in very old SDKs where MWU violations won&amp;#39;t be handled while an application is in a critical section, and causes this hard fault.&lt;/p&gt;
&lt;p&gt;The fix should be to replace __NRF_NVIC_SD_IRQS_1 with the following in nrf_nvic.h, and recompile the application:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#define __NRF_NVIC_SD_IRQS_1 ((uint32_t)(1U &amp;lt;&amp;lt; (MWU_IRQn - 32)))&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;This will cause the MWU handler to not be masked by the critical section, and thus be run at the correct time.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SDK V12.2.0 sleep mode issue</title><link>https://devzone.nordicsemi.com/thread/182018?ContentTypeID=1</link><pubDate>Mon, 15 Apr 2019 08:30:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:263f3f04-0893-4bfa-be48-1ffb2d1ac835</guid><dc:creator>pimvds</dc:creator><description>&lt;p&gt;Hello Simon,&lt;/p&gt;
&lt;p&gt;Thank you for the reply. Let me clarify that it is not an interval timer we&amp;#39;re using, but it is the interval on which the softdevice repeats a scan as defined by the scan parameters handed to the softdevice when starting scanning for peripherals.&lt;/p&gt;
&lt;p&gt;See the following segment where we initialize the softdevice:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static void ble_stack_init(void)
{
    uint32_t err_code = NRF_SUCCESS;
    nrf_clock_lf_cfg_t clock_lf_cfg = NRF_CLOCK_LFCLKSRC;
    
	/*Disable softdevice to delete any registered services,
    only a limited amount of services can be registered*/
    err_code = sd_softdevice_disable();
    APP_ERROR_CHECK(err_code);
    
	//Initialize the SoftDevice handler module.
    SOFTDEVICE_HANDLER_INIT(&amp;amp;clock_lf_cfg, NULL);
    ble_enable_params_t ble_enable_params;

    err_code = softdevice_enable_get_default_config(CENTRAL_LINK_COUNT,
													PERIPHERAL_LINK_COUNT,
													&amp;amp;ble_enable_params);
    APP_ERROR_CHECK(err_code);
    
	// Use the max config: 8 central, 0 periph, 10 VS UUID
    ble_enable_params.common_enable_params.vs_uuid_count = 10;
	
	//Check the ram settings against the used number of links
    CHECK_RAM_START_ADDR(CENTRAL_LINK_COUNT,PERIPHERAL_LINK_COUNT);
    
	//Enable BLE stack.
#if (NRF_SD_BLE_API_VERSION == 3)
    ble_enable_params.gatt_enable_params.att_mtu = NRF_BLE_MAX_MTU_SIZE;
#endif
    err_code = softdevice_enable(&amp;amp;ble_enable_params);
    APP_ERROR_CHECK(err_code);
    
	//Register with the SoftDevice handler module for BLE events.
    err_code = softdevice_ble_evt_handler_set(ble_evt_dispatch);
    APP_ERROR_CHECK(err_code);
	
	// Register with the SoftDevice handler module for BLE events.
    err_code = softdevice_sys_evt_handler_set(sys_evt_dispatch);
    APP_ERROR_CHECK(err_code);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;As for the&amp;nbsp;&lt;span&gt;app_error_check, we do include that with our call to&amp;nbsp;sd_app_evt_wait. The problem however occurs before&amp;nbsp;sd_app_evt_wait returns, either in interrupt context or within the softdevice itself.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;With kind regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Pim&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SDK V12.2.0 sleep mode issue</title><link>https://devzone.nordicsemi.com/thread/181992?ContentTypeID=1</link><pubDate>Mon, 15 Apr 2019 07:18:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:240bbc0b-5a44-4bbb-8d27-3b378a75f07f</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;Due to the Easter holiday you will have to expect a delay in replies, sorry for the inconvenience!&lt;/p&gt;
&lt;p&gt;Could you try adding an app_error_check, to see what values the interval timer function and sd_app_evt_wait returns? Only reason I see to why sd_app_evt_wait should cause a hard fault would be that the SoftDevice isn&amp;#39;t&amp;nbsp;initialized properly. How do you initialize the SoftDevice?&lt;/p&gt;
&lt;p&gt;Sidenote: SDK12.2 and S132_v3.1 are old, and you should consider updating both to a more recent update.&lt;/p&gt;
&lt;p&gt;Best regards and happy Easter,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>