CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

reset_cpu() way doesn't work properly with my code

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
rampage



Joined: 16 Oct 2010
Posts: 7

View user's profile Send private message

reset_cpu() way doesn't work properly with my code
PostPosted: Wed Oct 20, 2010 8:22 am     Reply with quote

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?
jds-pic



Joined: 17 Sep 2003
Posts: 205

View user's profile Send private message

Re: reset_cpu() way doesn't work properly with my code
PostPosted: Mon Nov 15, 2010 1:25 pm     Reply with quote

rampage wrote:

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?

Read my post 1/3rd of the way down this thread:
http://www.ccsinfo.com/forum/viewtopic.php?t=20282

jds-pic
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group