Is there a decent N00B guide to fuses, boot loaders / low level stuff somewhere?

I've been working with Arduinos for at least 5 years now, and I started working with an attiny85 for a new project a couple of weeks ago and as I was reading the release notes for the core on Github just now, I realized that I still really don't understand a lot of what goes on under the hood in these chips.

Fuses - what are they? How do you manipulate them and why would you?

Bootloaders - I just know that they run first before anything else when power is first applied to a MC

... that's literally all I know about them ...

What kind of code comprises a bootloader, how large they are, what is the extent of their capabilities, how they get put on the chip ... when to use them, when not to use them, would there ever be an advantage to modifying one ... the questions are endless and I can't seem to find answers that are written in simple enough terms that someone like me can comprehend. The various sources of info on these topics also seem to assume that their reader has a certain knowledge level that apparently I don't have.

It's like reading datasheets sometimes ... Sure I can read English .... doesn't mean I get it ... like I should be able to go to a datasheet say if I want to learn how to put a particular MC into sleep mode ... then after reviewing the datasheet, I should know EXACTLY what to do in my code to use that feature.... but sadly, that's not the case.

So I can only say that ... I kinda know what I don't know but ... more so ... I don't think I fully know what I don't know ... and so that's why I'm asking if there are any tutorials out there that deal with these subjects starting from the ground up that were written with the assumption that their audience knows very little about these things and so it takes the time to spell everything out including all things that are connected to these topics that would be helpful to know when trying to wrap ones head around the whole thing...

I hope that made sense ... sorry for rambling ...

And THANK YOU!

Mike

Maybe you will hate an answer. I think, the best way to understand specific chip like ATtiny85 is to read the datasheet.
However, after 5 years working with Arduino, you cannot be a complete lama.
I do not know about this type of the guide you are looking for, but there is lots of on the internet.

Sure I can read English .... doesn't mean I get it ...

If you have problem to understand it in English, just take a time (I have no such impression BTW). If you have any difficulties to understand the technicalities, just ask here or try more advanced AVR forum.

Anyway, this is not so easy. It takes an effort and time.

What kind of code comprises a bootloader...

It is just normal program. Its purpose is to upload the main program into the flash memory via the serial line which is considered as HW minimal, fast and the easiest way.

...how large they are...

How large you can afford to. Smaller is better since you have more room for the main program.

...what is the extent of their capabilities...

It depends on demands.

...how they get put on the chip...

The programmer, another piece of HW, is needed. Any AVR is programmable with ISP by default. I think, the USBasp is the top - cheap and easy to use.

... when to use them, when not to use them...

The bootloader allows you to upload your program via serial line. Arduino uses USB since there is a transceiver, usually.
Just plug it and you go. Very comfortable for frequent uploads so it is very feasible for the development.
The disadvantage is that that bootloader is needed and it takes a part of flash memory which could miss for the program.

...would there ever be an advantage to modifying one...

Hard to say. What do you need? In the Arduino world "the golden standard" is the optiboot bootloader used for ATmega
chips like 328P in the UNO, Nano... Works perfectly and fits to the smaller possible boot region on the ATmega328P, which is 512B.

I found this very useful in describing the sketch loading process(es) and beyond. It is very well written. Don't be put off because the author has issued this as an instructable: Overview the Arduino Sketch Uploading Process and ISP : 10 Steps - Instructables

Usually, a bootloader is just a convenience. However, in some very special applications (with AVR microcontollers) the bootloader can be used to allow a running sketch to modify flash memory which, normally, is prohibited.

...would there ever be an advantage to modifying one...

Hard to say. What do you need? In the Arduino world "the golden standard" is the optiboot bootloader

I'll point out that while Optiboot has had some substantial development over the last decade, the version that Arduino uses on the Uno and etc is still the "Version 4.4" issued in 2011. (the project is up to version 8.1, but most of the changes have been things like "add new chip", "make building with custom options easier", "make sure it compiles with the new version of gcc", "implement obscure feature only useful to a small percentage of potential users.")
So ... the advantages of modifying the bootloader are ... pretty small, in general.

Fuses: A lousy choice of names for what are erasable, user programable configuration bits for the processor.

Do you want your processor to have supply voltage brown-out protection? That’s a fuse setting.
Do you want to use the processors internal r/c clock instead of a crystal? That’s a fuse setting.

Making sense?

Here’s more detail: Fuse bits aren’t that scary | Embedder's life

Google can be your friend. That link was in the first link retuned, which was a hackaday article. Search was “Arduino fuses explained”. There is no lack of material about Arduino on the web. The challenge can be finding both technically correct and comprehendible material. Sometimes you’ve got to put some work into the search, sometimes it’s the first link.

