bootloader upload: arduino IDE vs. avrdude by hand

hi,

I got me a boarduino + usbtiny from adafruit. Then I tried uploading the official bootloader with the IDE. It worked, BUT there's also some error messages:

USB write error: expected 128, got -116
...
...

then I checked some threads here and on ladyada.net and found this here to work:

avrdude -c usbtiny -p m168 -B 5 -V -e -U lock:w:0x3F:m -U hfuse:w:0xDF:m -U lfuse:w:0xFF:m -U efuse:w:0xF8:m
avrdude -c usbtiny -p m168 -B 1 -V -D -U flash:w:ATmegaBOOT_168.hex:i
avrdude -c usbtiny -p m168 -B 5 -V -U lock:w:0xCF:m

IDE: 0011
OS: Windows XP 32bit running in VirtualBox
Host: openSUSE 11.0 64bit

Maybe this could be adjusted in 0012 to work even better.

Do you have a link to the forum threads you mentioned? What does the -B option do?

If you set upload.verbose to true in your Arduino preferences file, it should show the command line used to burn the bootloader from the IDE. What's different about the commands you used from the command line?

http://www.ladyada.net/forums/viewtopic.php?t=3558

avrdude manual: -B --> bitclock in µseconds

also: USBtiny-based AVR Programmer FAQ

If you programmed your chip to have a very slow clockspeed use the -B flag, as shown here to slow down the chip. "-B 32" should do the job most of the time, but you can go as slowly as "-B 250"

I'll check the verbose settings as soon an I've got some more time. Maybe tomorrow evening.

So I've done the same on my 32bit linux machine (real pc) and it works without any problems.
I guess the usb errors could be caused by the virtualizer, maybe some timing issues.

I've added the upload.verbose=true, build.verbose=true options to preferences.txt, but that didn't change anything.
No difference to the usual behaviour. I don't see any debug/info messages popping up anywhere, neither in the IDE nor in the console.

madworm: those preferences should already be in the file. Did you change the existing ones? If you added a duplicate entry, I'm not sure which will be used. You also need to edit the file when Arduino is not running. You should at least see messages when you compile and upload a sketch, and I think also when you burn the bootloader.

Yes, of course I just changed "false" to "true" - before I started the IDE.

All I see when compiling code is this: "Binary sketch size .....". This is on my 32bit openSUSE machine.

Running the IDE with windoze works as expected ! ?

Edit:

UNGH! This is what happens if you work with windows too much... I was always editing the preferences.txt file in the arduino-011 directory. This works on windows. On linux the preferences file is stored in $HOME/.arduino/preferences.txt

Silly me :sunglasses:

So back to the question what -B flags get used when burning the bootloader with the IDE:

unlock bootloader: -v -v -v -v -p m168 -cusbtiny -e -Ulock:w:0x3F:m -Uefuse:w:0x00:m -Uhfuse:w:0xdd:m -Ulfuse:w:0xff:m
flash+lock: -v -v -v -v -p m168 -cusbtiny -Uflash:w:hardware/bootloaders/atmega168/ATmegaBOOT_168_diecimila.hex:i -Ulock:w:0x0F:m