Andre_Pretorius
- 6th January 2009, 18:27
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?
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
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?
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