Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
avr_bootloader:bootloader [2016/03/01 23:16] admin [The AVRdude] |
avr_bootloader:bootloader [2020/03/23 20:41] admin [Burning the Bootloader with the AVRdude] |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ===== Burning the Bootloader ===== | ||
+ | |||
+ | If one uses an Atmega328 chip in his Arduino or Paperduino project one needs to burn a bootloader. That program allows later for an easy upload of programs. For the Paper-Arduino-Clones we have to burn the Arduino UNO bootloader on our ATmega chip. Depending on the burning device there are a lot of different technics to do so. | ||
+ | |||
---- | ---- | ||
- | ==== Burning the Bootloader ==== | + | ==== Burning the Bootloader with the Arduino IDE ==== |
- | ---- | + | |
- | Everything about the Arduino bootloader one can find here: | + | |
- | [[https://www.arduino.cc/en/Hacking/Bootloader?from=Tutorial.Bootloader]]\\ | + | |
- | For the Paper-Arduino-Clones we have to burn the bootloader on our ATmega chip. There are differnet ways to do so: | + | |
- | ---- | ||
- | ==== With the Arduino IDE ==== | ||
For burning the bootloader on the Paperduino-UNO, or on the Paper-Leonardo you need to connect the following pins on your Paperduino-UNO with your ISP programmer (in-system programmer): | For burning the bootloader on the Paperduino-UNO, or on the Paper-Leonardo you need to connect the following pins on your Paperduino-UNO with your ISP programmer (in-system programmer): | ||
* 11 - MOSI | * 11 - MOSI | ||
Line 15: | Line 13: | ||
* Ground | * Ground | ||
* + 5V | * + 5V | ||
- | After connecting the programmer to your computer select in the Arduino IDE in Tools/Programmer your programmer and than klick Tools/Burn Bootloader. | + | After connecting the programmer to your computer select in the Arduino IDE in Tools/Programmer your programmer and than click Tools/Burn Bootloader. |
- | + | ||
- | ---- | + | |
- | ==== With an AVR programmer ==== | + | |
+ | === ... and an AVR programmer === | ||
{{ :arduino_clones:isp_adapter.jpg?direct&300 |}} | {{ :arduino_clones:isp_adapter.jpg?direct&300 |}} | ||
- | On the foto you see the ISP programmer with an ISP adapter board. But you could also build your own modified wire like that on the [[http://arduino.cc/en/Hacking/MiniBootloader|Mini Bootloader project]]. Anyway here are the connection of an original ISP header. | + | On the photo one sees the ISP programmer with an ISP adapter board. But you could also build your own modified wire like that on the [[http://arduino.cc/en/Hacking/MiniBootloader|Mini Bootloader project]]. Anyway here are the connection of an original ISP header. |
{{:arduino_clones:isp-header.jpg?nolink|}} | {{:arduino_clones:isp-header.jpg?nolink|}} | ||
- | Cause my ISP programmer has a different protokoll as the originale AVR-ISP programmer I had to modifie the programmers.txt file.\\ | + | Cause my ISP programmer has a different protocol than the original AVR ISP programmer I had to modifier the programmers.txt file.\\ |
- | In that folder(on Linux): | + | In that folder (on Linux): |
/usr/share/arduino/hardware/arduino | /usr/share/arduino/hardware/arduino | ||
The third line has to change to: | The third line has to change to: | ||
avrisp.protocol=stk500v2 | avrisp.protocol=stk500v2 | ||
- | + | === ... and the Paper-USBasp Programmer === | |
- | ---- | + | A [[https://www.fischl.de/usbasp/|USBasp]] programmer will be used similar than the AVR ISP programmer, just select the USBasp programmer and burn. |
- | ==== With the Paper-USBasp programmer ==== | + | |
- | + | ||
- | It is simelar to the AVR ISP programmer, just select the USBasp programmer and burn. | + | |
{{ :avr_bootloader:paper_usbasp_1274.jpg?300 |}} | {{ :avr_bootloader:paper_usbasp_1274.jpg?300 |}} | ||
Line 43: | Line 36: | ||
- | ---- | + | === ... and a Paperduino-UNO === |
- | ==== With a Paperduino-UNO ==== | + | |
- | The Paperduino-UNO was designed for cloneing and that's why you can use your Paperduino-UNO fot burning bootloder, too. Just load the ArduinoISP - in the examples - on your Paperduino-UNO. After that, **turn off the auto reset by removeing the auto reset jumper**. And than connect the pins like that: | + | The Paperduino-UNO was designed for cloning and that's why you can use easiely your Paperduino-UNO for burning the bootloder. Just load the ArduinoISP program from the Arduino IDE examples on your Paperduino-UNO. After that, **turn off the auto reset by removing the auto reset jumper**. And than connect the pins like that: |
* 13 to 13 | * 13 to 13 | ||
* 12 to 12 | * 12 to 12 | ||
Line 56: | Line 48: | ||
{{ :arduino_clones:paperduino-uno_as_isp_adapter_wspahn.jpg?direct&300 |}} | {{ :arduino_clones:paperduino-uno_as_isp_adapter_wspahn.jpg?direct&300 |}} | ||
+ | |||
+ | === Burning an Atmega328 (without P) === | ||
+ | |||
+ | The Atmega328 chip has a different signature than the Atmega328p (p stands for picoPower). When one wants to burn this chip with the IDE the avrdude.conf file has to be changed.\\ | ||
+ | Open the file: | ||
+ | /usr/share/arduino/hardware/tools/avrdude.conf | ||
+ | or (depends on the Arduino version): | ||
+ | /usr/share/arduino/hardware/tools/avr/etc/avrdude.conf | ||
+ | search for the Atmega328p signature:\\ | ||
+ | 0x1e 0x95 0x0F | ||
+ | and replace it with the Atmega328 signature:\\ | ||
+ | 0x1e 0x95 0x14 | ||
+ | Now it should be possible to burn the Atmega328 with the Arduino IDE. Don't forget to change it back for the P version of the Atmega chip. | ||
---- | ---- | ||
- | ==== The AVRdude ==== | + | ==== Burning the Bootloader with the AVRdude ==== |
Burning the bootloader on an Atmega328p chip of | Burning the bootloader on an Atmega328p chip of | ||
- | a Paperduino-Uno or a Paper-Duino-Pi with an AVR ISP programmer. | + | a Paperduino-Uno or a Paper-Duino-Pi with an AVR ISP programmer in command line (Linux). |
+ | If it's not already installed one needs to install the Avrdude. | ||
+ | $ sudo pacman -S avrdude | ||
- | Go to the folder with the bootloader. | + | Go to the folder with the bootloader: |
+ | $ cd /usr/share/arduino/hardware/arduino/avr/bootloaders/optiboot/ | ||
- | Run avrdude in command line: | + | === Fuse Bits === |
+ | In the board.txt file for the Arduino UNO the fuse bits are set like that: | ||
+ | uno.bootloader.low_fuses=0xFF | ||
+ | uno.bootloader.high_fuses=0xDE | ||
+ | uno.bootloader.extended_fuses=0xFD | ||
+ | uno.bootloader.unlock_bits=0x3F | ||
+ | uno.bootloader.lock_bits=0x0F | ||
+ | The extended fuse bits settings for the brown-out detection level (BOD) are: | ||
+ | 0xFF (BOD disabled) | ||
+ | 0xFC (BOD = 4.3V) | ||
+ | 0xFD (BOD = 2.7V) | ||
+ | 0xFE (BOD = 1.8V) | ||
+ | That is the level where the Arduino resets when underpowered.\\ | ||
+ | |||
+ | A good manual for calculating the fuse bits one findes here [[https://www.instructables.com/id/How-to-change-fuse-bits-of-AVR-Atmega328p-8bit-mic/]]. | ||
+ | |||
+ | === ... with the Paper-USBasp Programmer ==== | ||
+ | |||
+ | {{:avr_bootloader:paper-usbasp_programming_board.jpg?400|}}\\ | ||
+ | |||
+ | If one one want to burn the bootloader with an [[avr_bootloader:paper_usbasp|Paper-USBasp]] programming board the command to set the fuse bits is: | ||
+ | $ sudo avrdude -p m328p -c usbasp -P usb -U lfuse:w:0xFF:m -U hfuse:w:0xDE:m -U efuse:w:0xFD:m | ||
+ | And for the actual bootloader it is: | ||
+ | $ sudo avrdude -p m328p -c usbasp -P usb -U flash:w:optiboot_atmega328.hex:i | ||
+ | |||
+ | |||
+ | === ... with an AVR ISP Programmer ==== | ||
+ | |||
+ | If one uses an AVR ISP Programmer to set the fuse bits one has to use this command: | ||
+ | $ sudo avrdude -p m328p -c stk500v2 -P /dev/ttyACM0 -U lfuse:w:0xFF:m -U hfuse:w:0xDE:m -U efuse:w:0xFD:m | ||
+ | And for the bootloader this one: | ||
$ sudo avrdude -p m328p -c stk500v2 -P /dev/ttyACM0 -U flash:w:optiboot_atmega328.hex:i | $ sudo avrdude -p m328p -c stk500v2 -P /dev/ttyACM0 -U flash:w:optiboot_atmega328.hex:i | ||
- | + | Depending on the AVR ISP Programmer it could be that one needs the stk500v1 protocol instead of the version 2 (stk500v2). | |
- | More at the [[avr_bootloader:AVRdude|AVRdude]] page.\\ | + | |
- | When using an Atmega328 (without p) use -F to scip signature check.\\ | + | |
- | ---- | + | === ... with the Paper-AVRISP mkII === |
- | ==== Burning an Atmega328 (without P) ==== | + | |
- | The Atmega328 has a different signature than the Atmega328p (p stands for picoPower). When using the Atmega328 for an Arduino Uno one has to change the avrdude.conf file.\\ | + | {{:avr_bootloader:paper-avrisp_mkii_programming_board.jpg?400|}}\\ |
- | Open the file: | + | |
- | $ sudo nano /usr/share/arduino/hardware/tools/avrdude.conf | + | |
- | or (depends on the Arduino version): | + | |
- | $ sudo nano /usr/share/arduino/hardware/tools/avr/etc/avrdude.conf | + | |
- | search with control W for the Atmega328p signature:\\ | + | |
- | 0x1e 0x95 0x0F | + | |
- | and replace it with the Atmega328 signature:\\ | + | |
- | 0x1e 0x95 0x14 | + | |
- | Save and close (contr O and contr X)\\ | + | |
- | Now you can burn the Atmega328 with the Arduino IDE (Arduino Uno). | + | |
+ | If one has a [[avr_bootloader:paper-avrisp_mk2|Paper-AVRISP mkII]] one hast to type in the terminal the following. For setting the fuse bits: | ||
+ | $ sudo avrdude -p m328p -c avrispmkII -P usb -U lfuse:w:0xFF:m -U hfuse:w:0xDE:m -U efuse:w:0xFD:m | ||
+ | And for the actual bootloader: | ||
+ | $ sudo avrdude -p m328p -c avrispmkII -P usb -U flash:w:optiboot_atmega328.hex:i | ||
+ | === Problem Solving === | ||
+ | To erase all fuse bits one can use the attribute: -e\\ | ||
+ | or even: -e -F\\ | ||
+ | Sometimes a specific Baud rate helps, too: -b 19200\\ | ||
+ | For verbose output use: -v\\ | ||
+ | |||
+ | === Burning an Atmega328 (without P) == | ||
+ | |||
+ | When using an Atmega328 (without p) use "-p m238" instead of "-p m238p".\\ | ||
+ | |||
+ | ---- | ||
+ | ==== Links ==== | ||
+ | [[https://www.arduino.cc/en/Hacking/Bootloader?from=Tutorial.Bootloader]]\\ | ||
+ | [[https://www.fischl.de/usbasp/]]\\ | ||
+ | [[https://www.nongnu.org/avrdude/]]\\ | ||
+ | [[https://www.ladyada.net/learn/avr/avrdude.html]]\\ | ||
+ | |||
+ | ---- | ||
+ | ==== License ==== | ||
+ | This manual was made by **Wolfgang Spahn** 2010-20.\\ | ||
+ | It is licensed under a [[http://creativecommons.org/licenses/by-nc-sa/4.0/"|Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License]]. | ||
+ | <html> | ||
+ | <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png" /></a> | ||
+ | </html> | ||
---- | ---- |