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

CCS - MPLAB BOOTLOADER Problem

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







CCS - MPLAB BOOTLOADER Problem
PostPosted: Thu Aug 16, 2007 4:28 am     Reply with quote

Hello,

I used 18F4550 demo board FS USB as HID USB. I would like to update the firmaware using USB with bootloader. So, I use Microchip standard BOOTLOADER using RB4. It worked with Microchip user'prog example.


So, now I want to download mine and then I got problem. I compile it using CCS PCH 3.235 and here under is the code I would like to download throught PDFSUSB.EXE.

#define _bootload

#ifdef _bootload
#define LOADER_END 0x7FF
#define LOADER_SIZE 0x6FF

#build(reset=LOADER_END+1, interrupt=LOADER_END+9)
#org 0, LOADER_END {}
#endif

void main(void) {

setup_adc_ports(NO_ANALOGS|VSS_VDD);
setup_adc(ADC_OFF);
setup_psp(PSP_DISABLED);
setup_spi(FALSE);
setup_timer_0(RTCC_INTERNAL);
setup_timer_1(T1_DISABLED);
setup_ccp1(ccp_off);
setup_timer_2(T2_DISABLED,0,1);
setup_timer_3(T3_DISABLED|T3_DIV_BY_1);
setup_comparator(NC_NC_NC_NC);
enable_interrupts(GLOBAL);
setup_vref(VREF_LOW|-2);
setup_oscillator(FALSE);


while(1)
{
output_toggle(PIN_A5);
delay_ms(1000);
}

}


Connection with PDFSUSB worked :
I got " PIC DEM FS USB 0 (BOOT)"
Then I tried to program and I got message

USB Read Failed.
Failed with error 6 : Descripteur non valide

Somebody has an idea about that error and why I could program it?





Here under is the setup file of the chip

#include <18F4550.h>
//#device ICD=TRUE removed to test the BOOTLOADER
#device adc=8
#FUSES WDT
#FUSES WDT4 //Watch Dog Timer uses 1:4 Postscale
#FUSES HSPLL //High Speed Crystal/Resonator with PLL enabled
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOBROWNOUT //No brownout reset
#FUSES BORV20 //Brownout reset at 2.0V
#FUSES NOPUT //No Power Up Timer
#FUSES NOCPD //No EE protection
#FUSES STVREN //Stack full/underflow will cause reset
//#FUSES DEBUG //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 NOIESO //Internal External Switch Over mode enabled
#FUSES NOFCMEN //Fail-safe clock monitor enabled
#FUSES NOPBADEN //PORTB pins are configured as analog input channels on RESET
#FUSES NOWRTC //configuration not registers write protected
#FUSES NOWRTB //Boot block not write protected
#FUSES NOEBTR //Memory not protected from table reads
#FUSES NOEBTRB //Boot block not protected from table reads
#FUSES CPB //Boot Block code protection
#FUSES MCLR //Master Clear pin enabled
#FUSES LPT1OSC //Timer1 configured for low-power operation
#FUSES NOXINST //Extended set extension and Indexed Addressing mode disabled (Legacy mode)
#FUSES PLL5 //No PLL PreScaler
#FUSES VREGEN
#FUSES USBDIV
#use delay(clock=48000000)
RockV
Guest







Same error
PostPosted: Mon Mar 31, 2008 12:03 pm     Reply with quote

I have same problem.

Seems to work but don't.

Checking the HEX file I have noticed that there is some code below 800h, I think this could be the problem.

But cant find how to push all the code over the 800h.

Maybe #ORG is not working properly.

RockV
flemse



Joined: 19 Feb 2008
Posts: 5

View user's profile Send private message

PostPosted: Mon Mar 31, 2008 2:31 pm     Reply with quote

Look here.

http://www.etc.ugal.ro/cchiculita/software/picbootloader.htm

http://www.ccsinfo.com/forum/viewtopic.php?t=34065&highlight=tiny+bootloader

//F
meereck



Joined: 09 Nov 2006
Posts: 173

View user's profile Send private message

PostPosted: Mon Mar 31, 2008 3:07 pm     Reply with quote

i worked with Microchip USB bootloader a year ago, and it was pretty successful.
The bootloader itself resides the memory space 0x000-0x7FF (called boot block)
this is how you can force the CCS compiler to put nothing within this space:
Quote:
// START OF bootloader definition
#define LOADER_END 0x7FF
#define LOADER_SIZE 0x6FF
#build(reset=LOADER_END+1, interrupt=LOADER_END+9)
#org 0, LOADER_END {} // nothing will replace the bootloader memory space
// END OF bootloader definition


As for your descriptor error, you surely rewrote something in the bootloader space. Flash the PIC with the bootloader HEX file.

!! As far as I remember, there was a bug somewhere. When the application asks you whether you want to overwrite fuses (Window called "Configuration Data"), I always had to click on Cancel.
In other words, you are not allowed to change Configuration bits (fuses). I havent found out why that occurs.

good luck
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