你的问题是WDT导致了一个不象陷阱或ISR的重置。虽然您可以检测到重置是由WDT引起的,但是您没有调用堆栈或类似程序来帮助您确定发生WDT重置时MCU的状态。您可能能够创建用于保持代码当前状态的持久全局变量(或两个)。比如-在函数“X”中,在ISR“y”中,“在主循环中空闲”等。通过使变量持久化,它不会被运行时代码重置(假设您正在用C编程),并且在WDT重置的“main”的开始有一个测试权限,并使用它来设置断点,可以看到这些持久变量的状态,并开始了解发生了什么。不是100%有效,但是它可以给你一些想法。苏珊
以上来自于百度翻译
以下为原文
The issue you have is that the WDT causes a reset which is not like a trap or ISR. While you can detect the fact that the reset was caused by the WDT, you don't have a call stack or similar to help you determine the state of the MCU when the WDT reset occurred.
You might be able to create a persistent global variable (or two) that you use to keep the current state of your code. Something like - In function 'X', In ISR 'y', 'Idling in the main loop' etc.
By making the variable persistent, it will not be reset by the runtime code (assuming you are programming in C) and by having a test right at the start of the 'main' for the WDT reset and using that to set a breakpoint, you can see the state of those persistent variables and start to get an idea of what happened.
Not 100% effective but it can give you ideas.
Susan
你的问题是WDT导致了一个不象陷阱或ISR的重置。虽然您可以检测到重置是由WDT引起的,但是您没有调用堆栈或类似程序来帮助您确定发生WDT重置时MCU的状态。您可能能够创建用于保持代码当前状态的持久全局变量(或两个)。比如-在函数“X”中,在ISR“y”中,“在主循环中空闲”等。通过使变量持久化,它不会被运行时代码重置(假设您正在用C编程),并且在WDT重置的“main”的开始有一个测试权限,并使用它来设置断点,可以看到这些持久变量的状态,并开始了解发生了什么。不是100%有效,但是它可以给你一些想法。苏珊
以上来自于百度翻译
以下为原文
The issue you have is that the WDT causes a reset which is not like a trap or ISR. While you can detect the fact that the reset was caused by the WDT, you don't have a call stack or similar to help you determine the state of the MCU when the WDT reset occurred.
You might be able to create a persistent global variable (or two) that you use to keep the current state of your code. Something like - In function 'X', In ISR 'y', 'Idling in the main loop' etc.
By making the variable persistent, it will not be reset by the runtime code (assuming you are programming in C) and by having a test right at the start of the 'main' for the WDT reset and using that to set a breakpoint, you can see the state of those persistent variables and start to get an idea of what happened.
Not 100% effective but it can give you ideas.
Susan
举报