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

USB bootloader

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



Joined: 30 Jan 2007
Posts: 56
Location: Viana do Castelo - Portugal

View user's profile Send private message

USB bootloader
PostPosted: Fri Apr 20, 2007 5:25 am     Reply with quote

Hi

I'm testing the usb bootloader, but i haven't sucess.
In the fuses have #fuses HSPLL,NOWDT,NOPROTECT,NOLVP,NODEBUG,USBDIV,PLL5,CPUDIV1,VREGEN,NOPBADEN,WRTB
When load the hex file don't give-me any warnings.

the problem is I don't know exactly i have to put for #org and #build.

i have tested some i found in the forum and didn't work.

Someone can help-me?

Thanks
NicolasC



Joined: 14 Sep 2006
Posts: 27

View user's profile Send private message

PostPosted: Fri Apr 20, 2007 5:39 am     Reply with quote

Hello

This is what I have in my main .c file for a PIC18F2550

Code:

#include "bootloader.h"
#fuses HSPLL,NOWDT,NOPROTECT,NOLVP,NODEBUG,USBDIV,PLL5,CPUDIV1,VREGEN,NOPBADEN,WRTB



bootloader.h
Code:

#if defined(__PCM__)
   #define LOADER_END   0x1FF
   //#define LOADER_SIZE   0x1BF
#elif defined(__PCH__)
   #define LOADER_END   0x7FF
   //#define LOADER_SIZE   0x6FF
#endif

#ifndef _bootloader
#define _bootloader
#if defined(__PCM__)
   #build(reset=LOADER_END+1, interrupt=LOADER_END+5)
#elif defined(__PCH__)
   #build(reset=LOADER_END+2, interrupt=LOADER_END+9)
#endif

#org 0, LOADER_END void bootloader(void) {}

#endif


Regards
joven



Joined: 30 Jan 2007
Posts: 56
Location: Viana do Castelo - Portugal

View user's profile Send private message

PostPosted: Fri Apr 20, 2007 8:35 am     Reply with quote

i'm using 18F4550 the memory is the same?

Isn't working.

the message of PSUSB is nÂș 6 the indicator is invalid.
What can be?
meereck



Joined: 09 Nov 2006
Posts: 173

View user's profile Send private message

PostPosted: Tue Apr 24, 2007 5:18 am     Reply with quote

The USB bootloader stopped to work after you had downloaded an user application, I guess.
I had several problems with fuses as well. I found out that when Pdfsusb application asks you what to do with the fuses, I have to click on "Cancel". Otherwise the bootloader sometimes stopped to work.

Flash a PIC with the bootloader again and use the following stencil for an user application (change your USB settings in fuses):
Code:

#include <18f2455.h>
#device ADC=10 // 10 bits return value from ADC
#fuses HSPLL,NOWDT,NOPROTECT,NOLVP,NODEBUG,USBDIV,PLL6,CPUDIV1,VREGEN,NOPBADEN,WRTB,MCLR,NOCPD,NOWRTC

#use delay(clock=48000000)// full speed USB device
#use rs232(baud=19200,xmit=PIN_C6, rcv=PIN_C7, STREAM=RS232)

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

#define TICKS_PER_SECOND 183 //183 how often per second is timerirq routine called

byte timing = 0;

#int_rtcc
void timerirq()
   {
      if(++timing==TICKS_PER_SECOND){fprintf(RS232,"irq\r\n");
      timing=0;output_toggle(PIN_B0);}
   }

void main()
   {
      fprintf(RS232,"load\r\n");
      output_low(PIN_B0);
      set_timer0(0);
        setup_counters( RTCC_INTERNAL, RTCC_DIV_256 | RTCC_8_BIT);
      enable_interrupts(INT_RTCC);
      enable_interrupts(GLOBAL);
      while(1);
         
   }
joven



Joined: 30 Jan 2007
Posts: 56
Location: Viana do Castelo - Portugal

View user's profile Send private message

PostPosted: Sun Apr 29, 2007 1:41 pm     Reply with quote

Thanks meereck.

I've put work. i used the hex file and the pc program in c# i found in http://eegeek.net/content/view/27/32/1/4/
softjad



Joined: 21 Sep 2006
Posts: 3

View user's profile Send private message

PostPosted: Thu Jun 21, 2007 4:27 pm     Reply with quote

How can I use this bootloader in automatic mode (without manual reset...)?

Thanks
joven



Joined: 30 Jan 2007
Posts: 56
Location: Viana do Castelo - Portugal

View user's profile Send private message

PostPosted: Thu Jun 21, 2007 5:54 pm     Reply with quote

try this program http://eegeek.net/random_serve/PIC/USBBL3.zip
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