|
|
View previous topic :: View next topic |
Author |
Message |
cerr
Joined: 10 Feb 2011 Posts: 241 Location: Vancouver, BC
|
bootloader<->user application configuration |
Posted: Mon Jun 06, 2011 3:51 pm |
|
|
Hi There,
I'm using the AN1310 1.05 bootloader from microchip for my application which is running on a PIC18F86K22. Now, the bootloader seems to work fine, i can connect and succesfully download my application. Then when I run it, it seems like the baudrate is messed up, as i can't read anything anymore on my serial console :( How can I make sure that the bootloader doesn't change the settings in my user app or better how can i make sure that my application configuration gets written once the bootloader finishes/my app is launching. It works just great with out a bootloader...
Help, hints and suggestions are appreciated!
Thank you,
Ron
PS: I wrote a little test app to verify that it's not my app that does things crazy. The test app looks like this:
Code: |
#include <18F86K22.h>
//#device ICD=TRUE
#case
#device adc=16 HIGH_INTS=TRUE
#fuses NOWDT
#fuses HSH //Hi-Speed crystal oscillator
#fuses NOBROWNOUT //No brownout reset
#fuses NOPLLEN //No PLL enabled
#fuses BBSIZ1K //1K words Boot Block size
#fuses NOXINST //Extended set extension and Indexed Addressing mode disabled (Legacy mode)
#fuses PROTECT
#define PC_RX PIN_G2
#define PC_TX PIN_G1
#define BAUDRATE 9600
#use delay(clock=20000000)
#use rs232(baud=BAUDRATE,parity=N,xmit=PC_TX,rcv=PC_RX,UART2,bits=8,stream=PC, ERRORS)
void main (void)
{
while (1) {
fprintf (PC, "Hello World!\r\n");
delay_ms(500);
}
}
|
|
|
|
cerr
Joined: 10 Feb 2011 Posts: 241 Location: Vancouver, BC
|
|
Posted: Mon Jun 06, 2011 4:29 pm |
|
|
I've been trying to figure out what I need to reset from my user app, have tried this so far with no success... :(
Code: |
#bit PLLCFG = getenv("bit:PLLCFG")
#bit PLLEN = getenv("bit:PLLEN")
#byte SPBRG2 = getenv("sfr:SPBRG2")
#byte SPBRGH2 = getenv("sfr:SPBRGH2")
#byte OSCCON = getenv("sfr:OSCCON")
#byte OSCCON2 = getenv("sfr:OSCCON2")
void main (void)
{
PLLCFG = 0;
PLLEN = 0;
SPBRG2 = 0;
SPBRGH2 = 2;
OSCCON = 104;
OSCCON2 = 0;
...
..
...
}
|
Any idea what register I might be missing?
Thanks,
Ron |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Tue Jun 07, 2011 6:58 am |
|
|
Depending on the bootloader configuration, application #fuse setting may be possibly ignored (e.g. when setting the USE_SOFTCONFIGWP switch). In this case, the fuse-settings of the bootloader would be used and oscillator frequencies can be different from what you expect. You should check this. |
|
|
cerr
Joined: 10 Feb 2011 Posts: 241 Location: Vancouver, BC
|
|
Posted: Tue Jun 07, 2011 10:37 am |
|
|
FvM wrote: | Depending on the bootloader configuration, application #fuse setting may be possibly ignored (e.g. when setting the USE_SOFTCONFIGWP switch). In this case, the fuse-settings of the bootloader would be used and oscillator frequencies can be different from what you expect. You should check this. |
Exactly, that's why I tried to restore the fuse settings in main by using the sfr directives but there must be more than what I have now...and i'm not using the USE_SOFTCONFIGWP switch.... |
|
|
|
|
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
|