This is a theoretical question
What would I have to do if my Atmega328 gets damaged and I replace it with a new one?
You will need to upload the bootloader to the new Atmega328. Which you will either need an AVR programmer or a Arduino board.
This was the information I was given by @albertgajsak for the Makerbuino bootloader.
You can find the software library here with the board files along with the bootloader:
https://drive.google.com/file/d/0B6Gh-Hs2V_jJMEhUQzdQYThhN0U/view?usp=sharing
I was also told by @albertgajsak that all this information will be added to the website soon.
o, thanks for the answer
It looks like my makerbuino kit’s ATmega328 was sent out without being programmed with the bootloader. I’m not sure what to do with the files @bitfogav has linked to on his google drive. Would be grateful for any help! I don’t have an AVR programmer so will go the route of Arduino as ISP. I’m running Arduino 1.8.2 (on OS X) if that matters.
@albertgajsak, I’ll keep an eye out for this info being added to the website.
That should be salvageable, you can gently bend the pins back into place without them snapping.
Looks to me that the pins at the end have broken off at the base, don’t think that chip is salvageable?
@Lysa_Bacon MakerBuino is based on the GAMEbuino system, there for the following maybe some help in getting the bootloader onto you’re atmega382p using the Arduino to ISP? (note that I have not tested this but I hope it helps).
You will need to download the Makerbuino version of the bootloader and txt file which I posted the link above.
This would be much easier if you had a programmer like the AVR MK2 and atmel studio 6, I have tested this, and have the Makerbuino bootloader and correct fuse settings.
bitfogav - I had exactly the same question about how to install the bootloader on the same chip. I struggled for a while but finally figured out how to program it using another Arduino board.
I bought a couple of blank ATMega chips and needed to put on the bootloader. This is the procedure that I followed using Arduino software 1.8.3:
I have a Mac, so some of the steps for others may be slightly different.
-
Install the Ardunio software.
-
Dowload the Makerbuino boot loader
https://drive.google.com/file/d/0B6Gh-Hs2V_jJMEhUQzdQYThhN0U/view?usp=sharing -
Put the Makerbuino bootloader in the file directory where it belongs in the Arduino file structure. This took me a while to figure out. I ended up installing another board (littleBits) to understand the file structure and then I added the littleBits “boards.txt” file and then created additional directories to hold the gamebuino bootloader.
Here is where my GameBuino bootloader file ended up:
/Users/myName/Library/Arduino15/packages/littleBits/hardware/avr/1.0.0/bootloaders/gamebuino_boot/
- Edit the board.txt to include the settings required to burn the GameBuino boot loader:
Add the following to the boards.txt file. Note: The starting point for my boards.txt was from the GameBuino downloads, but had to add “arduino:” to the line “gamebuino.upload.tool=arduino:avrdude” to make it work.
##############################################################
gamebuino.name=Gamebuino
gamebuino.upload.protocol=arduino
gamebuino.upload.maximum_size=30592
gamebuino.upload.maximum_ram_size=2048
gamebuino.upload.speed=115200
gamebuino.upload.tool=arduino:avrdude
gamebuino.bootloader.low_fuses=0xff
gamebuino.bootloader.high_fuses=0xda
gamebuino.bootloader.extended_fuses=0x05
gamebuino.bootloader.file=gamebuino_boot/gamebuino_boot.hex
gamebuino.bootloader.unlock_bits=0x3F
gamebuino.bootloader.lock_bits=0x0F
gamebuino.bootloader.tool=arduino:avrdude
gamebuino.build.mcu=atmega328p
gamebuino.build.f_cpu=16000000L
gamebuino.build.core=arduino:arduino
gamebuino.build.variant=arduino:standard
gamebuino.build.board=AVR_DUEMILANOVE
##############################################################
-
In the Arduino software, go to “File -> Examples -> ArduinoISP”. Hook up your Arduino board to the USB port on your computer and Upload this program to your Arduino board.
-
After the ArduinoISP program is uploaded, unhook the Arduino from the computer and wire it up to a breadboard and your “empty” ATMega328 Chip as shown here:
https://www.arduino.cc/en/Tutorial/ArduinoToBreadboard
-
Now hookup the Arduino board back up to your computer USB.
-
Select the “Tools -> Board -> Gamebuino”. Note, after you edit the boards.txt file and re-save, you have to close and restart the Arduino software so the Gamebuino will show up in the Tools->Board menu. If you restart and “Gamebuino” does not show up under “Tools->Board”, you must not have the boards.txt file in the correct location. Mine “boards.txt” file is located in this directory:
/Users/myName/Library/Arduino15/packages/littleBits/hardware/avr/1.0.0
-
Select “Tools -> Programmer -> Arduino as ISP”.
-
Double-check that all your breadboard wiring is correct and all the settings in the Arduino software are correct as listed above.
-
Select “Tools->Burn Bootloader”.
-
The transmit and receive LED lights should be flashing a lot for about 30 seconds. Then the Arduino software should say that the bootloader burn was complete. If the lights just stay constant for a long time, something is wrong.
-
Remove the chip and plug it into a MAKERbuino and see if it works. Mine booted up directly to the settings screen. I hope yours does too!
I struggled with a lot of things to get this to work, but I think the major problem I had was learning to load the ArduinoISP on the Arduino board before hooking up the breadboard.
Hope this note helps save somebody the several hours that it took me to learn this today.
kmatch
Thank you for posting! I look forward to trying this.
I don’t have a 16MHz crystal handy so either will have to wait a few weeks for it to come from China or perhaps I can set up the minimal circuit (which uses the ATmega internal 8MHz clock) and just downgrade to Arduino v. 1.6.x in order to use the available hardware configuration archive from https://www.arduino.cc/en/Tutorial/ArduinoToBreadboard.
Following your post, I was able to load the gamebuino bootloader onto the chip! Thanks for taking the time to post!!!
A few of the pins broke off.
@bitfogav, thank you for answering to @wojtek!
@Dalemaunder, thank you for helping out.
@Lysa_Bacon & @kmatch, I deeply apologize for the blank chip problem. This is quite unacceptable and is a result of our bad quality control. We’ve now added a two-step quality control for the microcontrollers and will not let this happen again.
In the last batch (your batch) of MAKERbuino kits, we’ve sent approx. 30 kits with blank microcontrollers because a worker swapped the box with the bootloaded ones with a box of blank microcontrollers.
This is not an excuse, I am just letting you know what caused this problem on our end (goddamn part-time students, I have to start whipping them harder - joke)
Congratulations on figuring this out, you deserve a couple of badges.
@kmatch, you are THE man! Thank you for writing this super-detailed post on how to fix this! You deserve a couple of badges and I’ll buy you a beer if we ever meet in person
@Pete_Kastner & @kastnerd, is this a case of one person using two accounts? Please use one account only, it will make everybody’s life easier. I’ve answered to your problem in the other topic where you were talking about the broken micro.
Could someone help me with the minimal configuration? I tried it, but I get a “avrdude: Yikes! Invalid device signature. Double check connections and try again, or use -F to override this check.”
This has nothing to do with part-time students, and all to do with me being dumb enough to turn it off while it was loading. (Yes, I know, you can stop laughing now)
@Gemberkoekje,
When you interrupt the loading process, the console’s memory will be blank so you have to do a hard reset like this:
- insert the SD card
- turn the console OFF
- hold the C button
- turn the console ON
- release the C button
- wait for 30 seconds
The SD card loader menu should appear.
You do not need to reflash the chip because of this
Woo, it worked! I was afraid my earlier attempts at fixing the issue might"ve borked this solution, but it totally works again, thanks!