<?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>topic S32K144 Reconfigure disabled Watchdog in S32K</title>
    <link>https://community.nxp.com/t5/S32K/S32K144-Reconfigure-disabled-Watchdog/m-p/1827817#M32946</link>
    <description>&lt;P&gt;I want to reconfigure the watchdog of the S32K144 after it has been disabled in the startup script. In the startup script there is following section that disables the watchdog:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;/**************************************************************************/
                      /* WDOG DISABLE*/
/**************************************************************************/
  
#if (DISABLE_WDOG)
  /* Write of the WDOG unlock key to CNT register, must be done in order to allow any modifications*/
  WDOG-&amp;gt;CNT = (uint32_t ) FEATURE_WDOG_UNLOCK_VALUE;
  /* The dummy read is used in order to make sure that the WDOG registers will be configured only 
   * after the write of the unlock value was completed. */
  (void)WDOG-&amp;gt;CNT;

  /* Initial write of WDOG configuration register:
   * enables support for 32-bit refresh/unlock command write words,
   * clock select from LPO, update enable, watchdog disabled */
  WDOG-&amp;gt;CS  = (uint32_t ) ( (1UL &amp;lt;&amp;lt; WDOG_CS_CMD32EN_SHIFT)                       |
                            (FEATURE_WDOG_CLK_FROM_LPO &amp;lt;&amp;lt; WDOG_CS_CLK_SHIFT)     |
                            (0U &amp;lt;&amp;lt; WDOG_CS_EN_SHIFT)                             |
                            (1U &amp;lt;&amp;lt; WDOG_CS_UPDATE_SHIFT)                         );
                            
  /* Configure timeout */
  WDOG-&amp;gt;TOVAL = (uint32_t )0xFFFF;
#endif /* (DISABLE_WDOG) */&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If later on i try to reconfigure the watchdog which should be possible because the Allow Updates field of the&amp;nbsp;Watchdog Control and Status Register is set, the watchdog configuration does not change. I use the following code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;    DISABLE_INTERRUPTS()
    WDOG-&amp;gt;CNT = 0xD928C520U; // Unlock watchdog
    while (!(WDOG-&amp;gt;CS &amp;amp; WDOG_CS_ULK_MASK) != 0u)
        ;                           // Wait for wdog to be unlocked
    WDOG-&amp;gt;WIN = 0x0000;
    WDOG-&amp;gt;TOVAL = 50;
    WDOG-&amp;gt;CS |= (WDOG_CS_CLK_MASK &amp;amp; (1 &amp;lt;&amp;lt; WDOG_CS_CLK_SHIFT));
    WDOG-&amp;gt;CS |= WDOG_CS_INT_MASK;
    WDOG-&amp;gt;CS |= WDOG_CS_EN_MASK;
    while (!((WDOG-&amp;gt;CS &amp;amp; WDOG_CS_RCS_MASK) != 0u))
        ; // Wait for config to be changed
    ENABLE_INTERRUPTS()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I enable the watchdog on startup with this code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;  /* Write of the WDOG unlock key to CNT register, must be done in order to allow any modifications*/
  WDOG-&amp;gt;CNT = (uint32_t ) FEATURE_WDOG_UNLOCK_VALUE;
  /* The dummy read is used in order to make sure that the WDOG registers will be configured only 
   * after the write of the unlock value was completed. */
  (void)WDOG-&amp;gt;CNT;

  /* Initial write of WDOG configuration register:
   * enables support for 32-bit refresh/unlock command write words,
   * clock select from LPO, update enable, watchdog disabled */
  WDOG-&amp;gt;CS  = (uint32_t ) ( (1UL &amp;lt;&amp;lt; WDOG_CS_CMD32EN_SHIFT)                       |
                            (FEATURE_WDOG_CLK_FROM_LPO &amp;lt;&amp;lt; WDOG_CS_CLK_SHIFT)     |
                            (1U &amp;lt;&amp;lt; WDOG_CS_EN_SHIFT)                             |
                            (1U &amp;lt;&amp;lt; WDOG_CS_UPDATE_SHIFT)                         );
                            
  /* Configure timeout */
  WDOG-&amp;gt;TOVAL = (uint32_t )0xFFFF;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can reconfigure it later with the same reconfiguration code above. Is reconfiguration only possible when the watchdog is enabled?&lt;/P&gt;</description>
    <pubDate>Thu, 14 Mar 2024 01:06:57 GMT</pubDate>
    <dc:creator>DynamicsNoDriver</dc:creator>
    <dc:date>2024-03-14T01:06:57Z</dc:date>
    <item>
      <title>S32K144 Reconfigure disabled Watchdog</title>
      <link>https://community.nxp.com/t5/S32K/S32K144-Reconfigure-disabled-Watchdog/m-p/1827817#M32946</link>
      <description>&lt;P&gt;I want to reconfigure the watchdog of the S32K144 after it has been disabled in the startup script. In the startup script there is following section that disables the watchdog:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;/**************************************************************************/
                      /* WDOG DISABLE*/
/**************************************************************************/
  
#if (DISABLE_WDOG)
  /* Write of the WDOG unlock key to CNT register, must be done in order to allow any modifications*/
  WDOG-&amp;gt;CNT = (uint32_t ) FEATURE_WDOG_UNLOCK_VALUE;
  /* The dummy read is used in order to make sure that the WDOG registers will be configured only 
   * after the write of the unlock value was completed. */
  (void)WDOG-&amp;gt;CNT;

  /* Initial write of WDOG configuration register:
   * enables support for 32-bit refresh/unlock command write words,
   * clock select from LPO, update enable, watchdog disabled */
  WDOG-&amp;gt;CS  = (uint32_t ) ( (1UL &amp;lt;&amp;lt; WDOG_CS_CMD32EN_SHIFT)                       |
                            (FEATURE_WDOG_CLK_FROM_LPO &amp;lt;&amp;lt; WDOG_CS_CLK_SHIFT)     |
                            (0U &amp;lt;&amp;lt; WDOG_CS_EN_SHIFT)                             |
                            (1U &amp;lt;&amp;lt; WDOG_CS_UPDATE_SHIFT)                         );
                            
  /* Configure timeout */
  WDOG-&amp;gt;TOVAL = (uint32_t )0xFFFF;
