SW does not boot after WDG reset

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

SW does not boot after WDG reset

ソリューションへジャンプ
2,476件の閲覧回数
ktbalazs
Contributor II

Hi!

I have a well working SW on a MK22FN256VLH12, but then I implemented WGD. It was simple, I made a config what worked well in another project, call the init, etc.

This is my configuration:

const wdog_config_t wdogConfig =
{
.wdogEnable = true,// Watchdog mode
.timeoutValue = 0x7ffU,// Watchdog overflow time is about 2s
.winEnable = false, //Disable window function
.windowValue = 0x1ffU, // Watchdog window value
.prescaler = kWdogClkPrescalerDivide1, // Watchdog clock prescaler
.updateEnable = true, // Update register enabled
.clksrc=kWdogLpoClkSrc, // Watchdog clock source is LPO 1KHz
#if FSL_FEATURE_WDOG_HAS_WAITEN
.workMode.kWdogEnableInWaitMode = true, // Enable watchdog in wait mode
#endif
.workMode.kWdogEnableInStopMode = true, // Enable watchdog in stop mode
.workMode.kWdogEnableInDebugMode = false,// Disable watchdog in debug mode
};

For testing, I take a while(1); into the code to test the WDG. The reset happens, but the program does not boot or stays in reset.

I read out the reset reason bit and it says, wdog reset happens.

Of course, the watchdog is enabled in the startup file:

#define DISABLE_WDOG 0

What do you think? Why does it not start?

Thank you!

タグ(1)
0 件の賞賛
返信
1 解決策
2,462件の閲覧回数
ktbalazs
Contributor II

Hi @kerryzhou !

I refresh the WDOG in one of my loop, it works well.

The solution was to disable the watchdog in the startup file.

#define DISABLE_WDOG 1

Now the watchdog works well!

Do you have idea, why?

元の投稿で解決策を見る

0 件の賞賛
返信
5 返答(返信)
2,469件の閲覧回数
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @ktbalazs 

 Welcome to use the NXP kinetis product, I would like to provide service for you.

For your question: For testing, I take a while(1); into the code to test the WDG. The reset happens, but the program does not boot or stays in reset.

In fact, after you enable the WDOG, you need to feed the dog in period, the period should smaller than the watchdog timeout time, otherwise, the code will reset by the WDOG, you can't see it boot, becuase your WDOG is always booting.

 So you need to feed the dog(refresh) in the while(1), or you can disable the Watchdog, please note, after reset, the watchdog register enable bit just can be configure once, other directly write is no usage.

So, if you want to start with the watchdog enabled, you need to refresh the watchdog before it is timeout.

The watchdog example has the refresh code, you can use it.

 

Wish it helps you!

If you still have questions about it, please kindly let me know.

Best Regards,

Kerry

 

0 件の賞賛
返信
2,463件の閲覧回数
ktbalazs
Contributor II

Hi @kerryzhou !

I refresh the WDOG in one of my loop, it works well.

The solution was to disable the watchdog in the startup file.

#define DISABLE_WDOG 1

Now the watchdog works well!

Do you have idea, why?

0 件の賞賛
返信
2,460件の閲覧回数
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @ktbalazs ,

 Perfect.

   disable the watchdog in the startup file is to let the code start. 

If you check the detail code, you will find it operate the watchdog register directly.

Now, do you still have the question? 

Best Regards,

KERRY

0 件の賞賛
返信
2,457件の閲覧回数
ktbalazs
Contributor II

No, disabling the WDG in the startup file was the solution.

0 件の賞賛
返信
2,447件の閲覧回数
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @ktbalazs ,

  Thanks for your updated information.

  If your question is solved, please help to mark the correct answer, just to close this case.

 Any new issues in the future, welcome to create the new case.

Best Regards,

Kerry

 

0 件の賞賛
返信