Porting BootloadHID to mega64 BOOTLOADER_ADDRESS ??

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
STB
Posts: 7
Joined: Tue Jan 15, 2008 8:43 am

Porting BootloadHID to mega64 BOOTLOADER_ADDRESS ??

Post by STB » Mon Mar 24, 2008 4:06 pm

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
Last edited by STB on Mon Mar 24, 2008 6:11 pm, edited 1 time in total.

STB
Posts: 7
Joined: Tue Jan 15, 2008 8:43 am

Post by STB » Mon Mar 24, 2008 6:03 pm

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

muenchner
Posts: 2
Joined: Mon Mar 24, 2008 10:06 pm

Likewise problem

Post by muenchner » Mon Mar 24, 2008 10:27 pm

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

STB
Posts: 7
Joined: Tue Jan 15, 2008 8:43 am

Post by STB » Tue Mar 25, 2008 8:51 pm

Use

BOOTSZ1 = 0
BOOTSZ0 = 0

for a 1024 word bootloader on the mega16.

BOOTLOADER_ADDRESS = 3800


Regards,

Dirk

muenchner
Posts: 2
Joined: Mon Mar 24, 2008 10:06 pm

It works :D

Post by muenchner » Wed Mar 26, 2008 2:37 am

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

christian
Objective Development
Objective Development
Posts: 1443
Joined: Thu Nov 09, 2006 11:46 am

Post by christian » Fri Mar 28, 2008 3:06 pm

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.

sidhantgupta

Hey!

Post by sidhantgupta » Thu Apr 17, 2008 7:11 am

I did not get it!

I am trying to figure out BOOTLOADER_ADDRESS for atmega8.

Can you explain me how to find it?

Thanks!

christian
Objective Development
Objective Development
Posts: 1443
Joined: Thu Nov 09, 2006 11:46 am

Post by christian » Thu Apr 17, 2008 9:22 am

8k flash size minus 2k boot loader = 6k, or in hex 1800.

Guest

Post by Guest » Fri Apr 18, 2008 11:26 pm

Thanks! :)

I was unnecessarily confusing myself :)

Post Reply