View previous topic :: View next topic |
Author |
Message |
scanan
Joined: 13 Aug 2004 Posts: 58 Location: Turkey
|
PIC18F6310 Bootloader Problem |
Posted: Thu May 07, 2015 3:21 am |
|
|
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: 19538
|
|
Posted: Thu May 07, 2015 4:38 am |
|
|
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
|
|
Posted: Thu May 21, 2015 1:37 am |
|
|
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: 19538
|
|
Posted: Thu May 21, 2015 3:54 am |
|
|
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
|
|
Posted: Thu May 21, 2015 8:56 am |
|
|
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: 19538
|
|
Posted: Thu May 21, 2015 1:49 pm |
|
|
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
|
|
Posted: Fri May 22, 2015 8:36 am |
|
|
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
|
|
Posted: Fri May 29, 2015 2:54 am |
|
|
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
|
|
Posted: Fri May 29, 2015 3:27 am |
|
|
Thanks for that issue I remenber that I corrected the grammatical error seems the problem persist.
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. |
|
|
|