[SOLVED] Reburn ATMega328 Bootloader from Uno to Internal Clock

Hi Everyone,

Apologies if a similar question has been posted before -- I searched around this section, but was not able to find an answer.

I recently purchased a blank Atmega328p for an embedded project. To save components, I would like to have this Atmega328 use its internal clock. Per the instructions here, I set up my Uno as an ISP, wired up a breadboard circuit, and was able to program my blank Atmega to use its internal clock. Thinking I may use this bootloader variant for multiple future projects, I transferred my breadboard circuit onto a protoshield and tried to re-burn the bootloader to the chip. The burn was not successful.

I later realized that this burning instance failed, due to the fact that my male header pins weren't making contact with my Uno female headers. However, before realizing this, I thought I may have fried my Atmega328, so, to verify the chip's functionality, I burned an Uno bootloader (w/ external oscillator) to the chip using a shield I previously made.

The good news is that the Uno bootloader burned successfully, so the chip is not fried. The bad news is that now that I've fixed the header issue on the new protoshield, I am unable to reburn the internal clock bootloader to the chip. Instead, I get the dreaded "Device signature = 0x000000. Yikes! Invalid device signature." error whenever I try to reburn the internal clock bootloader.

After some searching online, I found a reference that suggest by burning the Uno bootloader, I set the chip's fuses to use an external oscillator and that this cannot be reset using an Arduino as an ISP. Does this seem correct? Could anyone offer insight into this for me? Also, if anyone could offer some advice as to how to reset this Atmega chip without having to purchase an external programmer, I would appreciate it.

Thanks in advance!
arduinoRobo

I have some stuff about uploading .hex files here:

In particular that sketch outputs a "clock" on D9 so you can connect that up to the clock pin (pin 9 or XTAL1) to clock the target board.

Then you can use it to reprogram the fuse appropriately. Make sure you get the fuse right.

http://www.engbedded.com/fusecalc

Also see here about minimal boards:

Hi Nick,

Thank you very much for the links. These are great references. Reading the "Alternate Clock Source" section of your second post, I had a quick question. From this text, am I correctly understanding that the chip in my current setup is not responding ( "Device signature = 0x000000." error) when in my new protoshield because there is no external clock? Because the chip is expecting an external oscillator, but is not getting anything, nothing is "ticking" on the microcontroller, causing it to be unresponsive, correct?

As such, could I simply use my old protoshield (the one with a 16MhZ clock) to make the chip responsive, and, using the ArduinoISP sketch that comes with the Arduino programming environment, choose to burn the 8MhZ internal bootloader instead of the Uno bootloader when the chip is in this shield? Would this successfully reset the fuses, or is the fuse resetting something unique to your Atmega board programming sketch?

Thanks again for the links!
arduinoRobo

Yes you should be able to do that. There is nothing particularly magical about the fuses, the are like a "configuration file" for the processor.

If you shove some clock pulses into the XTAL1 pin (as I suggested you could do with that sketch) then the chip should respond and allow you to reprogram it. Or temporarily attach a crystal or resonator as I showed in some of my photos.

The Arduino bootloader burning process also modifies fuses, so doing a bootloader burn should fix your issues.

Hi Nick,

Thank you for getting back to me so quickly. I just tried what you suggested and the following happened:

I put the chip into the shield with the crystal, selected my board as an Atmega328 with an internal crystal, and clicked burn bootloader. According to the Arduino environment, the bootloader burned successfully, which is great news.

However, I now wanted to verify that my new, dedicated shield (the one without the crystal), could also burn the bootloader. Unfortunately, when trying to burn the bootloader with this shield, I get the "Device signature = 0x000000." error again. Turning on verbose output, I get an avr dude message that says "AVR device initialized and ready to accept instructions," which would suggest to me that the chip is recognized and is ready to go. However, the device signature error still makes it seem as if my chip is not responding. I guess this means there is still an error in my protoshield circuit?

I will try breadboarding the internal crystal bootloader circuit to see if this works and report back.

Thanks!
Alex

Hi Nick,

Just breadboarded the circuit. Indeed, the external oscillator bootloader burns fine when I do it this way now that the fuses were reconfigured from the previous burn. Guess there is a loose connection somewhere in my new shield.

Glad I could fix the issue though! Thank you so much for your help! Learned something new today :).

I thought that the chip configured its fuses (i.e. clock/no clock) based on what was connected to it. As such, I was under the impression that I needed to have a dedicated circuit for burning bootloaders with and without external clocks. Good to know that I can use my old shield for both! Still bugs me that the other shield isn't working, so I'll go hunt for the loose wire anyway ;).

Cheers!
arduinoRobo

No the fuses do not auto-configure.