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.

question about the watchdog of tps65381

In the document of spna176 ,I can not understand the intend of  "asm("b #-8").

Is it equal to "while(1)"?

Program die at here,  how to proceed ?  Give me some explanation.

5. Force the program into an infinite loop.
This step is for debug purpose ONLY and should be removed in production. During debug, you can
connect to device using Code Composer Studio™ (or other IDE) and move the program counter (PC)
to next instruction to run the program.
asm(“ b #-8”)

  • Hi,

    The effect of while(1) and asm("    b $"); should be the same.

    But if there are any code after while(1); its generally optimized or thrown away, but asm("   b $") will let you prevent the code written after that from getting optimized.

    This is generally done if you want to keep the processor waiting at some definitive point, so that you can go investigate using the debugger since the code will be waiting in that instruction, so you can make the necessary changes if required and push the program counter to the next line manually and let the CPU run after that.

    Typically if your code goes in to an undesirable state or hard to recover state like a low power mode, then on every single power cycle, it gets in to this state preventing your debugger to connect any further to debug/flash erase/programming. But with this piece of code before the critical code section, on every reset cycle it waits here so that only after a manual intervention the code proceeds.

    Hope that answers your question.