Go Down

Topic: Arduino ISP bootloading 328PU w/internal clock (Read 958 times) previous topic - next topic

GoForSmoke

Feb 02, 2012, 01:52 pm Last Edit: Feb 02, 2012, 02:10 pm by GoForSmoke Reason: 1
I have a no-Rev UNO running 0022 and 2 ATmega328PU chips of which one I had tried to bootload and never, even now success. Read through before thinking about "what did the schmuck do wrong?".

1st, loaded the Arduino ISP sketch from Examples. I only have 0022, got the right one and all that.

I did wiring, checked over a dozen times by the Minimal Circuit on this page:
http://arduino.cc/en/Tutorial/ArduinoToBreadboard
including loading the breadboard.txt file to the Hardware folder in my Sketchbook

I also put the 10uF cap across reset and ground with the black-stripe (short) leg in ground.

I made the signature change to avrdude.conf, from 0F to 14. Handy tip, use Edit->Find ATMEGA328 to get right to the proper block, the signature line is right below.

In Tools->Board, selected ATmega328 on a breadboard (8 MHz internal clock)
In Tools->Burn Bootloader, selected w/Arduino as ISP

The first times I got different errors and screwed something I am sure. Put everything away and came back to it earlier today. After setting up I consistently get the Yikes, Invalid device signature error. Consistently for over 2 hours of try everything head-banging. Put everything away and 2 minutes later, set it all up and tried again with the same results.

And then I unplugged the UNO and switched the virgin 328PU. That's right, I even had to bend the pins inward slightly (haven't done much of that since PC memory went to SIMMs) so I KNOW it's the untouched one.
And guess what?
It burned the bootloader without a hitch.
It should do as a replacement for the UNO chip in case of a problem.. I think.. but I'm not prying the UNO chip out just yet. Not going to push Murphy any farther today, thank you.

So now here's my problem. Is the first 328PU bricked for good or is there still hope for it?
Even if not, I think I got off cheap.

Also -- ATMEL sets the pre-scale divider to 8 so internal CPU clock is really 1 MHz. How do I change that and what will I need to change when programming the sucker?
Nick Gammon on multitasking Arduinos:
1) http://gammon.com.au/blink
2) http://gammon.com.au/serial
3) http://gammon.com.au/interrupts

Coding Badly

Quote
Is the first 328PU bricked for good or is there still hope for it?


Probably not.  From what you've described, the most likely problem is that you had accidentally selected the wrong board for burning the bootloader.  If that's the case, you only need to provide a reasonable clock signal on XTAL1 to bring it back to life.

Quote
Also -- ATMEL sets the pre-scale divider to 8 so internal CPU clock is really 1 MHz. How do I change that and what will I need to change when programming the sucker?


The clock option (like "internal oscillator" and "divide by 8") are set using "fuses".  When you burn a bootloader the fuses are automatically changed to match the board (the clock option) you have selected.

GoForSmoke

Okay, time to test my ideas what is going on....

It seems maybe that running on external clock, some or all of the clock fuse bits don't apply as I have seen posts that to me hint that is so, at least internal clock fuse bit? I haven't read that part of the docs enough times to make sense or even where my eyes stop crossing yet. Your first answer seems to confirm that.

Your second part also leaves me doubting my ideas. I thought that the speed my files have to match is the speed the chip is set before burning the bootloader and have been wondering how to change that in the process. But if the target chip isn't running while that programming is going on or is locked to the programmer clock signal then I can how those bits wouldn't matter -except- then I shouldn't have the problem I do with the 328PU that won't bootload!

Obviously I don't know enough about something. The same exact setup and IDE choices that did not work for the first 328PU did work for the second 328PU and when I put the first chip back in the breadboard in the same place, etc, it gives the same Yikes error. And I have no spare 16 MHz crystal to match the hardware files I do have at this time but do have some slower resonators somewhere.

I am sure I have some options as to learning. At this point I can set the problem chip aside and keep using what worked or at least reported as success without digging farther any time soon or I can take an excursion deeper into the whole bootloader/programming side of things. But if I do, it won't be fast as I'm old and damaged and mostly running off long term memory from when I wasn't. It's not an enviable position, I can tell you.
Nick Gammon on multitasking Arduinos:
1) http://gammon.com.au/blink
2) http://gammon.com.au/serial
3) http://gammon.com.au/interrupts

Go Up