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 for 18F4525

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



Joined: 23 Apr 2009
Posts: 42

View user's profile Send private message

Bootloader for 18F4525
PostPosted: Sat Apr 25, 2009 6:00 am     Reply with quote

Hi,

My name is koen and I have been looking around here for a good bootloader.
The tiny bootloaders seems a good option.
How to implement this is a big ? for me.

So as I understand I need to do 4 things to get this up and running

1) program the PIC via MPLAB ICD2.
I did use the tinybld18F2620.HEX.
Do I need to change something in this file?
Do I need to compile?


2) after having the PIC programmed I startup the TinyBld software
I have used the good comport but after reset and pressing the button Check PIC
Connected to \\.\COM1 at 115200
Searching for PIC ...Not found,
ERROR!


3) In the source code below I need to add a ORG statement or something else?
Where should I place this and what exactly?
I am using the CCS compiler version 4.065

Code:

#include <18F4525.h>

   
#device adc=10


#FUSES NOWDT                    //No Watch Dog Timer
#FUSES WDT128                   //Watch Dog Timer uses 1:128 Postscale
#FUSES INTRC_IO                       //High speed osc with HW enabled 4X PLL
#FUSES NOPROTECT                //Code not protected from reading
#FUSES NOIESO                   //Internal External Switch Over mode disabled
#FUSES NOBROWNOUT               //No brownout reset
#FUSES BORV21                   //Brownout reset at 2.1V
#FUSES NOPUT                    //No Power Up Timer
#FUSES NOCPD                    //No EE protection
#FUSES NOSTVREN                 //Stack full/underflow will not cause reset
#FUSES NODEBUG                  //No Debug mode for ICD
#FUSES NOLVP                    //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#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 disabled
#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 RESERVED                 //Used to set the reserved FUSE bits
#FUSES MCLR                     //Master Clear pin enabled

#use delay(clock=32000000)

#use rs232(baud=38400,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8,DISABLE_INTS,STREAM=NETWERK)


//----------------------------------------------------------------
#INT_RDA
void SerialDataAvailable() {
     if(kbhit(NETWERK))
     {
      ReadSerialData();
    }
}
//----------------------------------------------------------------
void main()
{
   setup_oscillator (osc_8MHZ | OSC_PLL_ON);

   setup_uart(1);
   delay_ms(300);
   
   
   //-----------------------------------------------------------------------------------------------------------------------------------------------------
   set_tris_a (0xFF);
   set_tris_b (0x7F);
   set_tris_c (0xB9);
   set_tris_d (0xF0);
   set_tris_e (0XF8);   
   //-----------------------------------------------------------------------------------------------------------------------------------------------------

   while (1)
   {

      output_bit(PIN_D1   ,1);
      delay_ms(2);
      output_bit(PIN_D1   ,0);
      delay_ms(2);

   }
}


4) after compiling this I and good connection to the hardware (need to solve Question 2 first)
I need to open this hexfile and download it to the processor.
And then hocus pocus it should run... not for me... (Bummer)


So if there is someone who would like to help me or has a link to a good manual I would be thankful



Thanks in advance Smile

Kind Regards Rolling Eyes


Koen Bielen
koenbielen



Joined: 23 Apr 2009
Posts: 42

View user's profile Send private message

Bootloader is up and running
PostPosted: Sat Apr 25, 2009 4:13 pm     Reply with quote

Bootloader is up and running Laughing Laughing Laughing

Thanks

Kind Regards

Koen
misperry



Joined: 03 Mar 2009
Posts: 40

View user's profile Send private message

PostPosted: Tue May 19, 2009 9:49 am     Reply with quote

How did you get your problem fixed if I might ask cuz I am running into the same thing.

Thanks!
Guest








PostPosted: Wed May 20, 2009 5:12 am     Reply with quote

Hi,

I added some code
#define MAX_FLASH 0xC000 //for PICs with 48KB of mem

#define LOADER_SIZE 0xFF //tinybld size + a bit more (200 bytes is enough)

#org MAX_FLASH-LOADER_SIZE , MAX_FLASH-1 {}
as below and changed the internal osc in the bootloader file.

Code:

#include <18F4525.h>

   
#device adc=10


#FUSES NOWDT                    //No Watch Dog Timer
#FUSES WDT128                   //Watch Dog Timer uses 1:128 Postscale
#FUSES INTRC_IO                       //High speed osc with HW enabled 4X PLL
#FUSES NOPROTECT                //Code not protected from reading
#FUSES NOIESO                   //Internal External Switch Over mode disabled
#FUSES NOBROWNOUT               //No brownout reset
#FUSES BORV21                   //Brownout reset at 2.1V
#FUSES NOPUT                    //No Power Up Timer
#FUSES NOCPD                    //No EE protection
#FUSES NOSTVREN                 //Stack full/underflow will not cause reset
#FUSES NODEBUG                  //No Debug mode for ICD
#FUSES NOLVP                    //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#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 disabled
#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 RESERVED                 //Used to set the reserved FUSE bits
#FUSES MCLR                     //Master Clear pin enabled


#define MAX_FLASH 0xC000 //for PICs with 48KB of mem

#define LOADER_SIZE   0xFF   //tinybld size + a bit more (200 bytes is enough)

#org MAX_FLASH-LOADER_SIZE , MAX_FLASH-1 {}


#use delay(clock=32000000)

#use rs232(baud=38400,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8,DISABLE_INTS,STREAM=NETWERK)


//----------------------------------------------------------------
#INT_RDA
void SerialDataAvailable() {
     if(kbhit(NETWERK))
     {
      ReadSerialData();
    }
}
//----------------------------------------------------------------
void main()
{
   setup_oscillator (osc_8MHZ | OSC_PLL_ON);

   setup_uart(1);
   delay_ms(300);
   
   
   //-----------------------------------------------------------------------------------------------------------------------------------------------------
   set_tris_a (0xFF);
   set_tris_b (0x7F);
   set_tris_c (0xB9);
   set_tris_d (0xF0);
   set_tris_e (0XF8);   
   //-----------------------------------------------------------------------------------------------------------------------------------------------------

   while (1)
   {

      output_bit(PIN_D1   ,1);
      delay_ms(2);
      output_bit(PIN_D1   ,0);
      delay_ms(2);

   }
}




Hope this helps

Byby

Razz Razz Razz
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