<?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>watchdog does not reset when program get stuck in &amp;#39;   NRF_BREAKPOINT_COND; &amp;#39; while in debug mode</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/64781/watchdog-does-not-reset-when-program-get-stuck-in-nrf_breakpoint_cond-while-in-debug-mode</link><description>hello Nordic 
 
 i work with nrf52832, sdk 16, s132. 
 
 I set a watchdog but when i try to create a fault by adding breakpoints after ble starts scanning then i get stuck in the &amp;#39; NRF_BREAKPOINT_COND; &amp;#39; but the watchdog does not restart. 
 can something</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 13 Aug 2020 12:16:30 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/64781/watchdog-does-not-reset-when-program-get-stuck-in-nrf_breakpoint_cond-while-in-debug-mode" /><item><title>RE: watchdog does not reset when program get stuck in '   NRF_BREAKPOINT_COND; ' while in debug mode</title><link>https://devzone.nordicsemi.com/thread/264463?ContentTypeID=1</link><pubDate>Thu, 13 Aug 2020 12:16:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:50c9e527-7eaa-4ff1-b6e6-58a1240812cf</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi Ziv,&lt;/p&gt;
[quote userid="90084" url="~/f/nordic-q-a/64781/watchdog-does-not-reset-when-program-get-stuck-in-nrf_breakpoint_cond-while-in-debug-mode/264460"]so again the question is, could this kind of stuckness accrue while running not in debug mode ??[/quote]
&lt;p&gt;No, this can only occur in debug interface mode. &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: watchdog does not reset when program get stuck in '   NRF_BREAKPOINT_COND; ' while in debug mode</title><link>https://devzone.nordicsemi.com/thread/264460?ContentTypeID=1</link><pubDate>Thu, 13 Aug 2020 12:13:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2c1fcb59-7b12-4dec-8e2c-18d52e92a457</guid><dc:creator>ziv123</dc:creator><description>&lt;p&gt;hi Vidar&amp;nbsp;&lt;/p&gt;
&lt;p&gt;this is exactly what i have done .. i set the WDT to run at SLEEP and HALT&amp;nbsp;&lt;/p&gt;
&lt;p&gt;my observation is that&amp;nbsp;&amp;nbsp;when i stop at a regular breakpoint then it gets stuck there and&amp;nbsp; after i press the continue it restarts but, with the NRF_BREAKPOINT_COND it just get stuck there (my assumption that it has something to do with interrupt priority but i am not sure )&lt;/p&gt;
&lt;p&gt;so again the question is, could this kind of stuckness accrue while running not in debug mode ??&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;best regards&lt;/p&gt;
&lt;p&gt;Ziv&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: watchdog does not reset when program get stuck in '   NRF_BREAKPOINT_COND; ' while in debug mode</title><link>https://devzone.nordicsemi.com/thread/264448?ContentTypeID=1</link><pubDate>Thu, 13 Aug 2020 11:51:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:419850f5-05f2-4024-9098-67ce45a06309</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi Ziv,&lt;/p&gt;
&lt;p&gt;I changed the default config to&amp;nbsp; &amp;quot;Run in SLEEP and HALT&amp;quot; in the WDT example in SDK 17.0.0 and added the NRF_BREAKPOINT_COND, but was not able to replicate the problem. Could you try the same?&lt;/p&gt;
&lt;p&gt;Here&amp;#39;s the code I used:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/**
 * Copyright (c) 2014 - 2020, Nordic Semiconductor ASA
 *
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without modification,
 * are permitted provided that the following conditions are met:
 *
 * 1. Redistributions of source code must retain the above copyright notice, this
 *    list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form, except as embedded into a Nordic
 *    Semiconductor ASA integrated circuit in a product or a software update for
 *    such product, must reproduce the above copyright notice, this list of
 *    conditions and the following disclaimer in the documentation and/or other
 *    materials provided with the distribution.
 *
 * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
 *    contributors may be used to endorse or promote products derived from this
 *    software without specific prior written permission.
 *
 * 4. This software, with or without modification, must only be used with a
 *    Nordic Semiconductor ASA integrated circuit.
 *
 * 5. Any software provided in binary form under this license must not be reverse
 *    engineered, decompiled, modified and/or disassembled.
 *
 * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA &amp;quot;AS IS&amp;quot; AND ANY EXPRESS
 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 */
/** @file
 * @defgroup nrf_dev_wdt_example_main main.c
 * @{
 * @ingroup nrf_dev_wdt_example
 * @brief WDT Example Application main file.
 *
 * This file contains the source code for a sample application using WDT.
 *
 */

#include &amp;lt;stdbool.h&amp;gt;
#include &amp;lt;stdint.h&amp;gt;

#include &amp;quot;nrf.h&amp;quot;
#include &amp;quot;bsp.h&amp;quot;
#include &amp;quot;app_timer.h&amp;quot;
#include &amp;quot;app_error.h&amp;quot;
#include &amp;quot;nrf_drv_wdt.h&amp;quot;
#include &amp;quot;nrf_drv_clock.h&amp;quot;
#include &amp;quot;nrf_delay.h&amp;quot;
#include &amp;quot;app_util_platform.h&amp;quot;

#define FEED_BUTTON_ID          0                           /**&amp;lt; Button for feeding the dog. */