#endif /* (DISABLE_WDOG) */&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If later on i try to reconfigure the watchdog which should be possible because the Allow Updates field of the&amp;nbsp;Watchdog Control and Status Register is set, the watchdog configuration does not change. I use the following code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;    DISABLE_INTERRUPTS()
    WDOG-&amp;gt;CNT = 0xD928C520U; // Unlock watchdog
    while (!(WDOG-&amp;gt;CS &amp;amp; WDOG_CS_ULK_MASK) != 0u)
        ;                           // Wait for wdog to be unlocked
    WDOG-&amp;gt;WIN = 0x0000;
    WDOG-&amp;gt;TOVAL = 50;
    WDOG-&amp;gt;CS |= (WDOG_CS_CLK_MASK &amp;amp; (1 &amp;lt;&amp;lt; WDOG_CS_CLK_SHIFT));
    WDOG-&amp;gt;CS |= WDOG_CS_INT_MASK;
    WDOG-&amp;gt;CS |= WDOG_CS_EN_MASK;
    while (!((WDOG-&amp;gt;CS &amp;amp; WDOG_CS_RCS_MASK) != 0u))
        ; // Wait for config to be changed
    ENABLE_INTERRUPTS()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I enable the watchdog on startup with this code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;  /* Write of the WDOG unlock key to CNT register, must be done in order to allow any modifications*/
  WDOG-&amp;gt;CNT = (uint32_t ) FEATURE_WDOG_UNLOCK_VALUE;
  /* The dummy read is used in order to make sure that the WDOG registers will be configured only 
   * after the write of the unlock value was completed. */
  (void)WDOG-&amp;gt;CNT;

  /* Initial write of WDOG configuration register:
   * enables support for 32-bit refresh/unlock command write words,
   * clock select from LPO, update enable, watchdog disabled */
  WDOG-&amp;gt;CS  = (uint32_t ) ( (1UL &amp;lt;&amp;lt; WDOG_CS_CMD32EN_SHIFT)                       |
                            (FEATURE_WDOG_CLK_FROM_LPO &amp;lt;&amp;lt; WDOG_CS_CLK_SHIFT)     |
                            (1U &amp;lt;&amp;lt; WDOG_CS_EN_SHIFT)                             |
                            (1U &amp;lt;&amp;lt; WDOG_CS_UPDATE_SHIFT)                         );
                            
  /* Configure timeout */
  WDOG-&amp;gt;TOVAL = (uint32_t )0xFFFF;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can reconfigure it later with the same reconfiguration code above. Is reconfiguration only possible when the watchdog is enabled?&lt;/P&gt;</description>
      <pubDate>Thu, 14 Mar 2024 01:06:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K144-Reconfigure-disabled-Watchdog/m-p/1827817#M32946</guid>
      <dc:creator>DynamicsNoDriver</dc:creator>
      <dc:date>2024-03-14T01:06:57Z</dc:date>
    </item>
    <item>
      <title>Re: S32K144 Reconfigure disabled Watchdog</title>
      <link>https://community.nxp.com/t5/S32K/S32K144-Reconfigure-disabled-Watchdog/m-p/1828501#M32999</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/230927"&gt;@DynamicsNoDriver&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;Can you write WDOG-&amp;gt;CS in just one write?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BR, Daniel&lt;/P&gt;</description>
      <pubDate>Thu, 14 Mar 2024 13:03:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K144-Reconfigure-disabled-Watchdog/m-p/1828501#M32999</guid>
      <dc:creator>danielmartynek</dc:creator>
      <dc:date>2024-03-14T13:03:02Z</dc:date>
    </item>
    <item>
      <title>Re: S32K144 Reconfigure disabled Watchdog</title>
      <link>https://community.nxp.com/t5/S32K/S32K144-Reconfigure-disabled-Watchdog/m-p/1828876#M33014</link>
      <description>Hello &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/160001"&gt;@danielmartynek&lt;/a&gt;,&lt;BR /&gt;this works for me. Can you please explain why I need to write WDOG-&amp;gt;CS in one write when the watchdog was disabled previously but it's possible to write to WDOG-&amp;gt;CS multiple times when the watchdog was enabled before?</description>
      <pubDate>Thu, 14 Mar 2024 23:53:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K144-Reconfigure-disabled-Watchdog/m-p/1828876#M33014</guid>
      <dc:creator>DynamicsNoDriver</dc:creator>
      <dc:date>2024-03-14T23:53:57Z</dc:date>
    </item>
    <item>
      <title>Re: S32K144 Reconfigure disabled Watchdog</title>
      <link>https://community.nxp.com/t5/S32K/S32K144-Reconfigure-disabled-Watchdog/m-p/1829428#M33057</link>
      <description>&lt;P&gt;The WDOG stays unlock for just 128 BUS_CLK cycles.&lt;/P&gt;
&lt;P&gt;You need to make sure the CS register gets written within the window.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Daniel&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Mar 2024 13:23:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K144-Reconfigure-disabled-Watchdog/m-p/1829428#M33057</guid>
      <dc:creator>danielmartynek</dc:creator>
      <dc:date>2024-03-15T13:23:46Z</dc:date>
    </item>
  </channel>
</rss>

