Bootloader


Closed Thread
Results 1 to 4 of 4

Thread: Bootloader

  1. #1

    Default Bootloader

    Can someone please help me i am trying to get a boot loader working(first timer) i use the microchip loader for the 18F4550 over USB

    The problem is that everything works the first time but when i open my hex file the loader comes up with a message that the config differs from the board, if i choose to use the board everything keeps on working but when i use the config from the hx file it seems to overite something in the bootloader code. after the chip resets the program works but i can't go back into bootloader mode. here is my code anyone got any ideas?

    Code:
    INCLUDE "MODEDEFS.BAS"
    
    DEFINE LOADER_USED 1
    DEFINE RESET_ORG 1000h ' For Microchip USB Bootloader
    
    DEFINE OSC 20				' Define crystal as 20Mhz
    
    'Define ACDIN parameters
    Define ADC_BITS 10 			' Set number of bits in result
    DEFINE ADC_CLOCK 3 			' Set clock source ( 3 = RC )
    DEFINE ADC_SAMPLEUS 50 		' Set sampling time to micro-seconds
    
    'This Part set PORTA 0-3 an analog inputs,4 as digital 
    TRISA = %00011111 			'set PORTA 0-5 as inputs
    ADCON1 = %00001010 			'ADC use vss and vdd as ref.
    ADCON2 = %10000111			'FRC (clock derived from A/D RC oscillator),Right justify output
    
    TRISC = %10000000
    TRISD = %00001111			'Set port d 0-3 as inputs and 4-7 as outputs
    TRISB = %10011000
    
    '**************************************Serial port setup*************************************
    '*Serial port Setup 9600 8N1*
    DEFINE HSER_BAUD 9600 		; 9600 Baud 
    DEFINE HSER_RCSTA 90h 		' Enable serial port & continuous receive
    DEFINE HSER_TXSTA 24h 		' Enable transmit, BRGH = 1
    DEFINE HSER_CLROERR 1 		; Clear overflow automatically
    DEFINE HSER_SPBRG 129 
    
    '**************************************Variables*********************************************
    buffer	Var	Byte[16]
    cnt	Var	Byte
    LED	Var	PORTD.4
    
    
    USBInit
    Low LED		' LED off
    
    '**************************************Main Program******************************************
    
    idleloop:
    	PORTD.7 = 1
    	PAUSE 1000
    	PORTD.7 = 0
    	PAUSE 1000
    
    
    	Goto idleloop	' Wait for next buffer
    
    
    END

  2. #2
    Join Date
    Jul 2003
    Posts
    2,405

    Default

    The Microchip USB loader expects the CPU core to be running at 48MHz. Just change your
    DEFINE OSC to 48, and accept the default config settings - unless you know enough to
    modify the USB C loader firmware to operate at a different oscillator speed.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  3. #3

    Default

    Hi there i have changed my cristal to a 48M but now my bootloader does not work, after mor reading on this forum i came to another link saying the bootloader works on 20M
    http://www.picbasic.co.uk/forum/showthread.php?t=5590
    if i go back to a 20M everything seems to work the problem seemed to be that the config in the include file (18f4550.inc) and in the microchip main.c needs to be the same.

    Now i have another question since i have 48M cristals how do you convert the bootloader to work on 48M??

  4. #4

    Default

    I know this is not the c forum but mabe someone can help this is the config i have in the main.c file of the bootloader is this correct and is there other places i have to edit to get it working my PC keeps on poping up with unregognised device
    Code:
    #if defined(PIC18F4550_PICDEM_FS_USB)		// Configuration bits for PICDEM FS USB Demo Board
            #pragma config PLLDIV   = 12         // (48 MHz crystal on PICDEM FS USB board)
            #pragma config CPUDIV   = OSC1_PLL2	
            #pragma config USBDIV   = 2         // Clock source from 96MHz PLL/1
            #pragma config FOSC     = HSPLL_HS
            #pragma config FCMEN    = OFF
            #pragma config IESO     = OFF
            #pragma config PWRT     = OFF
            #pragma config BOR      = ON
            #pragma config BORV     = 3
            #pragma config VREGEN   = ON		//USB Voltage Regulator
            #pragma config WDT      = OFF
            #pragma config WDTPS    = 32768
            #pragma config MCLRE    = ON
            #pragma config LPT1OSC  = OFF
            #pragma config PBADEN   = OFF

Similar Threads

  1. PIC18F4680 bootloader
    By vinyl_theif in forum General
    Replies: 1
    Last Post: - 29th January 2009, 17:45
  2. 18F4550 Bootloader enter via eeprom setting
    By bradb in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 22nd November 2008, 23:51
  3. USBDemo with Bootloader
    By vacpress in forum USB
    Replies: 4
    Last Post: - 25th January 2007, 22:29
  4. Bootloader Problems
    By rossfree in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 11th February 2005, 17:51
  5. Replies: 3
    Last Post: - 26th January 2005, 13:41

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts