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

PIC18F6310 Bootloader Problem

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



Joined: 13 Aug 2004
Posts: 58
Location: Turkey

View user's profile Send private message Visit poster's website

PIC18F6310 Bootloader Problem
PostPosted: Thu May 07, 2015 3:21 am     Reply with quote

Hello ,

I have problem with the bootloader. I can't make it compile with PIC18f6310
any help?

cheers
_________________
Dr Suleyman CANAN
R&D Electronic Engineer
https://suleymancanan.wordpress.com

Do whatever you do with amateur spirit -
But always feel professional.
Ttelmah



Joined: 11 Mar 2010
Posts: 19244

View user's profile Send private message

PostPosted: Thu May 07, 2015 4:38 am     Reply with quote

The procedure for the bootloader is always the same:

1) Get a program running properly in your chip _without_ the bootloader.
Make sure it can talk to your serial port, detect the pin you are going to use to trigger the bootloader, and runs at the correct rate.

2) Then record the fuse/UART settings for this, and copy these into the bootloader file. Use these fuses for the bootloader, and and code you are going to bootload. So replace (for example), the section:
Code:

#elif defined(__PCH__)
*#include <18F45K22.h>
#fuses NOWDT
#use delay(crystal=16MHz)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)
#endif

In the ex_bootloader.c file, with the one for your chip. Say (for your chip at 20Mhz):
Code:

#elif defined(__PCH__)
#include <18F6310.h>
#fuses HS,BROWNOUT, BORV43,STVREN,NOMCLR,STVREN,NOMCLR
#device ADC=10
#use delay(crystal=20000000)
#use rs232(UART1,ERRORS,baud=9600)
#define PUSH_BUTTON PIN_A4
#endif

Save this as (perhaps) 'yourbootloader.c', and compile this

Then use ex_bootload.c, as the sample for your 'loadable' program, again replacing the processor/fuses with a duplicate of these, and adding your main code.

The bootloader _always_ needs to be customised to match _your_ hardware.
scanan



Joined: 13 Aug 2004
Posts: 58
Location: Turkey

View user's profile Send private message Visit poster's website

PostPosted: Thu May 21, 2015 1:37 am     Reply with quote

Here is the modification that I did
on EX_BOOTLOADER.C
but I get "A #DEVICE required before this line" error
what couldn't the the problem

*I did successfully compilation with the original EX_BOOTLOADER.C

cheers
Code:

if defined(__PCM__)
#include <16F877.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=20000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)  // Jumpers: 8 to 11, 7 to 12

#elif defined(__PCH__)
#include <18F6310.h>
//#fuses HS,NOWDT,NOPROTECT,NOLVP
#FUSES NOWDT,INTRC_IO,NOBROWNOUT,PUT,NOSTVREN,NODEBUG,NOFCMEN,NOXINST,NOPROTECT,NOLPT1OSC,NOMCLR
#use delay(clock=16000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)  // Jumpers: 8 to 11, 7 to 12
#endif

_________________
Dr Suleyman CANAN
R&D Electronic Engineer
https://suleymancanan.wordpress.com

Do whatever you do with amateur spirit -
But always feel professional.
Ttelmah



Joined: 11 Mar 2010
Posts: 19244

View user's profile Send private message

PostPosted: Thu May 21, 2015 3:54 am     Reply with quote

Missing # on the first line. So it sees it as a 'if' (code instruction), not as '#if' (pre-processor instruction). Code can't run without knowing the processor....
scanan



Joined: 13 Aug 2004
Posts: 58
Location: Turkey

View user's profile Send private message Visit poster's website

PostPosted: Thu May 21, 2015 8:56 am     Reply with quote

here the complete file
but still
#DEVICE required before this line
error


Code:
///////////////////////////////////////////////////////////////////////////
////                      EX_BOOTLOADER.C                              ////
to_isr(LOADER_END+5*(getenv("BITS_PER_INSTRUCTION")/8));



+++++++++++++++++++
Bootloader code removed.
Reason: Forum rule #10:
10. Don't post the CCS example code or drivers
http://www.ccsinfo.com/forum/viewtopic.php?t=26245
- Forum Moderator
+++++++++++++++++++

_________________
Dr Suleyman CANAN
R&D Electronic Engineer
https://suleymancanan.wordpress.com

Do whatever you do with amateur spirit -
But always feel professional.
Ttelmah



Joined: 11 Mar 2010
Posts: 19244

View user's profile Send private message

PostPosted: Thu May 21, 2015 1:49 pm     Reply with quote

You are not possibly compiling in MPLAB?.

You would see this error if one or more of the files bootloader.h, or loader.c had been included in the project files.
scanan



Joined: 13 Aug 2004
Posts: 58
Location: Turkey

View user's profile Send private message Visit poster's website

PostPosted: Fri May 22, 2015 8:36 am     Reply with quote

Hi
Discovered that PIC18F6310 don't have self programming feature
cheers
_________________
Dr Suleyman CANAN
R&D Electronic Engineer
https://suleymancanan.wordpress.com

Do whatever you do with amateur spirit -
But always feel professional.
kWoody_uk



Joined: 29 Jan 2015
Posts: 47
Location: United Kingdom

View user's profile Send private message

PostPosted: Fri May 29, 2015 2:54 am     Reply with quote

Scanan,

I assume your signature is intended to be ironic?

Quote:

Do what you ever do with amateur spirit.
But always feel profesionnal


It's spelt professional!! My spelling OCD kicking in ;-)

And for correct grammar, change it to the following

Do whatever you do with amateur spirit -
But always feel professional.

Keith
scanan



Joined: 13 Aug 2004
Posts: 58
Location: Turkey

View user's profile Send private message Visit poster's website

PostPosted: Fri May 29, 2015 3:27 am     Reply with quote

Thanks for that issue I remenber that I corrected the grammatical error seems the problem persist. Smile

kWoody_uk wrote:
Scanan,

I assume your signature is intended to be ironic?

Quote:

Do what you ever do with amateur spirit.
But always feel profesionnal


It's spelt professional!! My spelling OCD kicking in ;-)

And for correct grammar, change it to the following

Do whatever you do with amateur spirit -
But always feel professional.

Keith

_________________
Dr Suleyman CANAN
R&D Electronic Engineer
https://suleymancanan.wordpress.com

Do whatever you do with amateur spirit -
But always feel professional.
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