RT1052 配置WDOG3,系统死机后不触发reset,系统不重新启动

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

RT1052 配置WDOG3,系统死机后不触发reset,系统不重新启动

3,827 Views
brli
Contributor III

您好!

麻烦指点一下:RT1052 配置WDOG3,系统死机后不触发reset,系统不重新启动,系统正常运行的的情况下可以触发reset。我的配置如下:

CLOCK_EnableClock(kCLOCK_Wdog3); 

prescal=kRTWDOG_ClockPrescalerDivide256;

for(int i = 0; i < 1000; i++);
RTWDOG_GetDefaultConfig(&rtwdog_config);
rtwdog_config.testMode=kRTWDOG_UserModeEnabled;
rtwdog_config.clockSource=(rtwdog_clock_source_t)src;
rtwdog_config.prescaler=prescal; 
rtwdog_config.timeoutValue=1024; 
rtwdog_config.enableWindowMode =false;
rtwdog_config.enableInterrupt=false; 
rtwdog_config.enableRtwdog=true; 
rtwdog_config.windowValue=win;
RTWDOG_Init(RTWDOG,&rtwdog_config); 

NVIC_SetPriority(RTWDOG_IRQn, 4); 
NVIC_EnableIRQ(RTWDOG_IRQn); 

Labels (1)
0 Kudos
12 Replies

2,811 Views
mail2gongli
Contributor I

请问后续有什么新进展吗?

我们遇到类似问题。MBED系统+RT1052+RTWDOG。我们结合业务逻辑推断是我们某个任务栈发生了溢出,此后系统死机,长时间无法复位。手工构造简单场景模拟不出效果,手工模拟长时间不喂狗时RTWDOG都能正常复位。

0 Kudos

3,825 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,

非常感谢使用NXP产品,很高兴为你提供技术支持!

建议先简化代码只测试RTWDOG功能,其次,能否介绍一下你测试的开发平台。

Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

3,809 Views
brli
Contributor III

Hi Jeremyzhou

我测试发现必须设置NVIC_SetPriorityGrouping(0x4);系统死机后才能使wdog3复位,否则wdog3无法复位cpu,请问这是wdog3工作的必须条件,还是有其它什么条件没设置好?

我的工程包含:FreeRTOS+LWIP+RTWDOW,请帮忙指导一下。

谢谢!

Tags (1)
0 Kudos

3,805 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,

感谢回复。

我有几个疑问,希望你能解释一下。

1)你说的‘死机’现象具体指代MCU处于怎样的工作状态呢?

2)在没有RTOS的情况下, WDOG3复位功能是否正常?

我建议你逐次简化一下工程代码看看能否复现问题,从而确认问题的根源。

Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

3,802 Views
brli
Contributor III

Hi jeremyzhou,

1)你说的‘死机’现象具体指代MCU处于怎样的工作状态呢?

      将FLASH数据线拉到GND上,使CPU取不到指令而出现异常

2)在没有RTOS的情况下, WDOG3复位功能是否正常?

      CPU正常能取到指令,正常运行状态下,不论有RTOS或没有,只要不喂狗,WDOG3都可以复位,但当用上面方法拉住FLASH的数据线到GND后,WDOG3就无法复位。

Tags (1)
0 Kudos

3,788 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,
感谢回复。
就是说你是在使能WDOG3后,强制性的将FLASH数据线拉到GND上来模拟程序跑飞,但只有当设置NVIC_SetPriorityGrouping(0x4)时,WDOG3才能复位MCU,我的理解对吗?
还有我想知道WDOG3中断优先级被设置成多少呢?
Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

3,776 Views
brli
Contributor III

Hi Jeremyzhou,

是的,但是经过反复测试确认,设置NVIC_SetPriorityGrouping(0x4)也不是100%能复位。

中断优先级设置为:

NVIC_SetPriority(RTWDOG_IRQn, 4);

谢谢!

0 Kudos

3,770 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,
我仔细考虑你的测试流程,你是人为将FLASH的数据线连接GND来模拟程序跑飞,那么即使后面WDOG3复位MCU后,也无法成长启动,所以我就不知道你是通过什么判断WDOG3复位了MCU的呢?或者你接受一下你完整的测试流程。
Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

3,764 Views
brli
Contributor III

Hi Jeremyzhou,

测试流程:

1、设置WDOG3超时时间是1分钟,打开WDOG3及其中断

2、板子上电观察程序正常运行(连续打印日志),

3,将FLASH的数据线连接GND模拟程序跑飞,

4、观察到第2步无日志打印,判断程序跑飞,然后将3模拟程序跑飞的FLASH数据线与GND立即断开

5、等待时间观察WDOG3是否复位,等待5分钟都没复位。

谢谢!

Tags (1)
0 Kudos

3,759 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,
感谢回复。
根据你的测试流程描述中,我建议可以将超时时间适当延长以保证测试步骤在超时时间内肯定能完成。其次,将FLASH数据线与GND连接会让MCU进入Hardfalut,你可以在测试代码中人为加入引发Hardfault的函数,比如除0,访问非法区域等,看看WDOG3能否会复位MCU。
最后,我还是建议你简化代码,找到与问题出现强相关的代码或者函数,从而确认问题原因。
Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

3,742 Views
brli
Contributor III

Hi Jeremyzhou,

根据你的测试流程描述中,我建议可以将超时时间适当延长以保证测试步骤在超时时间内肯定能完成。

==》WDOG3超时设为5分钟,超时也看不到CPU复位(Flash数据拉到GND使cpu跑飞,然后还原正常)

其次,将FLASH数据线与GND连接会让MCU进入Hardfalut,你可以在测试代码中人为加入引发Hardfault的函数,比如除0,访问非法区域等,看看WDOG3能否会复位MCU。

==>WDOG3可以正常复位


最后,我还是建议你简化代码,找到与问题出现强相关的代码或者函数,从而确认问题原因。

==>已经最简了,使用官方RTWDOG例程测试的。

 

谢谢!

Tags (1)
0 Kudos

3,733 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,
感谢回复。
我建议使用Jlink的halt命令查看一下MCU没有boot起来,PC停在了哪里,是不是每次都停在固定的位置上。
Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos