RT1050 EVKB - Using RTWDOG

显示  仅  | 搜索替代 

RT1050 EVKB - Using RTWDOG

488 次查看
Contributor I


How are are you? 

I am having a problem configuring the RTWDOG, as described below:

Sometimes in rtwdog initialization the code become stuck in the function RTWDOG_Unlock() waiting for the ULK flag (when ULK is 1 rtwdog is unlocked) to change from 0 to 1 ( Code below).  This happens in the call to RTWDOG_Unlock() inside RTWDOG_Init(). This problem dot not always happen. Sometimes the code works for days and then after a reset it becomes stuck.  


//In RTWDOG_Unlock. Sometimes code becomes stuck here after reset.
while ((base->CS & RTWDOG_CS_ULK_MASK) == 0U)



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 wdog_Init() inside SystemInitHook() to init rwdog configs close to reset. This code is the first to run on my application after startup.


//In file wdog.c
#define BSP_WDOG_CLK_FREQ 32768U
#define DELAY_TIME 100000U

void wdog_Init(void)

    /* @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 < DELAY_TIME; temp++)

    static rtwdog_config_t wdogConfig;


    wdogConfig.enableUpdate = true;
    wdogConfig.workMode.enableDebug = false;
    wdogConfig.prescaler = kRTWDOG_ClockPrescalerDivide256;
    wdogConfig.timeoutValue = msec2WdogCount(WDOG_TIMEOUT_ms,
    RTWDOG_Init(BSP_WDOG_TIMER, &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)


Probably i am doing something wrong, but was not able to figure it out. Can you help me?



João Paulo

0 项奖励
1 回复

461 次查看
NXP TechSupport
NXP TechSupport

Hi @jpgoncalves ,

  Do you test the SDK code watchdog example directly?


Whether this code can works OK on your side or not?

Your SDK is old, please use the newest SDK project and test it, you can download the newest SDK code from this link:


Best Regards,


0 项奖励