TMS320F28035-EP: WDFLAG is not setting upon Watchdog reset during watchdog test

Part Number: TMS320F28035-EP
Other Parts Discussed in Thread: TMS320F28035, C2000WARE

Tool/software:

Hello,

I am trying to implement a watchdog test on the TMS320F28035. The goal is to enable the watchdog, provide a delay greater than the configured timeout period, and check if the watchdog resets the system. I also want to confirm through a register check that the reset was caused by the watchdog and not by power-on reset.

For testing, I added a while loop. The system resets (my LED toggles between main() and the watchdog test loop, so I can see the resets happening). However, the WDFLAG bit in the WDCR register never gets set. The condition if ((SysCtrlRegs.WDCR & 0x0080) != 0)  never becomes true, so the watchdog test always fails.

When I check during debug, the WDCR value is always 0x0046. Even if I explicitly write SysCtrlRegs.WDCR = 0x002E;, reading it back still shows 0x0046.

Below is my code

void cpu_EnableWatchDog(void)
{
// WDPS (prescale) : 110 (512/32)
// WDCHK (bits 3-5) : 101
// WDDIS (bit 6) : 0 (Enable watchdog)
// WDFLAG (bit 7) : 0 (writes of 0 are ignored)

EALLOW;
SysCtrlRegs.WDCR = 0x002E;
EDIS;
}

void cpu_configureWatchdog()
{
// WDENINT = 0 → reset mode
// WDOVERRIDE = 1 → allow WDDIS changes
EALLOW;
SysCtrlRegs.SCSR = 0x0005;
EDIS;
}

static Uint8 bit_pbitWDTTest(void)
{
Uint8 WDTTestPassed = 0;

// Check if last reset was due to WDT
if ((SysCtrlRegs.WDCR & 0x0080) != 0) // WDFLAG
{
WDTTestPassed = 1;
}
else
{
while (1)
{
GpioDataRegs.GPBSET.bit.GPIO33 = 1; // LED
}
}

return WDTTestPassed;
}

What is the problem here?