Page 1 of 1
Need help with bootloaderHID
Posted: Wed Jan 21, 2009 12:03 am
by epsilon_da
HI.
I am trying to make my previous work with avr-usb bootloadable. For that i needed to change the fuses and the device doesnt work any more.
It is an ATmega32, previous fuses were H: 0xC9 L:0xEF
It uses an external 16 Mhz Crystal.
Now i changed the fuses to H: 0xC9 L:0xE9 to use the biggest boot load section and install bootloaderHID on it.
I used the
Fuse Calculator to do this.
I cant flash the device any more.
This is the error message everytime that i try to flash anything.
Code: Select all
avrdude -c usbasp -p atmega32 -U hfuse:w:0xce:m -U lfuse:w:0xe9:m
avrdude: error: programm enable: target doesn't answer. 1
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.
It is powered from USB with 5V and the programmer is USB-ASP.
It cant be broken. I did nothing more than change one flag with the Fuses Calculator.
Please, i only have this ATmega32 and for buying other one i have to wait an entire month, to what? burn it again?.
Posted: Wed Jan 21, 2009 3:47 am
by epsilon_da
I have miss readed the fuses High and Low from the Calculator and burned it swapped.
I always write the High part at the left, and in the calculator it is at the right.
The solution is just to build an oscilator with a 555, 10 nF capacitor and 2 x 470 Ohms resistors.
Posted: Wed Jan 21, 2009 4:57 am
by epsilon_da
I have succesfully flashed the bootloader, but i cant get it to work.
DEVICE = atmega32
BOOTLOADER_ADDRESS = 3800
F_CPU = 16000000
FUSEH = 0xc9
FUSEL = 0xef
I can not find more information than this:
Code: Select all
usb 2-3: new low speed USB device using ohci_hcd and address 29
usb 2-3: device descriptor read/64, error -62
usb 2-3: device descriptor read/64, error -62
usb 2-3: new low speed USB device using ohci_hcd and address 30
usb 2-3: device descriptor read/64, error -62
usb 2-3: device descriptor read/64, error -62
usb 2-3: new low speed USB device using ohci_hcd and address 31
usb 2-3: device not accepting address 31, error -62
usb 2-3: new low speed USB device using ohci_hcd and address 32
usb 2-3: device not accepting address 32, error -62
hub 2-0:1.0: unable to enumerate USB device on port 3
The circuit connections are the same as used in other firmware, which does work.
When flashing, avrdude writes 16144 bytes, i can only guess that this is because the boot section is at the end of the program memory. But in that case, the atmega32 haves 32kbytes of program memory, why doesnt it writes closer to 32 kbytes ?
Code: Select all
avrdude: 16144 bytes of flash verified
Posted: Thu Jan 22, 2009 2:48 am
by Grendel
The BOOTRST fuse isn't programmed -- try 0xC8 for the high fuse byte. Program space is organized by words (2 bytes), hence address 0x3800. 32kb = 16kw.
Posted: Thu Jan 22, 2009 3:05 pm
by epsilon_da
Grendel wrote:The BOOTRST fuse isn't programmed -- try 0xC8 for the high fuse byte.
I have now the fuses with C8, but also is not working.
It is not being recogniced by linux.
FusesI only changed the boot condition to port D pin 7.
Code: Select all
#define USB_CFG_IOPORTNAME D
#define USB_CFG_DMINUS_BIT 2
#define USB_CFG_DPLUS_BIT 6
#define USB_CFG_CLOCK_KHZ 16000
#define BOOTLOADER_CAN_EXIT 1
static inline void bootLoaderInit(void)
{
PORTD = 1 << 7; /* activate pull-up for key */
_delay_us(10); /* wait for levels to stabilize */
}
#define bootLoaderCondition() ((PIND & (1 << 7)) == 0) /* True if jumper is set */
Grendel wrote:Program space is organized by words (2 bytes), hence address 0x3800. 32kb = 16kw.
Ok, thanks. So avrdude is wrong, instead of "bytes" it should say "words", because it hasnt written 16 kb but 32 kb.
Problem with Lock Bits
Posted: Sun Feb 01, 2009 4:48 pm
by Tilex
Hi,
I have problems with setting up the lock bits.
The Makefile of the USBHID_Bootloader shows the value "0x2F" for the lock bits.
But there are two problems with that:
1. As I look into the datasheet that can't be a valid value because the highest two Bits are always high.
2. I don't know how to set that value in AVR Studio. The Dialog shows only the options of the lock bits but not the values resulting by the settings.
I'm using atmega8, AVR Studio, AVRISP (mkI).
Look at this image for the lock bit dialog:
Can anyone tell me, what I have to select?
bye
Re: Need help with bootloaderHID
Posted: Sun Dec 26, 2010 5:50 pm
by ram
hi everyone
recently i uploaded the bootloader to atmega32 using usbasp. i set only BOOTRST flag. but now i'm not able use the atmega32. whenever i try to write a hex file into the flash memory i get this error message
avrdude: error: programm enable: target doesn't answer. 1
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.
avrdude done. Thank you.
please could someone help me with the problem
Re: Need help with bootloaderHID
Posted: Sun Dec 26, 2010 6:15 pm
by epsilon_da
Its a very common problem when switching to atmel devices.
You picked the fuses wrong and choosed a wrong oscillator source.
The normal solution is to feed the X1 pin with a 1Mhz clock from another device, like an lm555, living X2 unconnected, and reprogram the fuses with it to the right ones.
I had a bigger problem once, ... dont remember exactly but the device wont work with this aproach also.
Incredibly the solution was a lot easier, just reprogram the fuses while touching with your finger the X1 and X2 pins. Only thoose pins should be unconnected to any other thing. Choose to erase the device.
While touching both pins, run the software quickly many times until it gets reseted, because it may fail, but it worked without using any external clock source.
Cheers.
Diego