Go Down

Topic: Some basic question about AVR chips and Arduino (Read 2229 times) previous topic - next topic

Vincent19

Hey guys, I have some questions here which confused me. I want clarification from you guys :)

1. For a fresh AVR chip like atmega 8, if I burnt the bootloader for atmega 8 into the chip, it means I can program the chip through USB cable right ? Burning bootloader means I change the fuse bits inside the chip. So if I remove the bootloader, it means I cant upload code from arduino IDE into the chip ? How about the fuse bits inside the chip ? Remain same or will return back to the fresh atmega 8 fuse bits ?

2. If let say I get a fresh AVR chip (atmega 328), then I need to change the fuse bits inside the chips then I only can upload code from arduino IDE ?

3. We are able to upload code from arduino IDE into the chip through USB cable is because there is the FTDI chip / a microcontrolller being programmer to be FTDI chp ? Or because we burn a bootloader into the chip ?

Thank you !!!

Nofew

1: Sorta. Burning a bootloader, via the Arduino IDE, means that it'll change some fuses and add a program to the chip that waits a few milliseconds when the chip first gets power and listen for a command over serial that'll cause it to accept new code.

"program the chip through a USB cable" can mean a lot of things. Even without a bootloader you can do this, assuming you have something like an AVR ISP MKII. (If you do, you can hold shift and click upload to use it instead of the "normal" routine Arduino does). I'm really not sure what you're asking here so if you want more information you'll need to word that better.

The fuse bits will be changed if you use the Arduino IDE's "burn bootloader" feature. If you want to avoid this then you'll need to edit the boards.txt file, or learn to use avrdude and get an AVRISPMKII.


2: You don't /need/ to change the fuse bits. By default it'll work, but it'll run off its own internal clock and such. You're used to 16 mhz, but it'll ship at 128 khz. Obviously this throws things off, like the delay() function.

If you're trying to make a "standalone breadboard", so to speak, have a look at http://www.arduino.cc/en/Main/Standalone . It'll explain pretty much everything. (Note: The parts it lists are *requirements*, not suggestions, if you want to be sure your sketches work the same. Also, get an AVR ISP MKII. Do not use a second Arduino as a programmer. That tends to cause issues.)


3: There's a second AtMega on the Arduino boards that actually convert USB to Serial for the main CPU. You'll need a special device (Something like https://www.sparkfun.com/products/718 ) to do serial communication again, or use the Arduino IDE "normally" again (Not having to hold shift while clicking upload). A single chip won't do the trick.

That being said, the new Arduino Due actually communicates directly via USB, but you'll have to solder SMD to use it so the point's pretty moot in your case.

Vincent19


1: Sorta. Burning a bootloader, via the Arduino IDE, means that it'll change some fuses and add a program to the chip that waits a few milliseconds when the chip first gets power and listen for a command over serial that'll cause it to accept new code.

"program the chip through a USB cable" can mean a lot of things. Even without a bootloader you can do this, assuming you have something like an AVR ISP MKII. (If you do, you can hold shift and click upload to use it instead of the "normal" routine Arduino does). I'm really not sure what you're asking here so if you want more information you'll need to word that better.

The fuse bits will be changed if you use the Arduino IDE's "burn bootloader" feature. If you want to avoid this then you'll need to edit the boards.txt file, or learn to use avrdude and get an AVRISPMKII.


2: You don't /need/ to change the fuse bits. By default it'll work, but it'll run off its own internal clock and such. You're used to 16 mhz, but it'll ship at 128 khz. Obviously this throws things off, like the delay() function.

If you're trying to make a "standalone breadboard", so to speak, have a look at http://www.arduino.cc/en/Main/Standalone . It'll explain pretty much everything. (Note: The parts it lists are *requirements*, not suggestions, if you want to be sure your sketches work the same. Also, get an AVR ISP MKII. Do not use a second Arduino as a programmer. That tends to cause issues.)


3: There's a second AtMega on the Arduino boards that actually convert USB to Serial for the main CPU. You'll need a special device (Something like https://www.sparkfun.com/products/718 ) to do serial communication again, or use the Arduino IDE "normally" again (Not having to hold shift while clicking upload). A single chip won't do the trick.

That being said, the new Arduino Due actually communicates directly via USB, but you'll have to solder SMD to use it so the point's pretty moot in your case.


Erm, I mean if I burn the bootloader to the chip, it will change the fuse bits of the AVR chip right ? So how about if I delete the existing bootloader in the AVR chip ??Will the HIGH fuse and LOW fuse changed or remain the same as in the bootloader file ?

pradeepgoel044

respected sir/madam,

i am new to arduino i want to make a arduino board (Arduino Single-Sided Serial Board (version 3)). i have few questions

1) i have atmega8L. will i have to burn something known as firmware or  boatloader in it.

2) if yes please give me links for that and also tell me how do burn them.

