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.

Is the watchdog disable by __delay_cycles intrinsic?

Hi,

I'm using __delay_cycles intrinsic function to validate if the watchdog will reset after the configured timeout period. The watchdog is configured with ~10ms timeout and I created a while loop using __delay_cycles which is calibrated for a 1 ms delay (dat = 1).

while (dat--) {
__delay_cycles(MCU_FREQ / 1100);
};

No value in dat (it's a uint8_t) will make the watchdog trigger. After reading the compiler manual I found the following description of __delay_cycles intrisic -> "The __delay_cycles intrinsic inserts code to consume precisely the number of specified cycles with no side effects."

Does this intrinsic implicitly disables the watchdog timer? It is the only explanation I can find for this behavior.

Thanks

  • Hi!

    No, the __delay_cycles does not disable the watchdog. It simply emits code that consumes the number of cycles specified. (At least, this is they way the IAR compiler works, and I suspect that CCS simply mimics this behavior.)

    Have you inspected the generated code? When stepping it, does it really consume the number of cycles you expect?

    What happens if you replace it with an infinite loop, does the watchdog trigger then?

        -- Anders Lindgren, IAR Systems (author of the IAR compiler for MSP430)

  • Sorry this was my mistake. I'm working with LPM4 and the "dat" value is being sent via SPI which wakes up the MSP430 but in the associated interrupt routine I don't re-start the watchdog, now it's working as it should.

    Thanks

**Attention** This is a public forum