<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://test-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>FreeRTOS+WDT+SDK17 problem</title><link>https://test-devzone.nordicsemi.com/f/nordic-q-a/63998/freertos-wdt-sdk17-problem</link><description>I have added WDT to the blinky_freertos sample. 
 
 And I am debugging with SEGGER ozone. 
 building with SDK17: 
 If you reset the software in the debugger and start it, the application freezes. t stops in the following loop. And RTC1 is not counting</description><dc:language>en-US</dc:language><generator>Telligent Community 13 Non-Production</generator><lastBuildDate>Tue, 24 May 2022 00:11:38 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://test-devzone.nordicsemi.com/f/nordic-q-a/63998/freertos-wdt-sdk17-problem" /><item><title>RE: FreeRTOS+WDT+SDK17 problem</title><link>https://test-devzone.nordicsemi.com/thread/369131?ContentTypeID=1</link><pubDate>Tue, 24 May 2022 00:11:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:18f453b1-256f-46fe-8615-fe0524887a7d</guid><dc:creator>user86158</dc:creator><description>[quote userid="6207" url="~/f/nordic-q-a/63998/freertos-wdt-sdk17-problem/263131#263131"]Thanks for letting us know. For your reference, our internal bug tracking number is&amp;nbsp;NRFFOETT-2516[/quote]
&lt;p&gt;Has this bug been fixed -- it still seems to be there in SDK 17.1.0&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FreeRTOS+WDT+SDK17 problem</title><link>https://test-devzone.nordicsemi.com/thread/367708?ContentTypeID=1</link><pubDate>Thu, 12 May 2022 17:37:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ed8cf05d-1cc8-477f-a30f-8edb64f1ca7d</guid><dc:creator>user86158</dc:creator><description>&lt;p&gt;I am continuing to see this &amp;#39;bug&amp;#39; in SDK v17.1.0.&lt;/p&gt;
&lt;p&gt;What is the ETA for a fix?&lt;/p&gt;
&lt;p&gt;One more comment:&lt;/p&gt;
&lt;p&gt;The condition &amp;quot;&amp;nbsp;if (nrf_wdt_started())&amp;quot; will only ever be true IF, and only IF, the bit &amp;#39;RUNSTATUS&amp;#39; in the WDT status register is actually a &amp;#39;1&amp;#39;. &lt;br /&gt;So then, why does this bit read back as a &amp;#39;1&amp;#39; BEFORE the firmware initializes the WDT module?&lt;br /&gt;I do not see a #define in the &amp;#39;sdk_config.h&amp;#39; as influencing the behavior of the pre-compiled SoftDevice or MBR so it is not clear to me what is setting this bit to a &amp;#39;1&amp;#39; after the SoC goes through a power up reset.&lt;/p&gt;
&lt;p&gt;RVM&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FreeRTOS+WDT+SDK17 problem</title><link>https://test-devzone.nordicsemi.com/thread/263266?ContentTypeID=1</link><pubDate>Wed, 05 Aug 2020 14:10:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3c6fbf86-3906-4b8d-adbc-9fa31e1f4e26</guid><dc:creator>user17468</dc:creator><description>&lt;p&gt;OK.Thanks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FreeRTOS+WDT+SDK17 problem</title><link>https://test-devzone.nordicsemi.com/thread/263131?ContentTypeID=1</link><pubDate>Wed, 05 Aug 2020 08:14:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e5177966-cf25-4ef2-91d9-cf9615746ab2</guid><dc:creator>user6207</dc:creator><description>&lt;p&gt;Wow, Thanks for such a clear description.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The below line is a bug and should not be there.&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;    if (nrf_wdt_started())
    {
        m_clock_cb.lfclk_on = true;
    }&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I will create a bug report internally to let the team know about this.&lt;/p&gt;
