Kirk Humphries

Reset CPU

Discussion created by Kirk Humphries Employee on Jan 27, 2006

This message contains an entire topic ported from a separate forum. The original message and all replies are in this single message. We have seeded this new forum with selected information that we expect will be of value to you as you search for answers to your questions.


Posted: Wed Oct 26, 2005  4:39 pm


Hi All,


I need to reset the CPU. I have tried the below code, but it did not work. Do you know any other way to reset the CPU?



void FirmwareReset(void)  {  Uint16 uCStart = 0xFFFE;     // RE-START THE FIRMWARE TO SWITCH TO LOADER MODE  PPAGE = 0x3F;  FCNFG = 0; // BLOCK 0  DisableInterrupts;  asm {  ldx uCStart  jmp 0,x  }  }





Posted: Wed Oct 26, 2005  4:56 pm


Most common method I've seen in micros with a watchdog is to stop petting the dog. The reset vector can go to some special handling that doesn't normally execute for POR. If this is the only instance that COP is used, you can simply write to COPCTL to enable it and wait for the reset.



Posted: Wed Oct 26, 2005  5:10 pm


How about just writing the two COP words in the reverse order?



Posted: Wed Oct 26, 2005  5:17 pm


Yes - this dog doesn't like to be petted against the grain  ; )



Posted: Wed Oct 26, 2005  5:56 pm


Or any invalid value like 0xFF or 0x00 to the ARMCOP register?



Posted: Thu Oct 27, 2005  5:23 pm


You can also take an unused bidirectional port pin and connect it to the reset line. To get a reset, set the output value of the pin to 0 and then make it an output. This will reset the processor which causes the pin to become a non-interfering input during the reset process.


Thus you can run with the watchdog disabled if you want and also use the regular reset vector.



Posted: Wed Oct 26, 2005  5:04 pm


It looks to me like you are trying to jump to address 0xFFFE instead of jumping to the address stored in 0xFFFE.



Posted: Wed Oct 26, 2005  5:41 pm


To issue an immediate Reset, enable the COP watchdog, then write any value that is different from 0x55 and 0xAA to the ARMCOP register. This will immediately Reset the CPU (with a hard Reset rather than just a software Reset like you have been attempting to do). The COP Watchdog Reset vector is at address 0xFFFA (is different from the general Reset vactor at 0xFFFE.


Hope this helps,



Posted: Wed Oct 26, 2005  6:46 pm


I have tried to enable the COPCTL and write 0 to ARMCOP register and it worked.


Thanks very much for your all helps.