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 support@ccsinfo.com

Bootloader

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



Joined: 07 Dec 2005
Posts: 10
Location: Italy

View user's profile Send private message

Bootloader
PostPosted: Mon Mar 27, 2006 3:49 am     Reply with quote

Hi, i am trying to use ccs bootloader on my project based on Pic18F2525 @ 32 Mhz (external clock). I want to use pins RB6 and RB7 for dowload the code.... All my trials failed.
What are the step that i have to follow ?
(for example i try to download the code with ccs port monitor and i receive a time out error)...
bernardinim



Joined: 07 Dec 2005
Posts: 10
Location: Italy

View user's profile Send private message

Bootloader
PostPosted: Mon Mar 27, 2006 9:08 am     Reply with quote

Hi, i am trying to use ccs bootloader on my project based on Pic18F2525 @ 32 Mhz (external clock). I want to use pins RB6 and RB7 for dowload the code.... All my trials failed.
What are the step that i have to follow ?
(for example i try to download the code with ccs port monitor and i receive a time out error)...

MY CODE:

#include <18F2525.h>

#FUSES NOWDT //No Watch Dog Timer
#FUSES WDT1 //Watch Dog Timer uses 1:128 Postscale
#FUSES EC //External clock
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOIESO //Internal External Switch Over mode disabled
#FUSES NOBROWNOUT //Reset when brownout detected
#FUSES BORV20 //Brownout reset at 2.0V
#FUSES PUT //Power Up Timer
#FUSES NOCPD //No EE protection
#FUSES STVREN //Stack full/underflow will cause reset
#FUSES NODEBUG //No Debug mode for ICD
#FUSES NOLVP //Low Voltage Programming on B3(PIC16) or B5(PIC18)
#FUSES NOWRT //Program memory not write protected
#FUSES NOWRTD //Data EEPROM not write protected
#FUSES NOEBTR //Memory not protected from table reads
#FUSES NOCPB //No Boot Block code protection
#FUSES NOEBTRB //Boot block not protected from table reads
#FUSES NOWRTC //configuration not registers write protected
#FUSES NOWRTB //Boot block not write protected
#FUSES NOFCMEN //Fail-safe clock monitor enabled
#FUSES NOXINST //Extended set extension and Indexed Addressing mode disabled (Legacy mode)
#FUSES NOPBADEN //PORTB pins are configured as digital I/O on RESET
#FUSES NOLPT1OSC //Timer1 configured for low-power operation
#FUSES NOMCLR //Master Clear pin enabled

#use delay(clock=32000000)
#use rs232(baud=9600,parity=N,xmit=PIN_B7,rcv=PIN_B6,bits=8)



#define _bootloader


#include <bootloader.h>
#include <loader.c>





#org LOADER_END+2,LOADER_END+20

void application(void) {
while(TRUE);
}


#org 0x40,0x7F

void main(void) {
if(!input(PIN_B3))
{
load_program();
}

application();
}

#ORG default

#int_global
void isr(void) {
jump_to_isr(LOADER_END+5*(getenv("BITS_PER_INSTRUCTION")/8));
}

Ttelmah
Guest







PostPosted: Mon Mar 27, 2006 9:45 am     Reply with quote

You do understand, that the actual 'bootloader', has to be loaded into the chip with a normal programmer, before you can use it?.

Best Wishes
bernardinim



Joined: 07 Dec 2005
Posts: 10
Location: Italy

View user's profile Send private message

bootloader
PostPosted: Mon Mar 27, 2006 9:50 am     Reply with quote

yes.. i know...

It's the first time that i use a bootloader...
What i have to do?

Can u give me a simple example that work.. so i can understand..?
Ttelmah
Guest







PostPosted: Mon Mar 27, 2006 10:10 am     Reply with quote

Start by getting rid of all your #org statements. You only need include bootloader.h, not loader.c. Loader.c, is the bootloader program itself, which has to already be in the chip (which is why I queried this). Your program, will actually 'sit' at 0x500, and attempting to put part of it below this, will overwrite/destroy the bootloader code that is already there. The build statement in bootloader.h, already re-vectors the interrupt handler as required.
Compile ex_bootloader.c, and put this into the chip. Then compile your program, just as normal, but with bootloader.h included. The 'load' is triggered by pulling B5 low.

Best Wishes
bernardinim



Joined: 07 Dec 2005
Posts: 10
Location: Italy

View user's profile Send private message

bootloader
PostPosted: Tue Mar 28, 2006 1:52 am     Reply with quote

Using ccs serial port monitor i receive the error Timeout when downloading ....
I use these port setting (9600,n,8,1 with no software flow control), It's correct?

I not know if the problem is in serial connection during downloading application or in the bootloader....

Please help me.....[/b]
Christophe



Joined: 10 May 2005
Posts: 323
Location: Belgium

View user's profile Send private message

PostPosted: Wed Aug 09, 2006 3:39 am     Reply with quote

Ttelmah wrote:
Start by getting rid of all your #org statements. You only need include bootloader.h, not loader.c. Loader.c, is the bootloader program itself, which has to already be in the chip (which is why I queried this). Your program, will actually 'sit' at 0x500, and attempting to put part of it below this, will overwrite/destroy the bootloader code that is already there. The build statement in bootloader.h, already re-vectors the interrupt handler as required.
Compile ex_bootloader.c, and put this into the chip. Then compile your program, just as normal, but with bootloader.h included. The 'load' is triggered by pulling B5 low.

Best Wishes


Is there another way to trigger the bootloader program? Eg. a special character on the serial port like '@' or so?

Being triggered by pulling B5 low is a hardware issue, difficult to do that.
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