BootloadHid with atmega8 @12.8Mhz

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
Posts: 14
Joined: Sat Sep 24, 2011 1:53 am

BootloadHid with atmega8 @12.8Mhz

Post by honupata » Sun Feb 17, 2013 7:13 pm


I could use some advice as I already spent really a lot of time on this.

I’m trying to make the BootloadHid work with atmega8 @12.8Mhz without success. (unrecognized device) :?

I know that the hardware is fine because it's working @16Mhz with the same atmega8
It seems also that my fuses are ok because a simple VUSB code works @12.8mhz with them.

I’m using gcc 3.4.6 to have the code fit in the boot section of the atmega8.
I’m using the latest BootloadHid firmware "as is" (bootloadHID.2012-12-08), I only changed the makefile

I also tried this:

Code: Select all

# Name: Makefile
# Project: bootloadHID
# Author: Christian Starkjohann
# Creation Date: 2007-03-19
# Tabsize: 4
# Copyright: (c) 2007 by OBJECTIVE DEVELOPMENT Software GmbH
# License: GNU GPL v2 (see License.txt)
# This Revision: $Id$

DEVICE = atmega8
F_CPU = 12800000
FUSEH = 0xD8
FUSEL = 0x64

AVRDUDE = avrdude -c usbasp -p $(DEVICE)

LDFLAGS += -Wl,--relax,--section-start=.text=$(BOOTLOADER_ADDRESS)

# Omit -fno-* options when using gcc 3, it does not support them.
COMPILE = avr-gcc -Wall -Os -Iusbdrv -I. -mmcu=$(DEVICE) -DF_CPU=$(F_CPU) -DDEBUG_LEVEL=0 # -DTEST_MODE
# NEVER compile the final product with debugging! Any debug output will
# distort timing so that the specs can't be met.

OBJECTS =  usbdrv/usbdrvasm.o usbdrv/oddebug.o main.o

# symbolic targets:
all:   main.hex

   $(COMPILE) -c $< -o $@

   $(COMPILE) -x assembler-with-cpp -c $< -o $@
# "-x assembler-with-cpp" should not be necessary since this is the default
# file type for the .S (with capital S) extension. However, upper case
# characters are not always preserved on Windows. To ensure WinAVR
# compatibility define the file type manually.

   $(COMPILE) -S $< -o $@

   rm -f main.hex main.bin *.o usbdrv/*.o main.s usbdrv/oddebug.s usbdrv/usbdrv.s
   $(AVRDUDE) -U hfuse:w:$(FUSEH):m -U lfuse:w:$(FUSEL):m -U flash:w:main.hex:i -U lock:w:0x2f:m
   #$(AVRDUDE) -U hfuse:r:high.hex:i -U lfuse:r:low.hex:i
   #$(AVRDUDE) -U hfuse:w:$(FUSEH):m -U lfuse:w:$(FUSEL):m -U lock:w:0x3F:m
# file targets:
main.bin:   $(OBJECTS)
   $(COMPILE) -o main.bin $(OBJECTS) $(LDFLAGS)

main.hex:   main.bin
   rm -f main.hex main.eep.hex
   avr-objcopy -j .text -j .data -O ihex main.bin main.hex
   avr-size main.hex

disasm:   main.bin
   avr-objdump -d main.bin

   $(COMPILE) -E main.c

I also try with this fuses

Code: Select all

HFUSE = 0x90
LFUSE = 0x84

Can you help me :D

Thank you

Posts: 17
Joined: Sun Jun 10, 2007 7:10 pm
Location: Melbourne

Re: BootloadHid with atmega8 @12.8Mhz

Post by Bob » Mon Feb 25, 2013 4:08 pm

You can't just recompile BootloadHid firmware for 12.8MHz, it will not work.
You must also make sure that D- and INT0 are the same pin or connnect D- to int0 so that the internal oscillator will self calibrate using the host's USB 1ms frame on the D- signal.
See bootloaderconfig.h

Try this:

Code: Select all

#define USB_CFG_DPLUS_BIT       1 // or any bit in port D that's not used
#define USB_CFG_DMINUS_BIT      2 // 12.8Mhz must use D- and INT0 on the same pin or 2 pins

Connect D+ Resistor to Atmega8 D1
Connect D- Resistor to Atmega8 D2

Posts: 14
Joined: Sat Sep 24, 2011 1:53 am

Re: BootloadHid with atmega8 @12.8Mhz

Post by honupata » Tue Feb 26, 2013 6:07 am

This is WORKING great :D
Thank you so much Bob, you rock!

Post Reply