Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] Help me with HID bootloader as it doesn't work

Status
Not open for further replies.

shuzonudas

Junior Member level 1
Junior Member level 1
Joined
Jan 18, 2011
Messages
15
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,401
i made a HID bootloader.
it programs itself but the problem is that i can not make it to do any work.
when i read and export the hex file there is nothing in that.

now i want a code example and a hex file just to blink a led.

can anyone help me
 

Re: help with bootloader

you have miss to put in your program where to start,check with your bootloader where program start in memory ex org 0x1000,
 
Re: help with bootloader

what code should i write in my my program?

#include <p18f4550.h>
#include <delays.h>


#define REMAPPED_RESET_VECTOR_ADDRESS 0x0800
#define REMAPPED_HIGH_INTERRUPT_VECTOR_ADDRESS 0x0808
#define REMAPPED_LOW_INTERRUPT_VECTOR_ADDRESS 0x0818
extern void _startup (void); // See c018i.c in your C18 compiler dir
#pragma code REMAPPED_RESET_VECTOR = REMAPPED_RESET_VECTOR_ADDRESS


void _reset (void)
{
_asm goto _startup _endasm
}

#pragma config PLLDIV = 5
#pragma config CPUDIV = OSC1_PLL2
#pragma config USBDIV = 2
#pragma config FOSC = HSPLL_HS //Internal oscillator, port function on RA6, EC used by USB
#pragma config WDT = OFF //Disable watchdog timer

#pragma config PWRT = OFF
#pragma config BOR = ON_ACTIVE
#pragma config BORV = 3
#pragma config VREGEN = ON //Internal oscillator, port function on RA6, EC used by USB


#define LEDPin LATDbits.LATD1 //Define LEDPin as PORT D Pin 1
#define LEDTris TRISDbits.TRISD1 //Define LEDTris as TRISD Pin 1
#define LEDPin2 LATDbits.LATD2 //Define LEDPin as PORT D Pin 1
#define LEDTris2 TRISDbits.TRISD2 //Define LEDTris as TRISD Pin 1


void main()
{
LEDTris = 0;//Set LED Pin data direction to OUTPUT
LEDPin = 1;//Set LED Pin
LEDTris2 = 0;//Set LED Pin data direction to OUTPUT
LEDPin2 = 0;//Set LED Pin

while(1)
{
LEDPin = ~LEDPin;//Toggle LED Pin
LEDPin2 = ~LEDPin2;//Toggle LED Pin

Delay10KTCYx(100);//Delay 250K cycles (1 second at 1MHz since each instruction takes 4 cycles)
}

}

thanks for your reply

---------- Post added at 12:53 ---------- Previous post was at 12:49 ----------

will my circuit start working after i press reset button in the hid bootloader ?
 

I presume you are using Hitech C, here is an example how to do it in CCS:
#define CODE_START 0x0800
#build(reset=CODE_START, interrupt=CODE_START+0x08)
#org 0, CODE_START-1 {}
 
Thanks for your reply.
now i can read the hex.
i am using MPLAB C18.
can anyone send me a source code and hex file for the HID bootloader just to blink an LED.
it'll be much more helpful.
and another thing if i burn the code into the pic and reset the pic will start working ???
do i have to add separate power supply?


i am burning :

:020000040000FA
:060000006AEF00F012009F
:020006000000F8
:08000800060EF66E000EF76E05
:10001000000EF86E00010900F550656F0900F550FB
:10002000666F03E1656701D03DD00900F550606F50
:100030000900F550616F0900F550626F0900090071
:10004000F550E96E0900F550EA6E09000900090053
:10005000F550636F0900F550646F09000900F6CF91
:1000600067F0F7CF68F0F8CF69F060C0F6FF61C0C5
:10007000F7FF62C0F8FF0001635302E1645307E039
:100080000900F550EE6E6307F8E26407F9D767C020
:10009000F6FF68C0F7FF69C0F8FF00016507000EB2
:0600A000665BBFD71200F1
:0A00A600FF0EE350036EEF0E01D0D1
:1000B000F30EE76EE72E5AEF00F00C0E026EE76AC1
:1000C000E72E60EF00F0022E5FEF00F0032E58EFF6
:0400D00000F012002A
:0C00D40013EE00F023EE00F0F86A019C2F
:0C00E00004EC00F003EC04F0FDD712006B
:100800006AEF00F0120095928C8295948C948C7211
:100810008C74640EE66E53EC00F0E552F8D71200CB
:020000040030CA
:0100000024DB
:010001000EF0

and after reading it looks like this:

:020000040000FA
:101000006AEF00F0120095928C8295948C948C7209
:101010008C74640EE66E53EC00F0E552F8D71200C3
:10102000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD0
:10103000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC0
:10104000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFB0

....
...
 

can you please send me a hex and source code file that you have tested in your system.
it'll be better if your code is in mplab_c18.
it'll be better if your code only blinks 2 leds on pin 20 and 21.

thanks
 

check on microchip web page in Bootloader,download code source and check where start your program like a 0 x 1000,after don't forget to put in your main where program need to start,very easy.
to blink led,do your own code,(a few lines)if you cannot do this,why you need a bootloader?

check this

**broken link removed**

And


**broken link removed**

also
check your config fuse,you need to put same in your main prog


hope this help
 

thank you cocoloc.
i can write code that can blink an LED.

and I've solved my problem.

i've edited the "USB Device - HID - Simple Custom Demo - C18 - PICDEM FSUSB" firmware.
i've put this code:
...........................................
................................................
.............................
void ProcessIO(void)
{
unsigned char count=00;

TRISB = 0;//Set LED Pin data direction to OUTPUT
PORTB = 0x55;//Set LED Pin

while(1)
{
PORTB = count++; //Toggle LED Pin
Delay10KTCYx(count);//Delay 250K cycles (1 second at 1MHz since each instruction takes 4 cycles)
}


.....................................
....................................
and after compiling it, it worked.

i just wanted the bootloader to debug my next project quickly.
and again thanks for your kind reply.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top