28335使用XINTF模块在power up时会出现跑飞现象,因此按照《ErrataTMS320F2833x, TMS320F2823x DSCs Silicon Errata Silicon Revisions A, 0》5.2章节第13条的建议使用DSP的看门狗模块在POWER UP 后对DSP进行一次复位,使用WDCR寄存器FLAG位判断是否是power-up. 如果是power-up则使用看门狗产生一个复位信号,但执行过程中发现:FLAG位的值并不是每次power-up都是0,有时是1有时是0,if条件有时可以进入然后执行软件复位,有时无法进入,直接跳到else,此时未实施软件复位,请问这个原因是什么?
void SoftWDReset(void)
{
if((SysCtrlRegs.WDCR&0x0080) == 0)//硬件复位或者上电
{
EALLOW;
//刚上电 使能看门狗
GpioDataRegs.GPBCLEAR.bit.GPIO49 = 1;
while(Conut2<200)
{
Conut2++;
}
//从GPIO49变低到发出复位信号400us
SysCtrlRegs.WDCR= 0x00B8; //0xB8//使能看门狗 触发软件复位 清除硬件复位标志
EDIS;
// SysCtrlRegs.WDCR= 0x0000; //触发软件复位
// DELAY_US(50);
}
else
{
EALLOW;
//清除软件复位标志 //关闭看门狗
SysCtrlRegs.WDCR = 0x00E8;
GpioDataRegs.GPBCLEAR.bit.GPIO48 = 1;
//SysCtrlRegs.WDCR = 0x0068;
EDIS;
//关闭看门狗
// SysCtrlRegs.WDCR = 0x0068; //0x0068 清除FLAG 关闭使能
}
}
POWER UP 后RST引脚变高,WDRST信号也会变高,WDRST有个上升沿,此时FLAG是0还是1?按照《TMS320x2833x System Control and
Interrupts Reference Guide》文件(Literature Number: SPRUFB0)3.4.5节的描述,此时FLAG可能是1?那这样是不是错的?
When the XRS line is low, the WDFLAG bit is forced low. The WDFLAG bit is only set if a rising edge on
WDRST signal is detected (after synch and an 8192 SYSCLKOUT cycle delay) and the XRS signal is
high. If the XRS signal is low when WDRST goes high, then the WDFLAG bit remains at 0. In a typical
application, the WDRST signal connects to the XRS input. Hence to distinguish between a watchdog reset
and an external device reset, an external reset must be longer in duration then the watchdog pulse.