3) can i burn them with serial usb  programers for avr chips.

please help me i really want to learn it.

thanking you

pylon

Quote
Erm, I mean if I burn the bootloader to the chip, it will change the fuse bits of the AVR chip right ? So how about if I delete the existing bootloader in the AVR chip ??Will the HIGH fuse and LOW fuse changed or remain the same as in the bootloader file ?


The fuses and the bootloader are not directly related. Although the fuses usually are set when "burning" the bootloader, they can also be set independant of that as well as the opposite: updating a bootloader without changing the fuses.
You cannot delete a bootloader but you may overwrite it. So if you overwrite the Arduino bootloader with anything (a program or simply zeros), the fuses are not changed except you explicitly specify to do so. The fuses are not specified in the bootloader file, that's only program code. If you use the Arduino IDE to update a bootloader, the fuse bits are specified in the boards.txt file where you also find the bootloader file used when you select "Burn Bootloader" from the menu.

Vincent19


Quote
Erm, I mean if I burn the bootloader to the chip, it will change the fuse bits of the AVR chip right ? So how about if I delete the existing bootloader in the AVR chip ??Will the HIGH fuse and LOW fuse changed or remain the same as in the bootloader file ?


The fuses and the bootloader are not directly related. Although the fuses usually are set when "burning" the bootloader, they can also be set independant of that as well as the opposite: updating a bootloader without changing the fuses.
You cannot delete a bootloader but you may overwrite it. So if you overwrite the Arduino bootloader with anything (a program or simply zeros), the fuses are not changed except you explicitly specify to do so. The fuses are not specified in the bootloader file, that's only program code. If you use the Arduino IDE to update a bootloader, the fuse bits are specified in the boards.txt file where you also find the bootloader file used when you select "Burn Bootloader" from the menu.


Ya, I can manually change the fuse bits also without uploading the bootloader, for eg the UNO bootloader. I can refer to the board.txt file to see what should I change to for the HIGH fuse and LOW fuse configuration. Correct ? Oh, so means once I burnt a bootloader inside, it for example changed the fused . But how do I remove the bootloader ? Any method ? Because once I tried before, I upload the bootloader, then the atmega 328 I can upload code into it through USB. But once I delete it, I cant upload through USB. But I noticed that the fuse bits remain the same. If the fuse bits is the same, why I cant upload using USB once deleted ?

Thank you

Arrch

But how do I remove the bootloader ? Any method ?

Updload your code through the ICSP, and it will get rid of the bootloader.
Quote
But once I delete it, I cant upload through USB.

Delete what?
Quote
But I noticed that the fuse bits remain the same. If the fuse bits is the same, why I cant upload using USB once deleted ?

Delete what?

The bootloader allows you to program the chip through the serial pins on the micro. Without the bootloader, you will need to program it through the ICSP pins.

Vincent19

Delete the bootloader.

Well, the bootloader is to enable serial communication through USB ? Not to change the fuse bits so as to use the external 16MHz crystal ?? LOL

Arrch

Quote

Well, the bootloader is to enable serial communication through USB ?

Again, no.

The bootloader allows you to program the micro using the serial pins. That doesn't specifically mean it has to be done through USB. Also, just because the bootloader is not on there, doesn't mean it can't be programmed through USB (See USB ICSP Programmers).

Quote
Not to change the fuse bits so as to use the external 16MHz crystal ?? LOL

Burning the bootloader is the Arduino way of changing the fuse bits. It can be done in AVR Studio without burning the bootloader. I don't see the big deal in burning the bootloader on there just to set the fuse bits. Unless you are programming it using the bootloader (meaning using the serial pins), then the bootloader will get wiped out the next time you program it.

Vincent19

ern, can i say the bootloader as serial to USb downloader? enable the code to be downloaded through usb

Arrch


ern, can i say the bootloader as serial to USb downloader?

Grammatically, no.

Quote
enable the code to be downloaded through usb


You would actually be uploading it through USB, not downloading it.

Vincent19

uploading it to 5he chip right ? if no then what is bootloader actually?

Arrch


uploading it to 5he chip right ? if no then what is bootloader actually?

See reply #8

Arrch

#13
Nov 07, 2012, 07:49 pm Last Edit: Nov 12, 2012, 03:58 pm by Arrch Reason: 1

uploading it to 5he chip right ? if no then what is bootloader actually?

Yes, code is uploaded to the chip.

Vincent19

How can I know that 2kb is used for the bootloader file ? I want to see for the difference when I upload bootloader and remove bootloader but I cant see it ><

Go Up