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

bootloader<->user application configuration

 
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

bootloader<->user application configuration
PostPosted: Mon Jun 06, 2011 3:51 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Jun 06, 2011 4:29 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Jun 07, 2011 6:58 am     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Jun 07, 2011 10:37 am     Reply with quote

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.... Sad
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