&lt;p&gt;Thanks for letting us know. For your reference, our internal bug tracking number is&amp;nbsp;NRFFOETT-2516&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FreeRTOS+WDT+SDK17 problem</title><link>https://test-devzone.nordicsemi.com/thread/263060?ContentTypeID=1</link><pubDate>Tue, 04 Aug 2020 15:06:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d91138ec-a85e-4210-96cd-21961ebdaef9</guid><dc:creator>user17468</dc:creator><description>&lt;p&gt;Target board is PCA10056(nRF52840).&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;/**
 * Copyright (c) 2015 - 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 blinky_example_main main.c
 * @{
 * @ingroup blinky_example_freertos
 *
 * @brief Blinky FreeRTOS Example Application main file.
 *
 * This file contains the source code for a sample application using FreeRTOS to blink LEDs.
 *
 */

#include &amp;lt;stdbool.h&amp;gt;
#include &amp;lt;stdint.h&amp;gt;

#include &amp;quot;FreeRTOS.h&amp;quot;
#include &amp;quot;task.h&amp;quot;
#include &amp;quot;timers.h&amp;quot;
#include &amp;quot;bsp.h&amp;quot;
#include &amp;quot;nordic_common.h&amp;quot;
#include &amp;quot;nrf_drv_clock.h&amp;quot;
#include &amp;quot;sdk_errors.h&amp;quot;
#include &amp;quot;app_error.h&amp;quot;
#include &amp;quot;nrf_drv_wdt.h&amp;quot;

#define	WDT_ENABLE			1

#if LEDS_NUMBER &amp;lt;= 2
#error &amp;quot;Board is not equipped with enough amount of LEDs&amp;quot;
#endif

#define TASK_DELAY        200           /**&amp;lt; Task delay. Delays a LED0 task for 200 ms */
#define TIMER_PERIOD      1000          /**&amp;lt; Timer period. LED1 timer will expire after 1000 ms */

TaskHandle_t  led_toggle_task_handle;   /**&amp;lt; Reference to LED0 toggling FreeRTOS task. */
TimerHandle_t led_toggle_timer_handle;  /**&amp;lt; Reference to LED1 toggling FreeRTOS timer. */

/**@brief LED0 task entry function.
 *
 * @param[in] pvParameter   Pointer that will be used as the parameter for the task.
 */
static void led_toggle_task_function (void * pvParameter)
{
    UNUSED_PARAMETER(pvParameter);
    while (true)
    {
#if WDT_ENABLE
    	nrf_drv_wdt_feed();
#endif
        bsp_board_led_invert(BSP_BOARD_LED_0);

        /* Delay a task for a given number of ticks */
        vTaskDelay(TASK_DELAY);

        /* Tasks must be implemented to never return... */
    }
}

/**@brief The function to call when the LED1 FreeRTOS timer expires.
 *
 * @param[in] pvParameter   Pointer that will be used as the parameter for the timer.
 */
static void led_toggle_timer_callback (void * pvParameter)
{
    UNUSED_PARAMETER(pvParameter);
    bsp_board_led_invert(BSP_BOARD_LED_1);
}

#if WDT_ENABLE
static nrf_drv_wdt_channel_id m_channel_id;

static void wdt_event_handler(void)
{
}
#endif

static void bsp_evt_handler(bsp_event_t evt)
{
    switch (evt)
    {
        case BSP_EVENT_KEY_0:
    	NVIC_SystemReset(); /* Software Reset */
            break;
    	
    default:
    		break;
    }
}

int main(void)
{
    ret_code_t err_code;

    /* Initialize clock driver for better time accuracy in FREERTOS */
    err_code = nrf_drv_clock_init();
    APP_ERROR_CHECK(err_code);

    /* Configure LED-pins as outputs */
    err_code = bsp_init(BSP_INIT_LEDS | BSP_INIT_BUTTONS, bsp_evt_handler);
    APP_ERROR_CHECK(err_code);

    /* Create task for LED0 blinking with priority set to 2 */
    UNUSED_VARIABLE(xTaskCreate(led_toggle_task_function, &amp;quot;LED0&amp;quot;, configMINIMAL_STACK_SIZE + 200, NULL, 2, &amp;amp;led_toggle_task_handle));

    /* Start timer for LED1 blinking */
    led_toggle_timer_handle = xTimerCreate( &amp;quot;LED1&amp;quot;, TIMER_PERIOD, pdTRUE, NULL, led_toggle_timer_callback);
    UNUSED_VARIABLE(xTimerStart(led_toggle_timer_handle, 0));

    /* Activate deep sleep mode */
    SCB-&amp;gt;SCR |= SCB_SCR_SLEEPDEEP_Msk;

#if WDT_ENABLE
    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();
#endif
	/* Start FreeRTOS scheduler. */
    vTaskStartScheduler();

    while (true)
    {
        /* FreeRTOS should not be here... FreeRTOS goes back to the start of stack
         * in vTaskStartScheduler function. */
    }
}

/**
 *@}
 **/
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;And sdk_config.h modified&lt;br /&gt;#define NRFX_WDT_CONFIG_RELOAD_VALUE 10000&lt;/p&gt;
&lt;p&gt;If #define WDT_ENABLE 1.&amp;nbsp; (WDT enabled)&lt;br /&gt;1. When PoweOnReset, LED is blinking.&lt;br /&gt;2. When Button 1 pushed(execute SoftwareReset), LED blinking is stopped.&lt;br /&gt;3. After 10 seconds, LED blinking is started.&lt;br /&gt;&lt;br /&gt;If #define WDT_ENABLE 0. (WDT disabled)&lt;br /&gt;1. When PoweOnReset, LED is blinking.&lt;br /&gt;2. When Button 1 pushed(execute SoftwareReset), LED blinking is restarted quickly.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FreeRTOS+WDT+SDK17 problem</title><link>https://test-devzone.nordicsemi.com/thread/262982?ContentTypeID=1</link><pubDate>Tue, 04 Aug 2020 11:48:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5f2cfa10-97d6-49e4-b540-51cd4e146593</guid><dc:creator>user6207</dc:creator><description>[quote user="loquat"]&lt;span title=""&gt;The problem is that if a software reset occurs while WtchDog is running, FreeRTOS will not work properly.&lt;/span&gt;&lt;br /&gt;&lt;span title=""&gt;And the cause is that LFCLK is not initialized properly.&lt;/span&gt;[/quote]
&lt;p&gt;i cannot see this behavior in my quick test on the desk. No software resets have happened in my test. Can you please attach your project so that i can test this.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FreeRTOS+WDT+SDK17 problem</title><link>https://test-devzone.nordicsemi.com/thread/262978?ContentTypeID=1</link><pubDate>Tue, 04 Aug 2020 11:43:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7b355afb-2d20-4c50-adcc-bfabe5cd343b</guid><dc:creator>user17468</dc:creator><description>&lt;p&gt;I add feeding the watchdog in led_toggle_task_function.&lt;/p&gt;
&lt;p&gt;&lt;span class="tlid-translation translation" lang="en"&gt;&lt;span class="" title=""&gt;But the problem is not there.&lt;/span&gt;&lt;br /&gt;&lt;span class="" title=""&gt;The problem is that if a software reset occurs while WtchDog is running, FreeRTOS will not work properly.&lt;/span&gt;&lt;br /&gt;&lt;span class="" title=""&gt;And the cause is that LFCLK is not initialized properly.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="tlid-translation translation" lang="en"&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FreeRTOS+WDT+SDK17 problem</title><link>https://test-devzone.nordicsemi.com/thread/262948?ContentTypeID=1</link><pubDate>Tue, 04 Aug 2020 10:11:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3fef68da-3d4f-41b4-9372-8e8014ad5211</guid><dc:creator>user6207</dc:creator><description>&lt;p&gt;Where are you feeding the watchdog? (where is your application calling&amp;nbsp;nrf_drv_wdt_channel_feed?)&lt;/p&gt;
&lt;p&gt;For me it is working fine if i feed the wdt in the&amp;nbsp;bsp_event_callback with a button press. the wdt reset happens if i do not press the button.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FreeRTOS+WDT+SDK17 problem</title><link>https://test-devzone.nordicsemi.com/thread/262938?ContentTypeID=1</link><pubDate>Tue, 04 Aug 2020 09:34:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:768d80cb-0fc8-4659-b4f0-b93e8ed40abb</guid><dc:creator>user6207</dc:creator><description>&lt;p&gt;Syuji,&lt;/p&gt;
&lt;p&gt;Sorry for late response, we started coming back from summer holidays. I will take a look at this problem today, will come back to you soon.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>