Fuses, LockBits, generally & 328p

My problem seems to be mainly the difference between the behavior of avrdude and AVR Studio in their use of the bits values. Furthermore the pure understanding of the size of the bootloader section to be set with the fuses.

For me and may be some others tinkering around with that, it would be very helpful if somebody could explain especially the meaning and needs of the right settings for the fuses of the bootloader section, additionally there is also a lock bit fuse setting: ( Arduino Playground - Burn168 as mentioned here ) which may be needed for this context.

This bootloader story seems to be very complex, mainly because there are some other rules to follow then for the "normal" operation conditions an Arduino user has to follow or even every AVR user who only uses his chips without a bootloader.
For example the size to set with the fuses for the bootloader. It seems for me that fuses of atmega8 and atmega168 were different mainly because of the page size of the chips. Don´t know if i am right. For me then is the question if the 168 and the 328p have the same settings because they have the same page size. Or do i have to take care of other things also? How is that to calculate with the size of the hex file of the bootloader?

For sure the bits differ completely, because they are in a different order. Thats what you see with AVR Studio/AVRispMkII very easily - you click it and you have your fuse bits shown in the GUI, but for others it´s not really visible.

Could someone who has a deeper knowledge of that give us some helpful hints where to and where not to go? What depends there in between? Is it possible to break it down to some simple rules? For example the reason for the setting of brownout detection at 4.3V should be understandable for everyone why to set or not to set. But for the bootloader this seems to be more complicated?

many thanks in advance for some help with that story.

ps:
One nice utility for use with a programmer i´ve found, but not up to date at the moment - 328 is missing :frowning: - is to get there for mac and win: http://www.vonnieda.org/AVRFuses/
This utility seems to be very nice and helpful for doing pure programmer stuff. It supports a long list of them.
The 328 problem could be none, i have to try to change the avrdude path in the prefs to the arduino folder... i will report about that later.
I have not really used this software until now but found it very useful for some needful future situation. So try for your self please if it works.

Edit: tried AVRfuses with arduino-avrdude path, works, but don´t interacts with parts descriptions there.

I certainly can't help much with your questions, I too struggle with all the internal complexities of fuses and lock bits and bootloaders, I'm just glad it mostly works. :wink:

However I did stumble across a on-line AVR fuse calculator thingy that lets you play around with the fuse options and gives somewhat better explanation of some of the details and then gives you a field that can be cut and pasted into AVRDUDE.

http://www.engbedded.com/fusecalc

Lefty

Now i got it to work! Burning the bootloader with the IDE and AVRisp mk2.

The Reason it did not work before was the Jungo driver installed by AVR Studio. I had to deinstall it and after that to install the libusb driver.
Restart the IDE a few times and it worked. Tomorrow i will try that with some fresh chips - if these don´t work i´ll try vinegar and they can sleep by the fishes! Two month ago i had to buy 15 Atmega328P as the minimum possible quantity to order, because they were not at stock and had to be ordered directly at Atmel. So anyway it sounds like a lot of fun!
Otherwise i can soon try them with a more complete SD card and S65 display code - that was what i really wanted to know and think about :wink:

Any bootloader hint is still welcome!

After the last message the nightmare wasn´t over! After that it did not work anymore. Switching back to Jungo driver did not work. AVR Studio was also dead for me.. and Arduino wasn´t able to burn the brandnew chips. got crazy..

Then i tried the avrispmk2 with my eeepc with AVR Studio, it was no problem to burn the fuses. After that Arduino was also able to burn the bootloader.

So it was nearly clear it like in AVR Studio, the really first time, you have to burn with really low speed, 1/4 of the chip is running. in case of 328p with 250khz maximum a quarter of 1Mhz , the default it is running. I took ca. 100khz or so to be on the safe side.
When the 328 knows he has to hear to the 16MHz crystal - all is fine. after that you can use normal speed again.
The virgin chip simply don´t knows before that there is a crystal for him he has to hear to.

The other big problem is: Jungo or libusb, but not both. The next step was to find out how to make avrdude say this to 328. I found a pdf manual for avrdude where i found something interesting:

http://download.savannah.gnu.org/releases-noredirect/avrdude/avrdude-doc-5.5.pdf

on page 2 top
When used in ISP mode, the AVR Dragon behaves similar
to an AVRISP mkII (or JTAG ICE mkII in ISP mode), so all device-specific comments will
apply there. In particular, the Dragon starts out with a rather fast ISP clock frequency, so
the -B bitclock option might be required to achieve a stable ISP communication.

but when you read the cmd-opts it is sounds a bit different:

-B bitclock
Specify the bit clock period for the JTAG interface or the ISP clock (JTAG ICE
only). The value is a floating-point number in microseconds. The default value
of the JTAG ICE results in about 1 microsecond bit clock period, suitable for
target MCUs running at 4 MHz clock and above. Unlike certain parameters in
the STK500, the JTAG ICE resets all its parameters to default values when the
programming software signs off from the ICE, so for MCUs running at lower
clock speeds, this parameter must be specified on the command-line.

Because i don´t know where i have to change that for arduino. i copied the verbose output cmd from arduino
and pastet that into a cmd-window with the option added:

"E:\Documents and Settings\dirk\Desktop\arduino-0013\hardware/tools/avr/bin/avrdude" -C"E:\Documents and Settings\dirk\Desktop\arduino-0013\hardware/tools/avr/etc/avrdude.conf" -v -v -v -v -pm328p -cstk500v2 -Pusb -e -Ulock:w:0x3F:m -Uefuse:w:0x05:m -Uhfuse:w:0xDA:m -Ulfuse:w:0xFF:m -B 20

and that worked for the first time!

now i switched to the arduino ide and it burned without any word about missing signatures, no syncs, and so on the bootloader! worked also for the first time! tried it with 5 other chips, no problem!

so sorry for my worse english, i am tired... next week will be much work,
but i saw that many other people have had the same or similar problem, so they should know asap about that!

When i am right, i think this should be added to the bootloader burner code in the ide.

on the chips i have is the number 0822, this should be a date code. I got them the end of december. does that belong to the revision errors with the 32khz oscillator named in the datasheet? i did not find out how to crypt that out, looks like week 22, year 08?

good night!

edit: One important thing missed: After burning the bootloader with arduino/avrispmkII, you have to detach the avrispmkII before you can write sketches to the chip with the IDE!
It is not enough to turn power off - detaching the usb cable from the avrispmkII. The isp cable has to be detached!

I used an external power adaptor for the diecimilia board - to be on the safe side, you should not power the board over usb when working with the avrispmkII. The FTDI chip and the avrispmkII are connected both to the isp ports afaik.