6v6gt:
I found this very useful in describing the sketch loading process(es) and beyond. It is very well written. Don't be put off because the author has issued this as an instructable: Overview the Arduino Sketch Uploading Process and ISP : 10 Steps - Instructables

You see ... THIS is exactly what I was looking for ... Sure I've uploaded sketches to Arduinos more times than I can count ... I've done it via USB and USBASP hardware ... but in that article is something that I had NO CLUE about.

When you program an Arduino's processor using ISP, usually the entire processor chip memory is erased, including the bootloader area, and your sketch is written. So, when you upload a sketch to the Arduino using ISP, the Arduino no longer has a bootloader on it.

I think I've actually tossed Arduino's before because I couldn't program them anymore over USB and it's possible that was my own fault!

I'm going to go back to some of my "dead" Nano's and see if I can flash a bootloader to them and resurrect them.

Thank you for that link... still reading it ... skipping the stuff I already know, but it's good!
Mike

Be careful when bootloading Nanos, there are two options in the current IDE. The “old” bootloader has some behavioral issues like running at half the baud rate and consuming 4 times the flash memory. I typically reflash any clone nanos I purchase as Uno’s. Same processor, no confusion over “old” or “new” bootloaders and memory it uses. It may seem confusing but it removes any doubt as the Uno always uses the 512 byte Optiboot image.

Some details on old/new: Arduino Nano ATmega328P bootloader difference - Arduino Stack Exchange

WattsThat:
Be careful when bootloading Nanos, there are two options in the current IDE. The “old” bootloader has some behavioral issues like running at half the baud rate and consuming 4 times the flash memory. I typically reflash any clone nanos I purchase as Uno’s. Same processor, no confusion over “old” or “new” bootloaders and memory it uses. It may seem confusing but it removes any doubt as the Uno always uses the 512 byte Optiboot image.

Some details on old/new: Arduino Nano ATmega328P bootloader difference - Arduino Stack Exchange

You know I had actually wondered some time ago if that was an option because they do have the same chip. Nice to see that you've done it successfully. I think I'll definitely do that, thank you!

WattsThat:
Be careful when bootloading Nanos, there are two options in the current IDE. The “old” bootloader has some behavioral issues like running at half the baud rate and consuming 4 times the flash memory. I typically reflash any clone nanos I purchase as Uno’s. Same processor, no confusion over “old” or “new” bootloaders and memory it uses. It may seem confusing but it removes any doubt as the Uno always uses the 512 byte Optiboot image.

Some details on old/new: Arduino Nano ATmega328P bootloader difference - Arduino Stack Exchange

An interesting turn ... I took a Nano that I had sitting here on the desk that I could not flash anymore and assumed it was dead, but I flashed the Uno bootloader as you suggested and sure enough, the damn thing works ... imma be like Jesus over here... raising a bunch of Nanos from the dead ... lol!

LIFE! LIFE! Give my creation LIFE!

Get yourself a Programmer if you don't have one already.
This one from Pololu is inexpensive, can function as both a Programmer for bootloading, and as a USB/Serial interface if your project needs one offboard - both have their own COM port address.
And free shipping in the US.

CrossRoads:
Get yourself a Programmer if you don't have one already.
This one from Pololu is inexpensive, can function as both a Programmer for bootloading, and as a USB/Serial interface if your project needs one offboard - both have their own COM port address.
And free shipping in the US.
Pololu USB AVR Programmer v2.1

Thank you for that link. After reading the description, I am assuming that I would connect that device to the 6 pin header of a NANO, then upload code using the USB/serial port that it offers to the operating system? If that is the case, then does it wipe or preserve the bootloader when you upload a sketch? And I would think that serial communication within the sketch would not be possible once the sketch is uploaded or do two of those six pins pass the default serial comm through? OR, would I just use two pins from its other header and connect it to the serial pins of the NANO and pass serial communication through the same USB port that way?

If that is the case, then does it wipe or preserve the bootloader when you upload a sketch?

I does wipe the bootloader.
The sketch can use the serial port on Nano normally and so the USB on Nano. The ISP programmer uses ISP port on Nano and it has nothing with serial port.

Budvar10:
I does wipe the bootloader.
The sketch can use the serial port on Nano normally and so the USB on Nano. The ISP programmer uses ISP port on Nano and it has nothing with serial port.

I see so as you're moving along and testing code uploads, you would have two USB cables in operation, one for the nano serial comm and the other for the programmer?

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.