nrf_drv_wdt_channel_id m_channel_id;

/**
 * @brief WDT events handler.
 */
void wdt_event_handler(void)
{
    bsp_board_leds_off();

    //NOTE: The max amount of time we can spend in WDT interrupt is two cycles of 32768[Hz] clock - after that, reset occurs
}

/**
 * @brief Assert callback.
 *
 * @param[in] id    Fault identifier. See @ref NRF_FAULT_IDS.
 * @param[in] pc    The program counter of the instruction that triggered the fault, or 0 if
 *                  unavailable.
 * @param[in] info  Optional additional information regarding the fault. Refer to each fault
 *                  identifier for details.
 */
void app_error_fault_handler(uint32_t id, uint32_t pc, uint32_t info)
{
    bsp_board_leds_off();
    NRF_BREAKPOINT_COND;
    while (1);
}

/**
 * @brief BSP events callback.
 */
void bsp_event_callback(bsp_event_t event)
{
    switch (event)
    {
        case BSP_EVENT_KEY_0:
            nrf_drv_wdt_channel_feed(m_channel_id);
            break;

        default :
            //Do nothing.
            break;
    }
}

/**
 * @brief Function for main application entry.
 */
int main(void)
{
    uint32_t err_code = NRF_SUCCESS;

    //BSP configuration for button support: button pushing will feed the dog.
    err_code = nrf_drv_clock_init();
    APP_ERROR_CHECK(err_code);
    nrf_drv_clock_lfclk_request(NULL);

    err_code = app_timer_init();
    APP_ERROR_CHECK(err_code);

    err_code = bsp_init(BSP_INIT_BUTTONS, bsp_event_callback);
    APP_ERROR_CHECK(err_code);

    //Configure all LEDs on board.
    bsp_board_init(BSP_INIT_LEDS);

    //Configure WDT.
    nrf_drv_wdt_config_t config = NRF_DRV_WDT_DEAFULT_CONFIG;
    err_code = nrf_drv_wdt_init(&amp;amp;config, wdt_event_handler);
    APP_ERROR_CHECK(err_code);
    err_code = nrf_drv_wdt_channel_alloc(&amp;amp;m_channel_id);
    APP_ERROR_CHECK(err_code);
    nrf_drv_wdt_enable();

    //Indicate program start on LEDs.
    for (uint32_t i = 0; i &amp;lt; LEDS_NUMBER; i++)
    {   nrf_delay_ms(200);
        bsp_board_led_on(i);
    }
     err_code = bsp_buttons_enable();
     APP_ERROR_CHECK(1);

    while (1)
    {
        __SEV();
        __WFE();
        __WFE();
    }
}

/** @} */
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: watchdog does not reset when program get stuck in '   NRF_BREAKPOINT_COND; ' while in debug mode</title><link>https://devzone.nordicsemi.com/thread/264374?ContentTypeID=1</link><pubDate>Thu, 13 Aug 2020 07:49:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:073115f8-1912-4226-beaa-b411be155c85</guid><dc:creator>ziv123</dc:creator><description>&lt;p&gt;hi Vidar&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;thanks for your reply&lt;/p&gt;
&lt;p&gt;i know i can configure watch dog to run also when debugging with a breakpoints&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;// &amp;lt;o&amp;gt; WDT_CONFIG_BEHAVIOUR  - WDT behavior in CPU SLEEP or HALT mode
 
// &amp;lt;1=&amp;gt; Run in SLEEP, Pause in HALT 
// &amp;lt;8=&amp;gt; Pause in SLEEP, Run in HALT 
// &amp;lt;9=&amp;gt; Run in SLEEP and HALT 
// &amp;lt;0=&amp;gt; Pause in SLEEP and HALT 

#ifndef WDT_CONFIG_BEHAVIOUR
#define WDT_CONFIG_BEHAVIOUR 9
#endif
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;in the sdk_config file i set the wdt to run at HALT and SLEEP (9), and i see that it does restart when i wait on a breakpoint when ble is not working but when i get to the &amp;#39;&amp;nbsp;&lt;span&gt;NRF_BREAKPOINT_COND &amp;#39;&amp;nbsp; then it does not work, this is why i asked&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;and i guess i am also asking if in real run, when system is NOT in debug mode, can the program ever get to that line &amp;#39;&amp;nbsp;&lt;span&gt;NRF_BREAKPOINT_COND &amp;#39; (with or without a watchdog) ??&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;best regards&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Ziv&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: watchdog does not reset when program get stuck in '   NRF_BREAKPOINT_COND; ' while in debug mode</title><link>https://devzone.nordicsemi.com/thread/264370?ContentTypeID=1</link><pubDate>Thu, 13 Aug 2020 07:37:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:884e1117-92e4-4d6e-bcf8-bc3cbe2f9252</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello Ziv,&lt;/p&gt;
&lt;p&gt;Depending on the configuration, the WDT can be paused when your debugger halts on NRF_BREAKPOINT_COND. This can only happen in debug mode, please check out the register description here for more details: &lt;span&gt;&lt;a title="  CONFIG  " href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/wdt.html?cp=4_2_0_39_3_6#register.CONFIG"&gt;CONFIG &lt;/a&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;The Softdevice does not implement a Watchdog.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>