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

18f87k22 bootloader

 
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

18f87k22 bootloader
PostPosted: Thu Mar 10, 2011 3:18 pm     Reply with quote

Hi There,

I'm back at my bootloader issue.
I started from scratch and took ex_bootloader.c, bootloader.h and loader.c, created a new project in MPLAB, changed the include and frequency and compiled and it shows me "The configuration bits in the file are invalid....Config Field: SOSCSEL" but i can't find any SOSCSEL definition anywhere in the files...I hit "no" to not load the defaults - any clue what this exactly means?
I downloaded the binary to my pic with the ICD3, connected pin B5 to ground and hit reset. I opened TeraTerm, set the baudrate to 9600 and the flowcontrol to Xon/Xoff, 8 data bit, no parity, 1 stopbit, went to SendFile and selected my hex file, it seemed to be sending something and on top of the terminal i saw a few "`à" appearing once done, I disconnected B5 from GND and hit reset again but nothing, my application isn't there - fine i thought, I put a couple of debugging printf()s into the main():
Code:
void main(void) {
   if(!input(PIN_B5))
   {
      printf("load_program()");
      load_program();
   }
   printf("application()");
   application();
}
but nothing is being printed at all when booting up... :( Any clues what my problem might be?
Thank you!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Mar 10, 2011 3:27 pm     Reply with quote

Quote:
The configuration bits in the file are invalid....Config Field: SOSCSEL

You can get this error if the .h file in the #include statement at the top
of your program does not have the same PIC as is set in the MPLAB
Configure / Select Device menu.

MPLAB and your C source program must have the same PIC specified.
cerr



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

View user's profile Send private message

PostPosted: Thu Mar 10, 2011 3:30 pm     Reply with quote

I have selected 18F87K22 in both spots... Sad
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Mar 10, 2011 3:40 pm     Reply with quote

Compile this test program. Select the same PIC in the MPLAB Configure /
Select Device menu.
Code:

#include <18F87K22.h>
#fuses XT, NOWDT, BROWNOUT, PUT
#use delay(clock=4M)

//=========================================
void main()
{     


while(1);
}

If it gives an error, then post:

1. MPLAB version
2. CCS compiler version
3. MPLAB mode: Debug or Release
4. The programmer or debugger tool (ex. ICD2) selected in MPLAB
Programmer or Debugger menus.
cerr



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

View user's profile Send private message

PostPosted: Thu Mar 10, 2011 4:00 pm     Reply with quote

That worked fine.
Okay, I did exactly the same but selected my bootloader.c as the source file and
BANG, there the SOSCSEL error message shows again... Question I'm using MPLAB 8.63 and CCS 4.119 with an ICD3
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Mar 10, 2011 4:20 pm     Reply with quote

I don't know. Maybe you're doing something wrong in your Project
window for MPLAB. Only the main source file should be "in the project"
in MPLAB for CCS. You don't "add" all the other files to the project
window.

See this thread:
http://www.ccsinfo.com/forum/viewtopic.php?t=42718&start=4


And carefully check all files in the project. I will bet that one of them
has an #include for some other PIC, other than the 18F87K22.
cerr



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

View user's profile Send private message

PostPosted: Thu Mar 10, 2011 4:45 pm     Reply with quote

DOH! Found it, only changed the first include in bootloader.c but not the second one in #elif defined(__PCH__)
However, get to compile it correctly now but I get this:
*** Error 71 "bootloader.c" Line 89(0,1): Out of ROM, A segment or the program is too large MAIN
Seg 00040-0007E, 0040 left, need 005E

I removed the two printf() lines I added above and now it compiled just fine...

The top part in my bootloader.c now looks like:
Code:

#elif defined(__PCH__)
#include <18F87K22.h>
#fuses HSM,NOWDT,NOPROTECT
#FUSES NOPLLEN
#FUSES BBSIZ1K                     //1K words Boot Block size
#FUSES NOXINST                     //Extended set extension and Indexed Addressing mode disabled (Legacy mode)
#use delay(clock=10000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)  // Jumpers: 8 to 11, 7 to 12
#endif
cerr



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

View user's profile Send private message

PostPosted: Thu Mar 10, 2011 5:18 pm     Reply with quote

So I downloaded the now supposedly correct bootloader, and did the B5 GND - reset, TeraTerm download thing again but it still isn't working Sad Any other clues?
cerr



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

View user's profile Send private message

PostPosted: Fri Mar 11, 2011 11:15 am     Reply with quote

I got microchip application note AN1310 working fine on my 18f87k22 on the picdem pic18 explorer demo board. I can properly enter the bootloader mode by selecting the "break" button in the delivered software which pulls pin B1 to GND. This works well but when I manually hook pin B1 up to GND and reset the PIC, it won't enter the bootloader mode, i'm not getting it! Why does this not work? by pressing the "break" button in the pc software, we're setting the RTS pin which again is connected to reset pin B1....
same manually isn't working - that may also be the reason why I can't get the CCS bootloader working for me... any clues?
Thank you!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Mar 11, 2011 5:36 pm     Reply with quote

I don't have your PIC, but I was able to make it work with an 18F45K22.
To make it work, I had to do this:

1. Edit Ex_Bootloader.c as shown below in bold:
Quote:

#elif defined(__PCH__)
#include <18F45K22.h>
#fuses HSH,NOWDT,NOPROTECT,NOPLLEN

#use delay(clock=20000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)
#endif

and also in this section:
Quote:

#if defined(__PCH__)
#org 0x40,0x9F // *** WAS 0x7F
#else
#org 0x20,0x3F
#endif
void main(void) {

2. Edit the Ex_Bootload.c file as shown below in bold:
Quote:

#elif defined(__PCH__)
#include <18F45K22.h>
#fuses HSH,NOWDT,NOPROTECT,NOPLLEN

#use delay(clock=20000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)
#endif

(Note: This is a different file than Ex_Bootloader.c)

Then use TeraTerm to follow the instructions in this link exactly:
http://www.ccsinfo.com/forum/viewtopic.php?t=40920&start=1

If it doesn't work, possible reasons are:

1. You forgot to select the correct PIC in the MPLAB Configure/ Select
Device menu, for both programs. In my case, this is 18F45K22.

2. You forgot to add the NOPLLEN setting to the #fuses in both files.

3. You forgot to enable Xon/Xoff in TeraTerm, in the Setup / Serial Port/
Flow Control window. Note: TeraTerm doesn't retain this setting when
you shut down the program, unless you specifically "save" the settings.
It won't work without Xon/Xoff enabled and it is very easy to
shut down TeraTerm, start it back up, and forget to re-enable Xon/Xoff.

4. You forgot to unplug the ICD2 after programming Ex_bootloader.hex
into the PIC, or you forgot to jumper pin B5 to ground, or you forgot to
press the reset button on the board prior to downloading the application
program.

5. You accidently used TeraTerm to send the source file of the application
program, Ex_Bootload.c, instead of the hex file, Ex_Bootload.hex.
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