<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>MCUXpresso SDKのトピックRe: Watchdog refresh not working</title>
    <link>https://community.nxp.com/t5/MCUXpresso-SDK/Watchdog-refresh-not-working/m-p/1220989#M3031</link>
    <description>&lt;P&gt;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/167559"&gt;@Alexis_A&lt;/a&gt;&amp;nbsp;thanks for helping!&lt;/P&gt;&lt;P&gt;The wdog example seems to be working but is confusing.&lt;/P&gt;&lt;P&gt;It seems that the example is performing three tests. The first test is&amp;nbsp;&lt;STRONG&gt;&lt;FONT color="#0000FF"&gt;if (wdog_reset_count == 0)&lt;/FONT&gt;.&lt;/STRONG&gt;&amp;nbsp;The second test is&amp;nbsp;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;else if (wdog_reset_count == 1)&lt;/STRONG&gt;&lt;/FONT&gt;. The third test is&amp;nbsp;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;else&lt;/STRONG&gt; &lt;STRONG&gt;if (wdog_reset_count == 2)&lt;/STRONG&gt;&lt;/FONT&gt;.&lt;/P&gt;&lt;P&gt;I don't need those tests and it is not clear to me what piece of code to use as a reference for what I need. The only thing I need is to be able to do this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;while (1)
{
    WDOG_Refresh(WATCHDOG_PERIPHERAL);
    PRINTF ("i = %lu\n", (uint32_t)i);
    i++;
    /* 'Dummy' NOP to allow source level single stepping of tight while() loop */
    __asm volatile ("nop");
}&lt;/LI-CODE&gt;&lt;P&gt;Inside main and keep the processor from getting reset by the watchdog.&lt;/P&gt;&lt;P&gt;What makes the example more confusing is that it is not using the peripheral config tool for configuring the wdog as I am and the only similar thing I can identify the example is doing is what it is on the second test which is&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;    else if (wdog_reset_count == 1)
    {
        PRINTF("--- Quick test done ---\r\n");
    /*
     * config.enableWdog = true;
     * config.clockSource = kWDOG_LpoClockSource;
     * config.prescaler = kWDOG_ClockPrescalerDivide1;
     * config.enableUpdate = true;
     * config.enableInterrupt = false;
     * config.enableWindowMode = false;
     * config.windowValue = 0U;
     * config.timeoutValue = 0xFFFFU;
     */
        WDOG_GetDefaultConfig(&amp;amp;config);
        config.timeoutValue = 0x7ffU;
        /* wdog refresh test in none-window mode */
        PRINTF("\r\n--- None-window mode refresh test start---\r\n");
        WDOG_Init(wdog_base, &amp;amp;config);
        WaitWctClose(wdog_base);
        for (uint32_t i = 0; i &amp;lt; 10; i++)
        {
            WDOG_Refresh(wdog_base);
            PRINTF("--- Refresh wdog %d time ---\r\n", i + 1);

            while (GetTimerOutputValue(wdog_base) &amp;lt; (config.timeoutValue &amp;gt;&amp;gt; 3U))
            {
            }
        }
        /* wait for wdog timeout reset */
        while (1)
        {
        }
    }&lt;/LI-CODE&gt;&lt;P&gt;That piece of code contains the call to &lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;WDOG_Init&lt;/STRONG&gt;&lt;/FONT&gt;&amp;nbsp;that I have in&amp;nbsp;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;BOARD_InitBootPeripherals&lt;/STRONG&gt;&lt;/FONT&gt; generated by the config tool but it is using&amp;nbsp;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;WDOG_GetDefaultConfig&lt;/STRONG&gt;&lt;/FONT&gt; instead of a generated config structure like I have.&lt;/P&gt;&lt;P&gt;Another difference I notice is that the example is calling&amp;nbsp;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;WaitWctClose(wdog_base)&lt;/STRONG&gt;&lt;/FONT&gt; and it is executing this&amp;nbsp;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;while (GetTimerOutputValue(wdog_base) &amp;lt; (config.timeoutValue &amp;gt;&amp;gt; 3U))&lt;/STRONG&gt;&lt;/FONT&gt; right after refreshing the wdog. Do I need to do this as well? Maybe that's the problem, but I'm not sure.&lt;/P&gt;</description>
    <pubDate>Tue, 26 Jan 2021 04:03:13 GMT</pubDate>
    <dc:creator>m4l490n</dc:creator>
    <dc:date>2021-01-26T04:03:13Z</dc:date>
    <item>
      <title>Watchdog refresh not working</title>
      <link>https://community.nxp.com/t5/MCUXpresso-SDK/Watchdog-refresh-not-working/m-p/1218319#M3004</link>
      <description>&lt;P&gt;I'm having problems with the watchdog module. I don't know if it is the configuration or what is really happening. I added the watchdog peripheral driver and I have the following configuration for it:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="m4l490n_0-1611184027155.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/135365i9801CD14CECFAA0B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="m4l490n_0-1611184027155.png" alt="m4l490n_0-1611184027155.png" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;m4l490n_0-1611184027155.png&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The generated code for initializing it looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;const wdog_config_t Watchdog_config = {
  .clockSource = kWDOG_LpoClockSource,
  .prescaler = kWDOG_ClockPrescalerDivide1,
  .timeoutValue = 1000UL,
  .enableWindowMode = false,
  .windowValue = 0UL,
  .enableUpdate = true,
  .enableWdog = true,
  .workMode = {
    .enableWait = true,
    .enableStop = false,
    .enableDebug = false
  }, 
  .enableInterrupt = false
};

