<?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 RT1050 EVKB - Using RTWDOG in i.MX RT Crossover MCUs</title>
    <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/RT1050-EVKB-Using-RTWDOG/m-p/1351885#M16598</link>
    <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;How are are you?&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am having a problem configuring the RTWDOG, as described below:&lt;/P&gt;&lt;P&gt;Sometimes in rtwdog initialization the code become stuck in the function&amp;nbsp;&lt;STRONG&gt;RTWDOG_Unlock()&lt;/STRONG&gt;&amp;nbsp;waiting for&amp;nbsp;the &lt;STRONG&gt;ULK&lt;/STRONG&gt; flag (when ULK is 1 rtwdog is unlocked) to change from 0 to 1 ( Code below).&amp;nbsp;&amp;nbsp;This happens in the call to&amp;nbsp;&lt;STRONG&gt;RTWDOG_Unlock()&lt;/STRONG&gt;&amp;nbsp;inside&amp;nbsp;&lt;STRONG&gt;RTWDOG_Init()&lt;/STRONG&gt;.&amp;nbsp;This problem dot not always happen. Sometimes the code works for days and then after a reset it becomes stuck.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;//In RTWDOG_Unlock. Sometimes code becomes stuck here after reset.
while ((base-&amp;gt;CS &amp;amp; RTWDOG_CS_ULK_MASK) == 0U)
{
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;From the RT1050 reference manual i know that the rtwdog need to be configured in 255 bus cycles after reset. I am also using some parts from the rtwdog sdk (v2.9.1) example. The code that i am using is show below. I call the &lt;STRONG&gt;wdog_Init()&lt;/STRONG&gt;&amp;nbsp;inside &lt;STRONG&gt;SystemInitHook()&lt;/STRONG&gt;&amp;nbsp;to init rwdog configs close to reset. This code is the first to run on my application after startup.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;//In file wdog.c
#define BSP_WDOG_CLK_FREQ 32768U
#define BSP_WDOG_TIMER_PRESC 256
#define DELAY_TIME 100000U

void wdog_Init(void)
{
    CLOCK_EnableClock(kCLOCK_Wdog3);

    /* @brief : Recommendation delay from NXP. Without that,
    * wdog can not be configured.
    *
    * @note Example note NXP:
    * When system is boot up, WDOG32 is disabled.
    * We must wait for at least 2.5
    * periods of wdog32 clock to reconfigure wodg32.
    * So Delay a while to wait for
    * the previous configuration taking effect.
    *
    */

    for (uint32_t temp = 0; temp &amp;lt; DELAY_TIME; temp++)
    {
        __NOP();
    }

    static rtwdog_config_t wdogConfig;

    RTWDOG_GetDefaultConfig(&amp;amp;wdogConfig);

    wdogConfig.enableUpdate = true;
    wdogConfig.workMode.enableDebug = false;
    wdogConfig.prescaler = kRTWDOG_ClockPrescalerDivide256;
    wdogConfig.timeoutValue = msec2WdogCount(WDOG_TIMEOUT_ms,
                                             BSP_WDOG_CLK_FREQ,
                                             BSP_WDOG_TIMER_PRESC);
    RTWDOG_Init(BSP_WDOG_TIMER, &amp;amp;wdogConfig); //The stuck problem happens here.
}

//In file main.c

/**
*
* @brief This function is called in SystemInit()at system_MIMXRT1052.c
* and is to be used to init things close to reset.
*
*/
void SystemInitHook (void)
{
    wdog_Init();
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Probably i am doing something wrong, but was not able to figure it out. Can you help me?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;João Paulo&lt;/P&gt;</description>
    <pubDate>Thu, 07 Oct 2021 12:29:14 GMT</pubDate>
    <dc:creator>jpgoncalves</dc:creator>
    <dc:date>2021-10-07T12:29:14Z</dc:date>
    <item>
      <title>RT1050 EVKB - Using RTWDOG</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/RT1050-EVKB-Using-RTWDOG/m-p/1351885#M16598</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;How are are you?&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am having a problem configuring the RTWDOG, as described below:&lt;/P&gt;&lt;P&gt;Sometimes in rtwdog initialization the code become stuck in the function&amp;nbsp;&lt;STRONG&gt;RTWDOG_Unlock()&lt;/STRONG&gt;&amp;nbsp;waiting for&amp;nbsp;the &lt;STRONG&gt;ULK&lt;/STRONG&gt; flag (when ULK is 1 rtwdog is unlocked) to change from 0 to 1 ( Code below).&amp;nbsp;&amp;nbsp;This happens in the call to&amp;nbsp;&lt;STRONG&gt;RTWDOG_Unlock()&lt;/STRONG&gt;&amp;nbsp;inside&amp;nbsp;&lt;STRONG&gt;RTWDOG_Init()&lt;/STRONG&gt;.&amp;nbsp;This problem dot not always happen. Sometimes the code works for days and then after a reset it becomes stuck.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;//In RTWDOG_Unlock. Sometimes code becomes stuck here after reset.
while ((base-&amp;gt;CS &amp;amp; RTWDOG_CS_ULK_MASK) == 0U)
{
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;From the RT1050 reference manual i know that the rtwdog need to be configured in 255 bus cycles after reset. I am also using some parts from the rtwdog sdk (v2.9.1) example. The code that i am using is show below. I call the &lt;STRONG&gt;wdog_Init()&lt;/STRONG&gt;&amp;nbsp;inside &lt;STRONG&gt;SystemInitHook()&lt;/STRONG&gt;&amp;nbsp;to init rwdog configs close to reset. This code is the first to run on my application after startup.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;//In file wdog.c
#define BSP_WDOG_CLK_FREQ 32768U
#define BSP_WDOG_TIMER_PRESC 256
#define DELAY_TIME 100000U

void wdog_Init(void)
{
    CLOCK_EnableClock(kCLOCK_Wdog3);

    /* @brief : Recommendation delay from NXP. Without that,
    * wdog can not be configured.
    *
    * @note Example note NXP:
    * When system is boot up, WDOG32 is disabled.
    * We must wait for at least 2.5
    * periods of wdog32 clock to reconfigure wodg32.
    * So Delay a while to wait for
    * the previous configuration taking effect.
    *
    */

    for (uint32_t temp = 0; temp &amp;lt; DELAY_TIME; temp++)
    {
        __NOP();
    }

    static rtwdog_config_t wdogConfig;

    RTWDOG_GetDefaultConfig(&amp;amp;wdogConfig);

    wdogConfig.enableUpdate = true;
    wdogConfig.workMode.enableDebug = false;
    wdogConfig.prescaler = kRTWDOG_ClockPrescalerDivide256;
    wdogConfig.timeoutValue = msec2WdogCount(WDOG_TIMEOUT_ms,
                                             BSP_WDOG_CLK_FREQ,
                                             BSP_WDOG_TIMER_PRESC);
    RTWDOG_Init(BSP_WDOG_TIMER, &amp;amp;wdogConfig); //The stuck problem happens here.
}

//In file main.c

/**
*
* @brief This function is called in SystemInit()at system_MIMXRT1052.c
* and is to be used to init things close to reset.
*
*/
void SystemInitHook (void)
{
    wdog_Init();
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Probably i am doing something wrong, but was not able to figure it out. Can you help me?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;João Paulo&lt;/P&gt;</description>
      <pubDate>Thu, 07 Oct 2021 12:29:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/RT1050-EVKB-Using-RTWDOG/m-p/1351885#M16598</guid>
      <dc:creator>jpgoncalves</dc:creator>
      <dc:date>2021-10-07T12:29:14Z</dc:date>
    </item>
    <item>
      <title>Re: RT1050 EVKB - Using RTWDOG</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/RT1050-EVKB-Using-RTWDOG/m-p/1354011#M16668</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/187110"&gt;@jpgoncalves&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Do you test the SDK code watchdog example directly?&lt;/P&gt;
&lt;P&gt;SDK_2_10_0_EVKB-IMXRT1050\boards\evkbimxrt1050\driver_examples\rtwdog&lt;/P&gt;
&lt;P&gt;Whether this code can works OK on your side or not?&lt;/P&gt;
&lt;P&gt;Your SDK is old, please use the newest SDK project and test it, you can download the newest SDK code from this link:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://mcuxpresso.nxp.com/" target="_blank"&gt;https://mcuxpresso.nxp.com/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Kerry&lt;/P&gt;</description>
      <pubDate>Tue, 12 Oct 2021 07:55:07 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/RT1050-EVKB-Using-RTWDOG/m-p/1354011#M16668</guid>
      <dc:creator>kerryzhou</dc:creator>
      <dc:date>2021-10-12T07:55:07Z</dc:date>
    </item>
  </channel>
</rss>

