|
|
View previous topic :: View next topic |
Author |
Message |
cerr
Joined: 10 Feb 2011 Posts: 241 Location: Vancouver, BC
|
[SOLVED] bootloader re-entry |
Posted: Fri Apr 15, 2011 12:27 pm |
|
|
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
|
[SOLVED] bootloader re-entry |
Posted: Mon Apr 18, 2011 10:23 am |
|
|
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. |
|
|
|
|
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
|