static void Watchdog_init(void) {
  /* WDOG peripheral initialization */
  WDOG_Init(WATCHDOG_PERIPHERAL, &amp;amp;Watchdog_config);
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code is executing that initialization correctly.&lt;/P&gt;&lt;P&gt;I have the following in &lt;STRONG&gt;main&lt;/STRONG&gt;:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;int main(void)
{
    if (RCM_GetPreviousResetSources(RCM) &amp;amp; kRCM_SourceWdog)
    {
        while (1);
    }

    /* Init board hardware. */
    BOARD_InitBootPins ();
    BOARD_InitBootClocks ();
    BOARD_InitBootPeripherals ();

#ifndef BOARD_INIT_DEBUG_CONSOLE_PERIPHERAL
    /* Init FSL debug console. */
    BOARD_InitDebugConsole ();
#endif

    PRINTF ("Hello World\n");

    /* Force the counter to be placed into memory. */
    volatile static int i = 0;
    /* Enter an infinite loop, just incrementing a counter. */
    while (1)
    {
        WDOG_Refresh(WATCHDOG_PERIPHERAL);

        i++;
        /* 'Dummy' NOP to allow source level single stepping of
         tight while() loop */
        __asm volatile ("nop");
    }
    return 0;
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I let the code run and put a breakpoint inside the&amp;nbsp;&lt;STRONG&gt;if (RCM_GetPreviousResetSources(RCM) &amp;amp; kRCM_SourceWdog)&lt;/STRONG&gt;&amp;nbsp;then after 1 second, which is my watchdog timeout, the execution hits my breakpoint despite calling&amp;nbsp;&lt;STRONG&gt;WDOG_Refresh(WATCHDOG_PERIPHERAL)&lt;/STRONG&gt;; inside the while loop.&lt;/P&gt;&lt;P&gt;Also, I can verify that the watchdog timed out by looking at the peripheral view:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="m4l490n_1-1611184447312.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/135366i51232A88F6BB139F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="m4l490n_1-1611184447312.png" alt="m4l490n_1-1611184447312.png" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;m4l490n_1-1611184447312.png&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I also noticed that the watchdog value is not changing when running the code. It stays at 0x3e8 (1000) all the time.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="m4l490n_0-1611253956140.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/135467iD74F95BD043CFE79/image-size/medium?v=v2&amp;amp;px=400" role="button" title="m4l490n_0-1611253956140.png" alt="m4l490n_0-1611253956140.png" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;m4l490n_0-1611253956140.png&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;But that doesn't make sense, shouldn't it be decrementing and then resetting the board when it reaches 0? Or does that register only holds the value that the watchdog timer references to?&lt;/P&gt;&lt;P&gt;What am I missing?&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2021 18:35:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-SDK/Watchdog-refresh-not-working/m-p/1218319#M3004</guid>
      <dc:creator>m4l490n</dc:creator>
      <dc:date>2021-01-21T18:35:58Z</dc:date>
    </item>
    <item>
      <title>Re: Watchdog refresh not working</title>
      <link>https://community.nxp.com/t5/MCUXpresso-SDK/Watchdog-refresh-not-working/m-p/1220962#M3029</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/55936"&gt;@m4l490n&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;Only to check the module functionality, could you try the SDK example to check if this works correctly?&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Alexis_A_0-1611630802928.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/135775i0BECD66497ACFC0D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Alexis_A_0-1611630802928.png" alt="Alexis_A_0-1611630802928.png" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Alexis_A_0-1611630802928.png&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Alexis Andalon&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jan 2021 03:13:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-SDK/Watchdog-refresh-not-working/m-p/1220962#M3029</guid>
      <dc:creator>Alexis_A</dc:creator>
      <dc:date>2021-01-26T03:13:36Z</dc:date>
    </item>
    <item>
      <title>Re: Watchdog refresh not working</title>
      <link>https://community.nxp.com/t5/MCUXpresso-SDK/Watchdog-refresh-not-working/m-p/1220989#M3031</link>
      <description>&lt;P&gt;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/167559"&gt;@Alexis_A&lt;/a&gt;&amp;nbsp;thanks for helping!&lt;/P&gt;&lt;P&gt;The wdog example seems to be working but is confusing.&lt;/P&gt;&lt;P&gt;It seems that the example is performing three tests. The first test is&amp;nbsp;&lt;STRONG&gt;&lt;FONT color="#0000FF"&gt;if (wdog_reset_count == 0)&lt;/FONT&gt;.&lt;/STRONG&gt;&amp;nbsp;The second test is&amp;nbsp;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;else if (wdog_reset_count == 1)&lt;/STRONG&gt;&lt;/FONT&gt;. The third test is&amp;nbsp;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;else&lt;/STRONG&gt; &lt;STRONG&gt;if (wdog_reset_count == 2)&lt;/STRONG&gt;&lt;/FONT&gt;.&lt;/P&gt;&lt;P&gt;I don't need those tests and it is not clear to me what piece of code to use as a reference for what I need. The only thing I need is to be able to do this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;while (1)
{
    WDOG_Refresh(WATCHDOG_PERIPHERAL);
    PRINTF ("i = %lu\n", (uint32_t)i);
    i++;
    /* 'Dummy' NOP to allow source level single stepping of tight while() loop */
    __asm volatile ("nop");
}&lt;/LI-CODE&gt;&lt;P&gt;Inside main and keep the processor from getting reset by the watchdog.&lt;/P&gt;&lt;P&gt;What makes the example more confusing is that it is not using the peripheral config tool for configuring the wdog as I am and the only similar thing I can identify the example is doing is what it is on the second test which is&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;    else if (wdog_reset_count == 1)
    {
        PRINTF("--- Quick test done ---\r\n");
    /*
     * config.enableWdog = true;
     * config.clockSource = kWDOG_LpoClockSource;
     * config.prescaler = kWDOG_ClockPrescalerDivide1;
     * config.enableUpdate = true;
     * config.enableInterrupt = false;
     * config.enableWindowMode = false;
     * config.windowValue = 0U;
     * config.timeoutValue = 0xFFFFU;
     */
        WDOG_GetDefaultConfig(&amp;amp;config);
        config.timeoutValue = 0x7ffU;
        /* wdog refresh test in none-window mode */
        PRINTF("\r\n--- None-window mode refresh test start---\r\n");
        WDOG_Init(wdog_base, &amp;amp;config);
        WaitWctClose(wdog_base);
        for (uint32_t i = 0; i &amp;lt; 10; i++)
        {
            WDOG_Refresh(wdog_base);
            PRINTF("--- Refresh wdog %d time ---\r\n", i + 1);

            while (GetTimerOutputValue(wdog_base) &amp;lt; (config.timeoutValue &amp;gt;&amp;gt; 3U))
            {
            }
        }
        /* wait for wdog timeout reset */
        while (1)
        {
        }
    }&lt;/LI-CODE&gt;&lt;P&gt;That piece of code contains the call to &lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;WDOG_Init&lt;/STRONG&gt;&lt;/FONT&gt;&amp;nbsp;that I have in&amp;nbsp;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;BOARD_InitBootPeripherals&lt;/STRONG&gt;&lt;/FONT&gt; generated by the config tool but it is using&amp;nbsp;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;WDOG_GetDefaultConfig&lt;/STRONG&gt;&lt;/FONT&gt; instead of a generated config structure like I have.&lt;/P&gt;&lt;P&gt;Another difference I notice is that the example is calling&amp;nbsp;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;WaitWctClose(wdog_base)&lt;/STRONG&gt;&lt;/FONT&gt; and it is executing this&amp;nbsp;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;while (GetTimerOutputValue(wdog_base) &amp;lt; (config.timeoutValue &amp;gt;&amp;gt; 3U))&lt;/STRONG&gt;&lt;/FONT&gt; right after refreshing the wdog. Do I need to do this as well? Maybe that's the problem, but I'm not sure.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jan 2021 04:03:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-SDK/Watchdog-refresh-not-working/m-p/1220989#M3031</guid>
      <dc:creator>m4l490n</dc:creator>
      <dc:date>2021-01-26T04:03:13Z</dc:date>
    </item>
    <item>
      <title>Re: Watchdog refresh not working</title>
      <link>https://community.nxp.com/t5/MCUXpresso-SDK/Watchdog-refresh-not-working/m-p/1222926#M3042</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/55936"&gt;@m4l490n&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;Have you tried using the&amp;nbsp;WaitWctClose(wdog_base) before doing the refresh?&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Alexis Andalon&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jan 2021 00:20:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-SDK/Watchdog-refresh-not-working/m-p/1222926#M3042</guid>
      <dc:creator>Alexis_A</dc:creator>
      <dc:date>2021-01-29T00:20:22Z</dc:date>
    </item>
    <item>
      <title>Re: Watchdog refresh not working</title>
      <link>https://community.nxp.com/t5/MCUXpresso-SDK/Watchdog-refresh-not-working/m-p/1223010#M3043</link>
      <description>&lt;P&gt;I already solved this, but actually, that sounds better than what I did. The problem is that I can't find that function.&lt;/P&gt;&lt;P&gt;Where is it?&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jan 2021 03:34:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-SDK/Watchdog-refresh-not-working/m-p/1223010#M3043</guid>
      <dc:creator>m4l490n</dc:creator>
      <dc:date>2021-01-29T03:34:38Z</dc:date>
    </item>
    <item>
      <title>Re: Watchdog refresh not working</title>
      <link>https://community.nxp.com/t5/MCUXpresso-SDK/Watchdog-refresh-not-working/m-p/1223511#M3045</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/55936"&gt;@m4l490n&lt;/a&gt;,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can found this API in the wdog example.&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Alexis Andalon&lt;/P&gt;</description>
      <pubDate>Sat, 30 Jan 2021 00:54:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-SDK/Watchdog-refresh-not-working/m-p/1223511#M3045</guid>
      <dc:creator>Alexis_A</dc:creator>
      <dc:date>2021-01-30T00:54:20Z</dc:date>
    </item>
  </channel>
</rss>

