top of page

endoyoo Group

Public·14 members
Nicholas Cook
Nicholas Cook

Burning The Bootloader On A ATMega 328p With Two Arduino UNO’s



The two-arduino setup was just me troubleshooting. I initially noticed the problem when I used my ArduinoISP shield to burn the bootloader and upload a sketch to an ATmega328P. After doing that and putting the ATmega328P back into an UNO I couldn't upload any more sketches to it, so I wanted to verify that this wasn't a problem with my shield.




Burning the bootloader on a ATMega 328p with two Arduino UNO’s



To program the bootloader and provide to the microcontroller the compatibility with the Arduino Software (IDE) you need to use an In-circuit Serial Programmer (ISP) that is the device that connects to a specific set of pins of the microcontroller to perform the programming of the whole flash memory of the microcontroller, bootloader included.The ISP programming procedure also includes the writing of fuses: a special set of bits that define how the microcontroller works under specific circumstances.


The whole process of loading the bootloader code and burning properly the fuses to make an ATmega microcontroller an "Arduino" is managed by the Arduino Software (IDE): it provides a specific menu item and allows you to use a variety of programming devices.Among the programmers, the "Arduino as ISP" is the cheapest and most practical solution to burn a bootloader on another Arduino board with ATmega, 32U4 or ATtiny.


In the picture above we are connecting two UNO boards for bootloader burning with the "old style" connections: the top board is the Target, the bottom board is the Programmer. Note the yellow connection from D10 of the programmer to RESET of the target. On MKR family of boards, you can't use D10 for reset; we suggest D6 and you must remember to change the line 73 of the ArduinoISP sketch - #define RESET 10 - putting "6" insteat of 10.


If all the wires are set, you need to switch to the board type you want to program with the bootloader. This step is mandatory to select the proper bootloader code and the fuses configurations. The programming procedure checks the signature of the microcontroller before any writing action is taken, but many boards share the same microcontroller and each board has its own bootloader. The port remains the one of the ArduinoISP.


The programming process manages the three SPI lines (MISO, MOSI and SCK) according to the standard SPI programming protocol, the same used to read and write SD memory cards. The only difference with memory cards is the lack of a CS (Chip select) pin. On our AVR microcontrollers we use the RESET pin that halts the execution of any sketch or bootloader and puts the microcontroller in a specific state where it listens to the commands arriving from the SPI interface. The very first command that the protocol requires is the one that enters the microcontroller in the Serial Programming Mode.


Once you've done this, you can burn the bootloader and upload programs onto your ATmega328P as described above. Be sure to select "ATmega328 on a breadboard (8 MHz internal clock)" when burning the bootloader. (If you select the wrong item and configure the microcontroller to use an external clock, it won't work unless you connect one.)


I'm having trouble burning bootloader to my new ATMEGA328-pu chips. I have two arduino UNOI tried , this did not work. I even inserted a 124 ohm resistor from 5v to reset and a 10uf cap from reset to ground. Found this on a forum somewhere.my steps. -> select arduino isp sketch in the examples,,, then go to tools -> Programmer -> arduino as ISPthen -> tools burn bootloader.AVR dude sync error


HiI have been also trying to burn a bootloader onto an Atmaga 168 20PU on a breadboard from an Arduino Uno. I have set up the board as shown in DuaneB's post and also played with putting in a 120 ohm resistor and a 10 microfarad capacitor between 5v and reset. I also added this code to the end of the boards.txt file as suggested on the old forum##############################################################


atmega168bb.bootloader.low_fuses=0xE2atmega168bb.bootloader.high_fuses=0xD9atmega168bb.bootloader.extended_fuses=0x07atmega168bb.bootloader.path=arduino:atmegaatmega168bb.bootloader.file=ATmegaBOOT_168_pro_8MHz.hexatmega168bb.bootloader.unlock_bits=0x3Fatmega168bb.bootloader.lock_bits=0x0F


Is there a problem with the code I added to the boards.txt file? or can anyone sugegst how this process should work for an Arduino Uno and an atmega168 20PU on the breadboard. I haven't put my 16Mhz crystal and 18-22pf capacitors on the breadboard as the boards file addition post suggested they should not be usedI've been struggling all day so any help would be much appreciated.David


