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

Bootloader PCD for PIC24FJ128GA006

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



Joined: 10 Feb 2004
Posts: 205

View user's profile Send private message

Bootloader PCD for PIC24FJ128GA006
PostPosted: Wed Nov 04, 2009 5:29 pm     Reply with quote

I have the Ex_pcd_bootloader and bootload programs compiled for my chip (the demo board that came with compiler).

I made the following mods to each:
Code:

#if defined PIC24FJ
   #include <24FJ128GA006.h>
   #fuses HS,NOWDT,NODEBUG,PR,  NOWRT, NOPROTECT
   #define PUSH_BUTTON PIN_f6
   //#pin_select U2TX = PIN_C9
   //#pin_select U2RX = PIN_C3
   #device adc=8
   #use delay(clock=2000000)
   #use rs232(baud=9600, UART1)
#endif


I use the ICD to download ex_pcd_bootloader, it runs and I see the "Bootloader Program" message in SIOW. I then compile the Ex_pcd_bootload program with the same mod as above. I reset the board and hold the button down and SIOW shows the bootloader messages correctly. I then do a software download and the little window pops up and sends the program until it gets almost done, then freezes and I get a "timeout while downloading" message. I abort that and the PIC resets and I now see the message from ex_pcd_bootload. Now I cannot bootload again. When I reset and hold the button down, I get no messages until I let go of the button and then I get the "you can put whatever code..." message from ex_pcd_bootload. It almost works, just not all there. What else should I look for? Thanks.

Code:

#define PIC24FJ
//#define PIC24HJ


//This define controls whether or not the bootloader is included in the
//final hex file for programming.(Defined=yes, commented out = no)

//#define _bootloader
#define __PCD__

#if defined PIC24FJ
   #include <24FJ128GA006.h>
   #fuses HS,NOWDT,NODEBUG,PR,  NOWRT, NOPROTECT
   #define PUSH_BUTTON PIN_f6
   //#pin_select U2TX = PIN_C9
   //#pin_select U2RX = PIN_C3
   #device adc=8
   #use delay(clock=20000000)
   #use rs232(baud=9600, UART1)
#endif

//This is a neccessary include file.  It reserves space so that the
//bootloader is not overwritten.
#include "pcd_bootloader.h"

#org default

void main(void)
{
   setup_adc_ports(NO_ANALOGS);
   //setup_adc_ports2(NO_ANALOGS);    //33FJ128GP706 only
   
   delay_ms(100);
   
//On powerup, if the designated button/pin is held low, the program
//will jump to the bootloader, allowing for serial programming.
   if(!input(PUSH_BUTTON))
   {
      #asm
      goto LOADER_ADDR
      #endasm
   }
   
   printf("You can put whatever code you want here.\r\n");
   printf("So enjoy!\r\n");
   
   while(1);
}
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Wed Nov 04, 2009 6:04 pm     Reply with quote

What compiler/bootloader example version you're using? If I remember right, there have been some errors with loader_pcd.c.
ljbeng



Joined: 10 Feb 2004
Posts: 205

View user's profile Send private message

PostPosted: Thu Nov 05, 2009 8:37 am     Reply with quote

I have V4.096 PCWHD and I started with the ex_pcd_bootloader.c and ex_pcd_bootload.c I only modifed the chip name and the push button address. Thanks.
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