Page 1 of 1

Porting BootloadHID to mega64 BOOTLOADER_ADDRESS ??

Posted: Mon Mar 24, 2008 4:06 pm
by STB
Hi !

I'm trying to port the BootloadHID to the mega64.

The entry BOOTLOADER_ADDRESS is unclear to me, i do not understand, why it is pointing to 0x1800 on the mega8 in my opinion this must be 0x0C00. I never worked with code in the bootblock area.

Who can explain me what BOOTLOADER_ADDRESS is used for.

Regards,

Dirk

P.S.: The USB stack is a piece of great work, im currently using ist to emulate a Keyboard, Mouse and some data Transfer which works perfect on the mega64

Posted: Mon Mar 24, 2008 6:03 pm
by STB
I managed it myself.

For all other who want to use it with the mega64, only a few changes are to apply.

Makefile:

Code: Select all

DEVICE = atmega64
BOOTLOADER_ADDRESS = F800


main.c

Code: Select all

GICR = (1 << IVCE);  /* enable change of interrupt vectors */
GICR = (1 << IVSEL); /* move interrupts to boot flash section */
(...)
GICR = (1 << IVCE);  /* enable change of interrupt vectors */
GICR = (1 << IVSEL); /* move interrupts to boot flash section */

change to:

Code: Select all

MCUCR = (1 << IVCE);  /* enable change of interrupt vectors */
MCUCR = (0 << IVSEL); /* move interrupts to application flash section */
(...)
MCUCR = (1 << IVCE);  /* enable change of interrupt vectors */
MCUCR = (1 << IVSEL); /* move interrupts to boot flash section */



Regards,

Dirk

Likewise problem

Posted: Mon Mar 24, 2008 10:27 pm
by muenchner
Hello,

i have an analog problem: I want to use BootloadHID on a mega16 with a 16Mhz crystal. I already changed the frequency in bootloaderconfig.h to "#define USB_CFG_CLOCK_KHZ 16000".
Looking at the documentation of the mega64 i got out, why to use MCUCR instead of GICR on a mega64 (just searched for IVCE and voila), but concerning the BOOTLOADER_ADDRESS i'm lost.

Regards
Johannes

Posted: Tue Mar 25, 2008 8:51 pm
by STB
Use

BOOTSZ1 = 0
BOOTSZ0 = 0

for a 1024 word bootloader on the mega16.

BOOTLOADER_ADDRESS = 3800


Regards,

Dirk

It works :D

Posted: Wed Mar 26, 2008 2:37 am
by muenchner
With the settings provided by Dirk it correctly shows up on my mac. :) On my linux box i still get an error about not correctly assigning an address; but as the device is intended to run with the mac it's no problem. - Tomorrow i will take an oscilloscope and look at the crystal if it's within the 1% tolerance mentioned in "bootloaderconfig.h".

Many thanks,

Johannes

Posted: Fri Mar 28, 2008 3:06 pm
by christian
Crystals never have deviations of more than several 100 ppm. That's certainly within the tolerance (of much less than 1% for crystal clocks, BTW).

If it works on one computer but not on another, you probably have voltage level problems on D+ and D-. Please have a look at the zener diodes and voltage levels.

Hey!

Posted: Thu Apr 17, 2008 7:11 am
by sidhantgupta
I did not get it!

I am trying to figure out BOOTLOADER_ADDRESS for atmega8.

Can you explain me how to find it?

Thanks!

Posted: Thu Apr 17, 2008 9:22 am
by christian
8k flash size minus 2k boot loader = 6k, or in hex 1800.

Posted: Fri Apr 18, 2008 11:26 pm
by Guest
Thanks! :)

I was unnecessarily confusing myself :)