I'm porting an application from the 2809 to the 28335, and it seems like I can't disable the watchdog on the 28335. I have programmed a branch instruction at the flash entry point, which branches to code that disables the watchdog. I have the GPIO pins configured for booting to flash. When I try to run my code, the processor continuously resets. If I set a breakpoint on the flash entry point and Run, it comes right back to that point, and the RPC is 0. If I look at the WDCR, it indicates that a watchdog reset occurred. Stepping through the code that is supposed to disable the watchdog looks like it indeed does so, but once it gets back to the flash entry point the watchdog disable is cleared in the WDCR.
In addition to the watchdog clear right after reset (after the branch at the flash entry point as shown below), I have an init_sys_ctrl() function called from main() that also writes to the WDCR to disable the watchdog. All of this was working just fine on the 2809.
If I sprinkle a bunch of watchdog writes throughout my code, then it doesn't reset. If I add a while(1); to the end of my main() function, so that the BIOS doesn't start, then it also doesn't reset. I'm using DSP/BIOS 5.41.10.36, Code Generation Tools 5.2.10, and Code Composer 3.3.
Any ideas as to what's going on? Could there be some other reason the processor is resetting, and the watchdog is just a red herring?
I'm using the following code to disable the watchdog, where the .codeStart section is programmed at the flash entry point (0x33fff6):
WD_DISABLE .set 1 ;set to 1 to disable WD, else set to 0
.ref _c_int00
.sect ".codeStart"
code_start:
.if WD_DISABLE == 1
LB wd_disable ;Branch to watchdog disable code
.else
LB _c_int00 ;Branch to start of boot.asm in RTS library
.endif
;end codeStart section
.if WD_DISABLE == 1
.text
wd_disable:
SETC OBJMODE ;Set OBJMODE for 28x object code
EALLOW ;Enable EALLOW protected register access
MOVZ DP, #7029h>>6 ;Set data page for WDCR register
MOV @7029h, #0068h ;Set WDDIS bit in WDCR to disable WD
EDIS ;Disable EALLOW protected register access
LB _c_int00 ;Branch to start of boot.asm in RTS library
.endif
.end