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 CCS Technical Support

[SOLVED] bootloader re-entry

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



Joined: 10 Feb 2011
Posts: 241
Location: Vancouver, BC

View user's profile Send private message

[SOLVED] bootloader re-entry
PostPosted: Fri Apr 15, 2011 12:27 pm     Reply with quote

Hi There,

After long search, I finally got a bootloader for my 16f883. I can download it with MPLAB, then connect with Microchip's boot loader app from AN1310 just fine, download my user app and let it run. But I can't re enter a second time. I'm not getting that going, I have a reset_cpu() code like this in my user app (it is in main()):

Code:
   if (bit_test (RS232_ERRORS, 2) && !input (MCU2_RX)) {
   break_cnt++;
   if (break_cnt>=5000)
         
      // if FERR bit set and pin C7 been low for about 5 seconds, reset to start bootloader mode  !
      reset_cpu ();
           
    } 



Does anyone have a clue what my problem could be? I'm not sure what's wrong... :(
Thanks for hints & suggestions,
Ron


Last edited by cerr on Mon Apr 18, 2011 10:24 am; edited 1 time in total
cerr



Joined: 10 Feb 2011
Posts: 241
Location: Vancouver, BC

View user's profile Send private message

[SOLVED] bootloader re-entry
PostPosted: Mon Apr 18, 2011 10:23 am     Reply with quote

Ok, I got it figured out, on the 16F pics, reset_cpu() only sets the PC to 0x00 but doesn't reset the registers and because I'm using int_rda in my application, i first have to disable the interrupts before i reset the chip, just to completely "clean up" the chip.

Now it works fine with below code:

Code:
    if (bit_test (RS232_ERRORS, 2) && !input (MCU2_RX)) {
     disable_interrupts (int_RDA);
     disable_interrupts (GLOBAL);
     output_low(PIN_C1);
      reset_cpu ();
         
    }


Using the bootloader from http://www.microchip.com/forums/m347843.aspx that complies with Microchip's AN1310.
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