rampage
Joined: 16 Oct 2010 Posts: 7
|
reset_cpu() way doesn't work properly with my code |
Posted: Wed Oct 20, 2010 8:22 am |
|
|
Hi,
I want to reset the chip and go into bootloader mode so I called
reset_cpu();
directly.
The bootloader is the USB HID bootloader
Code: |
void main(void)
{
if(RCONbits.POR == 1)//RCON bits POR power on reset, yes->go to bootloader, value is 0 on POR, hold is 1
{
RCONbits.POR = 0;
}
else //This example uses the sw I/O pin to determine if the device should enter the bootloader, or the main application code
{
RCONbits.POR = 1;
_asm
goto 0x1000 //RM_RESET_VECTOR If the user is not trying to enter the bootloader, go straight to the main application remapped "reset" vector.
_endasm
}
InitializeSystem();
while(1)
{
//do something
}
|
but it seems that the chip will just hang after invoked reset_cpu()
it works on some computers, but will hang on others
any idea? |
|