<?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>S32KのトピックRe: Infinite Wait for Watchdog Reconfiguration Success (RCS) Bit</title>
    <link>https://community.nxp.com/t5/S32K/Infinite-Wait-for-Watchdog-Reconfiguration-Success-RCS-Bit/m-p/880240#M4054</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I now see that my watchdog disable function is&amp;nbsp;unnecessary if DISABLE_WDOG is defined, that is good to know.&amp;nbsp; This also explains why the watchdog control and status (CS) register did not have its reset value loaded when I was setting the register, it had already been changed earlier in the SystemInit() function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To be clear this problem, my code hanging waiting for the watchdog CS register RCS bit to be set after&amp;nbsp;reconfiguring the watchdog, is intermittent.&amp;nbsp; I do not know the steps to reproduce on demand.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I still wonder if its somehow related to interactions between the&amp;nbsp;Design Studio IDE&amp;nbsp;and the PE Micro Multilink debugger.&amp;nbsp; When I arrived this morning and plugged in the debugger and started a debug session I found that the device hanged in the same spot as mentioned above.&amp;nbsp; It looks like the watchdog will not unlock after it is disabled in&amp;nbsp;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;SystemInit() code.&amp;nbsp; Any attempt to unlock or reconfigure and wait for the associated bit to indicate success will hang.&amp;nbsp; When in this state I can reprogram the S32K148 with new code and get the same result.&amp;nbsp; Only a power cycle will get the device out of this state.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;Do you have any suggestions on what information I could gather with the IDE when/if I can get the device watchdog in this state again?&amp;nbsp; I will try to put together a stripped down test project that exhibits the same behaviour and send it your way.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 17 Jan 2019 15:02:51 GMT</pubDate>
    <dc:creator>stephandewit1</dc:creator>
    <dc:date>2019-01-17T15:02:51Z</dc:date>
    <item>
      <title>Infinite Wait for Watchdog Reconfiguration Success (RCS) Bit</title>
      <link>https://community.nxp.com/t5/S32K/Infinite-Wait-for-Watchdog-Reconfiguration-Success-RCS-Bit/m-p/880238#M4052</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have noticed on my S32K148 MCU that the watchdog timer is not being consistently configured when I am running through the debugger.&amp;nbsp; I have never seen this problem when&amp;nbsp;running without the debugger.&amp;nbsp; The code in question is below.&amp;nbsp; This is the first code executed during device startup.&amp;nbsp; I want to disable the watchdog before initializing various peripherals.&amp;nbsp; Then when reaching the main loop the watchdog is then enabled.&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;/**&lt;BR /&gt; * Disable the watchdog timer.&lt;BR /&gt; */&lt;BR /&gt;void watchdog_Disable(void)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp; &amp;nbsp;DISABLE_INTERRUPTS();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;// The Unlock write is only required when CS_ULK == 0&lt;BR /&gt;&amp;nbsp; &amp;nbsp;// Out of reset CS_ULK == 1 making the Unlock write not necessary&lt;BR /&gt;&amp;nbsp; &amp;nbsp;if (((WDOG-&amp;gt;CS &amp;amp; WDOG_CS_ULK_MASK) &amp;gt;&amp;gt; WDOG_CS_ULK_SHIFT) == 0U)&lt;BR /&gt;&amp;nbsp; &amp;nbsp;{&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; // Unlock watchdog&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; WDOG-&amp;gt;CNT = 0xD928C520;&lt;BR /&gt; &lt;SPAN style="background-color: #f6f6f6;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;// wait until unlocked, CS_ULK == 1&lt;BR /&gt; &lt;SPAN style="background-color: #f6f6f6;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;while (((WDOG-&amp;gt;CS &amp;amp; WDOG_CS_ULK_MASK) &amp;gt;&amp;gt; WDOG_CS_ULK_SHIFT) == 0U);&lt;BR /&gt; &lt;SPAN style="background-color: #f6f6f6;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;// Maximum timeout value&lt;BR /&gt; &lt;SPAN style="background-color: #f6f6f6;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;WDOG-&amp;gt;TOVAL = 0x0000FFFF;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;// Disable watchdog&lt;BR /&gt; &lt;SPAN style="background-color: #f6f6f6;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;// CMD32EN = 1 : Enables support for 32-bit refresh/unlock command write words.&lt;BR /&gt; &lt;SPAN style="background-color: #f6f6f6;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;// CLK = 1 : LPO clock&lt;BR /&gt; &lt;SPAN style="background-color: #f6f6f6;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;// EN = 0 : Watchdog disabled.&lt;BR /&gt; &lt;SPAN style="background-color: #f6f6f6;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;// UPDATE = 1 : Updates allowed. Software can modify the watchdog configuration registers within 128 bus &lt;SPAN style="background-color: #f6f6f6;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;clocks after performing the unlock write sequence.&lt;BR /&gt; &lt;SPAN style="background-color: #f6f6f6;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;WDOG-&amp;gt;CS = WDOG_CS_CMD32EN(1) | WDOG_CS_CLK(1) | WDOG_CS_EN(0) | WDOG_CS_UPDATE(1);&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;// wait until new configuration takes effect, CS_RCS == 1&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;SPAN style="background-color: #f6f6f6;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;while (((WDOG-&amp;gt;CS &amp;amp; WDOG_CS_RCS_MASK) &amp;gt;&amp;gt; WDOG_CS_RCS_SHIFT) == 0U);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;ENABLE_INTERRUPTS();&lt;BR /&gt;}&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;The device hangs on &lt;SPAN style="background-color: #f6f6f6;"&gt;while (((WDOG-&amp;gt;CS &amp;amp; WDOG_CS_RCS_MASK) &amp;gt;&amp;gt; WDOG_CS_RCS_SHIFT) == 0U);&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;near the bottom of the function. It appears that the RCS bit never gets set and this seems to happen because the device is still locked.&amp;nbsp; However the check above should ensure that the device is unlocked before trying to write to the watchdog control and status (CS) register. Below is a capture of the watchdog registers when the device hangs.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_3.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/62844i6F58B41515A66338/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_3.png" alt="pastedImage_3.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;S32DS debugger&amp;nbsp;when device hangs.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_4.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/62941iDB736ACB9DB631D0/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_4.png" alt="pastedImage_4.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This does not happen consistently and I cannot reproduce this problem on demand.&amp;nbsp; When this problem does occur power cycling the MCU and starting a fresh debug session clears the problem.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Is there something wrong with my watchdog disable function?&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;Am I running into a timing problem or race condition with the watchdog?&lt;/LI&gt;&lt;LI&gt;Is there a known issue configuring the watchdog while debugging?&amp;nbsp;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Any thoughts help is appreciated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Jan 2019 19:28:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/Infinite-Wait-for-Watchdog-Reconfiguration-Success-RCS-Bit/m-p/880238#M4052</guid>
      <dc:creator>stephandewit1</dc:creator>
      <dc:date>2019-01-16T19:28:26Z</dc:date>
    </item>
    <item>
      <title>Re: Infinite Wait for Watchdog Reconfiguration Success (RCS) Bit</title>
      <link>https://community.nxp.com/t5/S32K/Infinite-Wait-for-Watchdog-Reconfiguration-Success-RCS-Bit/m-p/880239#M4053</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Stephan,&lt;/P&gt;&lt;P&gt;I'm unable to reproduce this behavior with your code.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you send a test project?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nevertheless, the default S32K1xx startup code in S32 Design Studio disables the WDOG.&lt;/P&gt;&lt;P&gt;SystemInit() funtion,&amp;nbsp;system_S32K148.c.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/63901i86DA94B60E3D1F40/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;This code is enough to disable the WDOG and allow subsequent updates in main().&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Jan 2019 11:20:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/Infinite-Wait-for-Watchdog-Reconfiguration-Success-RCS-Bit/m-p/880239#M4053</guid>
      <dc:creator>danielmartynek</dc:creator>
      <dc:date>2019-01-17T11:20:32Z</dc:date>
    </item>
    <item>
      <title>Re: Infinite Wait for Watchdog Reconfiguration Success (RCS) Bit</title>
      <link>https://community.nxp.com/t5/S32K/Infinite-Wait-for-Watchdog-Reconfiguration-Success-RCS-Bit/m-p/880240#M4054</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I now see that my watchdog disable function is&amp;nbsp;unnecessary if DISABLE_WDOG is defined, that is good to know.&amp;nbsp; This also explains why the watchdog control and status (CS) register did not have its reset value loaded when I was setting the register, it had already been changed earlier in the SystemInit() function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To be clear this problem, my code hanging waiting for the watchdog CS register RCS bit to be set after&amp;nbsp;reconfiguring the watchdog, is intermittent.&amp;nbsp; I do not know the steps to reproduce on demand.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I still wonder if its somehow related to interactions between the&amp;nbsp;Design Studio IDE&amp;nbsp;and the PE Micro Multilink debugger.&amp;nbsp; When I arrived this morning and plugged in the debugger and started a debug session I found that the device hanged in the same spot as mentioned above.&amp;nbsp; It looks like the watchdog will not unlock after it is disabled in&amp;nbsp;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;SystemInit() code.&amp;nbsp; Any attempt to unlock or reconfigure and wait for the associated bit to indicate success will hang.&amp;nbsp; When in this state I can reprogram the S32K148 with new code and get the same result.&amp;nbsp; Only a power cycle will get the device out of this state.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;Do you have any suggestions on what information I could gather with the IDE when/if I can get the device watchdog in this state again?&amp;nbsp; I will try to put together a stripped down test project that exhibits the same behaviour and send it your way.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Jan 2019 15:02:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/Infinite-Wait-for-Watchdog-Reconfiguration-Success-RCS-Bit/m-p/880240#M4054</guid>
      <dc:creator>stephandewit1</dc:creator>
      <dc:date>2019-01-17T15:02:51Z</dc:date>
    </item>
    <item>
      <title>Re: Infinite Wait for Watchdog Reconfiguration Success (RCS) Bit</title>
      <link>https://community.nxp.com/t5/S32K/Infinite-Wait-for-Watchdog-Reconfiguration-Success-RCS-Bit/m-p/880241#M4055</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV style="color: #060628; background-color: #ededf1;"&gt;The problems&amp;nbsp;I was having configuring the watchdog are related to its clock source being disabled in a different part of the code.&amp;nbsp; This LPO disable is not cleared by a reset.&lt;/DIV&gt;&lt;DIV style="color: #060628; background-color: #ededf1;"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV style="color: #060628; background-color: #ededf1;"&gt;To save power consumption when sleeping the Low Power Oscillator (LPO) is disabled just before sleeping (or Very Low Power Stop (VLPS)) and enabled during wake-up.&amp;nbsp; The watchdog is clocked by the LPO.&amp;nbsp; However there was an error in how the LPO was enabled leaving the it permanently disabled after the first sleep cycle.&lt;/DIV&gt;&lt;DIV style="color: #060628; background-color: #ededf1;"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV style="color: #060628; background-color: #ededf1;"&gt;As per the reference manual below the Power Management Controller (PMC) LPO disable (LPODIS) is *only*&amp;nbsp;cleared on a power on reset (see note 1. below).&amp;nbsp; This left the watchdog disabled between resets, even resets from the debugger.&amp;nbsp; This explains why&amp;nbsp;power on resets were the only way to resolve the problem.&lt;/DIV&gt;&lt;DIV style="color: #060628; background-color: #ededf1;"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV style="color: #060628; background-color: #ededf1;"&gt;From Reference Manual Power Management Controller (PMC)&lt;/DIV&gt;&lt;DIV style="color: #060628; background-color: #ededf1;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/77186iEE3D98B6064AB13E/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/DIV&gt;&lt;DIV style="color: #060628; background-color: #ededf1;"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV style="color: #060628; background-color: #ededf1;"&gt;Another take away from this self made bug is that enabling the watchdog and waiting for its Reconfiguration Success (RCS) bit will not work when the watchdog clock has been disabled.&amp;nbsp; Makes sense but was not obvious at first.&lt;/DIV&gt;&lt;DIV style="color: #060628; background-color: #ededf1;"&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Jan 2019 14:49:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/Infinite-Wait-for-Watchdog-Reconfiguration-Success-RCS-Bit/m-p/880241#M4055</guid>
      <dc:creator>stephandewit1</dc:creator>
      <dc:date>2019-01-25T14:49:26Z</dc:date>
    </item>
  </channel>
</rss>