I have an Atmega328p-pu, which I purchased without a 16Mhz oscillating crystal. I bought it with intentions to burn the Arduino bootloader onto it, so that it runs on its internal 8Mhz oscillator. The problem is that almost all tutorials interchange "Atmega328" and "Atmega328p". My first question is, is there any difference in burning the bootloader between the Atmega328 and Atmega328p (if so what is it)?


Secondly, I found out that my Atmega328p came with the Arduino bootloader already burned onto it. I presume that this means that the chip is configured to run with a crystal. Is there any way to reflash the bootloader, to get the chip to run at 8Mhz (or do I have to get the crystal after all)?


I still don't quite understand. If I have a stock Atmega328p (with no bootloader), and want to burn the Arduino bootloader onto it, will it matter if I follow tutorials for the Atmega328 (as I said, 99% of sites interchange Atmega328/Atmega328p throughout the tutorial)?


One last question (I hope). Is there a way to reflash the bootloader of the Atmega328p which is on the Arduino Uno, without removing the it from the Arduino and without using another Arduino board or Atmega328p (ie is there a way to reflash the Atmega328p on the Uno directly from the Uno board)?


Izaking:One last question (I hope). Is there a way to reflash the bootloader of the Atmega328p which is on the Arduino Uno, without removing the it from the Arduino and without using another Arduino board or Atmega328p (ie is there a way to reflash the Atmega328p on the Uno directly from the Uno board)?


Didn't you say you had an Arduino AND a new ATmega328p chip? You can use the Arduino to program the chip, and then put the chip in the Arduino and use it to re-program the chip that was in the arduino, thus ending up with a new bootloader in both chips.


I am a kind of newbie and I am in a dead end with my problem: I try to burn the bootloader on a Arduino UNO with the ATMEGA 328P with another Ardunio UNO in the same configuration (But as a replica from Elegoo). But it does not work. Here is the error message:


This might not help but can you make sure you have set board to Arduino Uno while uploading boot loader. You may try withsetting board as Arduino Duemilanove .Do check once what is exactly written on top of ATmega for the elegoo one.After ATMEGA328p it would have something written like PU or AU .etc


Archut:This might not help but can you make sure you have set board to Arduino Uno while uploading boot loader. You may try withsetting board as Arduino Duemilanove .Do check once what is exactly written on top of ATmega for the elegoo one.After ATMEGA328p it would have something written like PU or AU .etc


So now you are full of clues and not clueless.As of I know arduino uno uses ATMEGA328P-PU and not ATMEGA328P-U.Your problem has been earlier solved in this thread, have a look. =564674.0Alternatively you can have a look at this Burning the ATMega328p Bootloader and select your board accordingly while uploading.Always check your IC information and then search.


Finally, select Burn Bootloader. This will take the board you selected in the Arduino IDE and look up the associated bootloader in the board.txt file. Then, it will find the bootloader in the Arduino IDE's program folder (specifically "...\Arduino\hardware\arduino\avr\bootloaders") and install it. This only works if the board is installed correctly in the IDE and you have the correct bootloader.


Once the fuse bits are set, we can flash a compiled .hex file to the target board and set the lock bits. Enter the following in a command line. Make sure that you are in same directory as your .hex file and adjust the ...hexfilename.hex that you are using to flash for your target. To flash the Arduino Uno Bootloader, head over to the Arduino program folder. On a Windows OS, it will look similar to this path ...\arduino-1.8.5\hardware\arduino\avr\bootloaders\optiboot. There area few files in the folder but the one we are interested in is the optiboot_atmega328.hex file.


0. Make sure your IDE is closed. 1. Make a copy of the complete folder where your IDE is. (I named mine BURN BOOTS) 2. Open the new folder. 3. Navigate to ...\arduino-1.0.1 BURN BOOTS\hardware\tools\avr\etc 4. Find a file called avrdude.conf 5. Replace it with the file I attached. (You need to extract it first, Instructables didn't allow me to send it, so I had to compress it.) 6. Navigate to ...\arduino-1.0.1 BURN BOOTS\hardware\arduino 7. Find a file called boards.txt 8. Replace it with the file I attached. 9. Close everything.


About

Welcome to the group! You can connect with other members, ge...

Members

  • Promise Love
    Promise Love
  • Matt Kadam
    Matt Kadam
  • bucher bestseller
    bucher bestseller
  • Francisco Tapia
    Francisco Tapia
  • Mat Angiwan III
    Mat Angiwan III
bottom of page