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.

F28377D watchdog fails to enable

The watchdog feature will not enable (as determined by viewing the WDDIS bit in register WDCR using the emulator on a F28377D controlCARD).

Here is the code:

894	temp = temp; // dummy for breakpoint
895	EALLOW;
896	WdRegs.SCSR.bit.WDENINT = 1; // cause a micro reset on wd timeout
897	WdRegs.WDCR.all = 0x002F; // enable watchdog and set clk divide by 64
898	WdRegs.SCSR.bit.WDOVERRIDE = 1; // disable bit change of WDDIS
899	EDIS;
900	temp = temp; // dummy for breakpoint

The program was run to the first breakpoint on line 894. The debug register window was examined and the WDENINT bit was 0, the WDPS field was 0, and the WDDIS bit was 1.

The program was then allowed to continue to the next breakpoint on line 900.

Again the debug register window was examined, and as required the WDENINT had changed to 1 and the WDPS had changed to 111, however, the WDDIS bit was still set to 1.

Useful suggestions welcome.

  • Hi Peter,

    What is the value of "WDOVERRIDE" bit in SCSR register in debug window when breakpoints hits on 894 and 900?

    Also can you comment out the "WdRegs.SCSR.bit.WDOVERRIDE = 1;" line in the code and see if that makes any difference?

    Regards,

    Vivek Singh

  • Hi Vivek,

    Thanks for the reply. I have been gradually chipping away at the problem and it is now working.

    After line 896 above was executed the WDOVERRIDE bit was clearing to zero (this does not appear to be documented). By moving line 896 to after line 897 the WDDIS bit was able to be cleared to zero by line 897.

    There was also a mistake in line 896. I misinterpreted the bit - it has to be cleared to 0 to enable an external reset.

    So the working code is the same as above without line 896.
  • Hi Peter,

    What you are observing is expected behavior. As per definition of "WDOVERRIDE" register bit, writing '1' to this bit clears it to '0'. Since default value of this is '1'  when you use bit operation code like "WdRegs.SCSR.bit.WDENINT = 1" which basically translates into RMW (Read-Modify-Write) operation, "WDOVERRIDE" bit will get written with '1' hence it will get clear to '0'.

    Instead of using bit operation for this register, you should write full register like "WdRegs.SCSR.all = 0x6 (or any other value with bit '0' as 0 if one does not want to change WDOVERRIDE bit)".

    Hope this helps.

    Regards,

    Vivek Singh