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.
It is working perfectly but i have some doubt in this SYSRSTIV comes 0x0016 when we come of the ieration but after if condition SYSTSTIV comes like 0x000 why? can you please explain
#include <msp430.h>
int main(void) {
// WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer
if (SYSRSTIV ==SYSRSTIV_WDTTO) {
switch(SYSRSTIV_WDTTO){
case SYSRSTIV_NONE: /* No Interrupt pending */
_no_operation();
break;
case SYSRSTIV_BOR : /* SYSRSTIV : BOR */
_no_operation();
break;
case SYSRSTIV_RSTNMI: /* SYSRSTIV : RST/NMI */
_no_operation();
break;
case SYSRSTIV_DOBOR: /* SYSRSTIV : Do BOR */
_no_operation();
break;
case SYSRSTIV_LPM5WU: /* SYSRSTIV : Port LPM5 Wake Up */
_no_operation();
break;
case SYSRSTIV_SECYV : /* SYSRSTIV : Security violation */
_no_operation();
break;
case SYSRSTIV_RES0C: /* SYSRSTIV : Reserved */
_no_operation();
break;
case SYSRSTIV_SVSHIFG: /* SYSRSTIV : SVSHIFG */
_no_operation();
break;
case SYSRSTIV_RES10: /* SYSRSTIV : Reserved */
_no_operation();
break;
case SYSRSTIV_RES12: /* SYSRSTIV : Reserved */
_no_operation();
break;
case SYSRSTIV_DOPOR: /* SYSRSTIV : Do POR */
_no_operation();
break;
case SYSRSTIV_WDTTO: /* SYSRSTIV : WDT Time out */
_no_operation();
break;
case SYSRSTIV_WDTKEY: /* SYSRSTIV : WDTKEY violation */
_no_operation();
break;
case SYSRSTIV_FRCTLPW: /* SYSRSTIV : FRAM Key violation */
_no_operation();
break;
case SYSRSTIV_UBDIFG: /* SYSRSTIV : FRAM Uncorrectable bit Error */
_no_operation();
break;
case SYSRSTIV_PERF: /* SYSRSTIV : peripheral/config area fetch */
_no_operation();
break;
case SYSRSTIV_PMMPW: /* SYSRSTIV : PMM Password violation */
_no_operation();
break;
case SYSRSTIV_MPUPW: /* SYSRSTIV : MPU Password violation */
_no_operation();
break;
case SYSRSTIV_CSPW: /* SYSRSTIV : CS Password violation */
_no_operation();
break;
case SYSRSTIV_MPUSEGPIFG: /* SYSRSTIV : MPUSEGPIFG violation */
_no_operation();
break;
case SYSRSTIV_MPUSEGIIFG: /* SYSRSTIV : MPUSEGIIFG violation */
_no_operation();
break;
case SYSRSTIV_MPUSEG1IFG: /* SYSRSTIV : MPUSEG1IFG violation */
_no_operation();
break;
case SYSRSTIV_MPUSEG2IFG: /* SYSRSTIV : MPUSEG2IFG violation */
_no_operation();
break;
case SYSRSTIV_MPUSEG3IFG: /* SYSRSTIV : MPUSEG3IFG violation */
_no_operation();
break;
case SYSRSTIV_ACCTEIFG: /* SYSRSTIV : ACCTEIFG access time error */
_no_operation();
break;
default:
break;
}
}
while(1);
}
Hi Santhosh
By default the WDT's time-out interval is Watchdog clock source / 2^15. When you first power on it the SYSRSTIV should not be 0x0016.
Best regards
Gary
Thank for your reply. when I first power on it the SYSRSTIV comes like 0x0004 and by using the debugger I went to (Breakpoint) if condition now SYSRSTIV becomes 0x000 since the condition is not true it goes to while and I pressed run button it goes if condition again since I placed the breakpoint in if condition now SYSRSTIV is 0x0016. but when if condition is successfully completed after that it comes like SYSRSTIV 0x0000 why?
> if (SYSRSTIV ==SYSRSTIV_WDTTO) {
Reading SYSRSTIV resets the relevant flag. In general, reading it twice will give you different values. When it runs out of flags, it returns 0. [Ref User Guide (SLAU367O) Sec 1.3.7]
> switch(SYSRSTIV_WDTTO){
This switch() is using a constant (=0x16) as a tag. This is (almost) never useful. Is that what you intended?
Thank so much for the reply, I got some idea from what you have said. But I have some doubt in SYSRSTIV why because when I have rested my device it hanged suddenly. I don't why? so I started to analyze SYSRSTIV
switch(__even_in_range(SYSRSTIV , SYSRSTIV_ACCTEIFG)){
case SYSRSTIV_NONE: // No interrupt pending
_no_operation();
break;
case SYSRSTIV_BOR : // SYSRSTIV : BOR
_no_operation();
break;
case SYSRSTIV_RSTNMI: //SYSRSTIV : RST/NMI(BOR)
_no_operation();
break;
case SYSRSTIV_DOBOR: //SYSRSTIV : Do BOR
_no_operation();
break;
case SYSRSTIV_LPM5WU: //SYSRSTIV : Port LPM5 Wake Up(BOR)
_no_operation();
//__bis_SR_register(LPM4_bits);
break;
case SYSRSTIV_SECYV : //SYSRSTIV : Security violation(BOR)
_no_operation();
break;
case SYSRSTIV_RES0C: //SYSRSTIV : SVSHIFG
_no_operation();
break;
case SYSRSTIV_SVSHIFG: // SYSRSTIV : Do POR
_no_operation();
break;
case SYSRSTIV_RES10: // SYSRSTIV : WDT Time out
_no_operation();
break;
case SYSRSTIV_RES12: //SYSRSTIV : WDTKEY violation
_no_operation();
break;
case SYSRSTIV_DOPOR: // SYSRSTIV : FRAM Key violation
_no_operation();
break;
case SYSRSTIV_WDTTO: //SYSRSTIV : FRAM Uncorrectable bit Error
_no_operation();
break;
case SYSRSTIV_WDTKEY: // SYSRSTIV : peripheral/config area fetch
_no_operation();
break;
case SYSRSTIV_FRCTLPW: // SYSRSTIV : PMM Password violation
_no_operation();
break;
case SYSRSTIV_UBDIFG: //SYSRSTIV : MPU Password violation
_no_operation();
break;
case SYSRSTIV_PERF: // SYSRSTIV : CS Password violation
_no_operation();
break;
case SYSRSTIV_PMMPW: //SYSRSTIV : MPUSEGPIFG violation
_no_operation();
break;
case SYSRSTIV_MPUPW: //SYSRSTIV : MPUSEGIIFG violation
_no_operation();
break;
case SYSRSTIV_CSPW: //SYSRSTIV : MPUSEG1IFG violation
_no_operation();
break;
case SYSRSTIV_MPUSEGPIFG: // SYSRSTIV : MPUSEG2IFG violation
_no_operation();
break;
case SYSRSTIV_MPUSEGIIFG: // SYSRSTIV : MPUSEG3IFG violation
_no_operation();
break;
case SYSRSTIV_MPUSEG1IFG: //SYSRSTIV : ACCTEIFG access time error
_no_operation();
break;
case SYSRSTIV_MPUSEG2IFG: //SYSRSTIV : ACCTEIFG access time error
_no_operation();
break;
case SYSRSTIV_MPUSEG3IFG: // SYSRSTIV : ACCTEIFG access time error
_no_operation();
break;
case SYSRSTIV_ACCTEIFG: //SYSRSTIV : ACCTEIFG access time error
_no_operation();
break;
default:
break;
}
In this code i want to go through each INTERRUPT EVENT and i i want to know when it is going SYSRSTIV : BOR,SYSRSTIV : SVSHIFG etc can you please help so that it will be very useful for me.Thank you so much for you fast reply
Hi
You can do your work like this
unsigned short reset_event;
reset_event=SYSRSTIV ;
switch(reset_event)
{
case SYSRSTIV_NONE: // No interrupt pending
//toggle the LED once;
break;
case SYSRSTIV_BOR : // SYSRSTIV : BOR
//toggle the LED twice ;
break;
case SYSRSTIV_RSTNMI: //SYSRSTIV : RST/NMI(BOR)
//toggle the LED three times
break;
....
}
So you can know the reset event by the LED signals.
Best regards
Gary
**Attention** This is a public forum