请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
器件型号:MSP430F5249 如何检测 MSP430F5系列中的 BOR (欠压复位)?
是否有用于检测 BOR 的 API?
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
如何检测 MSP430F5系列中的 BOR (欠压复位)?
是否有用于检测 BOR 的 API?
无法进入 RESET_ISR(),是否需要在初始时启用中断?
以下用于捕获 BOR 中断的 ISR:
#pragma vector=reset_vector
__interrupt
void Reset_isr (void)
{
开关(_偶数_IN_RANGE (SYSRSTIV、SYSRSTIV_PMMKEY))
{
案例 SYSRSTIV_BOR:// SYSRSTIV:BOR
//__no_operation();
中断;
默认值:break;
}
}
MSP430复位矢量通常由 C 运行时启动代码处理、并且在复位后将调用 main()。
在 main()中,您可以读取 SYSRSTIV 以检查 复位原因。 例如:
int main(void)
{
volatile uint16_t reset_cause;
volatile bool halt_on_unexpected_reset_cause = true;
WDTCTL = WDTPW | WDTHOLD; // stop watchdog timer
do
{
reset_cause = SYSRSTIV;
switch (reset_cause)
{
case SYSRSTIV_NONE:
case SYSRSTIV_BOR:
case SYSRSTIV_RSTNMI:
/* Continue with the program, as probably a power up */
break;
default:
/* Unexpected reset, halt to allow inspection in the debugger */
while (halt_on_unexpected_reset_cause)
{
}
break;
}
} while (reset_cause != 0);
可能会记录多个复位原因、因此上述代码会一直读取 SYSRSTIV、直到返回0。