Go Down

Topic: Unable to burn bootloader on factory default ATmega328 (Read 1 time) previous topic - next topic

linemouth

I have been using a Nano '328P with the ArduinoISP example sketch, and I can't get the fuses or bootloader written to a brand-new ATmega328 (no P). The new chip is installed on a board of my own design, which has nothing more than the '328 itself, a regulator, some filter caps next to the power pins, and a 16MHz ceramic resonator (with internal caps). Right now, because of the default fuse settings, it's not using the 16MHz resonator, and is instead using an internal 8MHz oscillator with a divide-by-8 circuit, resulting in 1MHz operation (in theory). I have this board hooked up to the Nano in the following configuration:
Nano                   Custom board
pin 10      to      Reset (with 10k Ohm pull-up)
pin 11      to      pin 11
pin 12      to      pin 12
pin 13      to      pin 13
Ground      to      Ground
+5V          to      +5V

I've been using LEDs and an oscilloscope to monitor the activity on the SPI/Reset lines, and when I use AVRdude (so I can use the -F feature), I see no activity at all, so I know that neither of the chips are communicating with each other. The device signature and fuse reads always return 0x00's because the lines are being held low for some reason, yet the Nano thinks that it's actually reading data. There was ONE TIME that the Nano happened to read the correct signature, but unfortunately, I didn't use -F that particular time, and it might have been my only chance all day. =(

From what I can see, there could be problems with the Nano as the programmer (due to the lack of communication), and there could be issues with the 1MHz clock. My first idea leads me to think that decreasing the speed at which the Nano probes the new chip might help, because the SPI bus has to operate at less than 1/4 the clock speed of either chip. Now, I want to say that this has nothing to do with the RX/TX baud rate, so does anyone know how to change the ISP speed to something insanely slow?

Other than that, my mechatronics professor and I are both at a loss... I've measured continuity, voltages on all pins, impedance, and I've watched the SCK line give out pulses of about 20-40 clocks, then stop, as if there's something intermittently connecting, but continuity checks out. When I measure the voltages on the resonator pins with the o-scope, both the Nano and my chip give the same results: XTAL1 is about .45V and XTAL2 is about .3V, and neither have any noise (probably because my o-scope can't measure that small of periods). On the new chip, all the pins are tri-stated and have ambient noise of similar amplitude to a floating wire.

Even though the tutorials don't call for it, I've tried all the possible combinations of pull-up/down resistors on the SPI bus/clock with no effect other than making AVRdude read 0xff's instead of 0x00's.

Any ideas, please! I've had no success with this, nor with anything else today- wow, I suck.

Nick Gammon

Try running this (I think the wiring will be the same):

http://www.gammon.com.au/forum/?id=11633

See if you get any life out of it.

If so, can you tell me the chip signature? Or post what you get.

Nick Gammon


The new chip is installed on a board of my own design, which has nothing more than the '328 itself, a regulator, some filter caps next to the power pins, and a 16MHz ceramic resonator (with internal caps). ... I have this board hooked up to the Nano in the following configuration:
Nano                   Custom board
pin 10      to      Reset (with 10k Ohm pull-up)
pin 11      to      pin 11
pin 12      to      pin 12
pin 13      to      pin 13
Ground      to      Ground
+5V          to      +5V


Can you be a bit more explicit about the wiring? A "board of your own design" doesn't necessarily bring out the signals the way you expect.

Just to be clear:

Code: [Select]
Programming Nano    Target board

D10 (SS)            Reset - pin 1
D11 (MOSI)          Pin 17
D12 (MISO)          Pin 18
D13 (SCK)           Pin 19

Gnd                 Gnd
+5V                 +5V


On the "target board" I am referring to the chip pins, not the Arduino pins.

linemouth

I'm using the 32TQFP '328: http://www.atmel.com/Images/8271S.pdf. The uC connections are MOSI to MOSI, MISO to MISO, SCK to SCK, and SS to RESET. I've verified several times, and my board is correct. On a hunch, I tried doing MOSI to MISO, MISO to MOSI, thinking that they might behave like TX to RX, but to no avail. My board basically is a Mini clone, and matches the pins of the uC to the arduino headers in the same order. The only differences are physical location of the pins, and there are no electrical/pin label changes.

Last night, I set up the command prompt to loop 10,000 times over trying to program it, and I set up a 555 to reset the nano every so often if it falls asleep. Nothing changed, but I can now see the SCK line activity on the pin 13 LED on the Nano. I can also see the SS to Reset line activity on an LED. Although, looking at it right now, it seems like the reset pin goes low when the SCK line starts flashing- could it be that the reset needs to be inverted, because it's active low? It seems like they would have implemented that in the program.

Other than that, I'm still out of luck.

Nick Gammon

How about trying my sketch huh?

Quote
On a hunch, I tried doing MOSI to MISO, MISO to MOSI, thinking that they might behave like TX to RX, but to no avail.


No that is not the case. MOSI goes to MOSI and so on.

Quote
I set up the command prompt to loop 10,000 times over trying to program it,


Would be quicker to load my sketch and try it. Doing it 5000 times is not going to fix anything.

Quote
Although, looking at it right now, it seems like the reset pin goes low when the SCK line starts flashing- could it be that the reset needs to be inverted, because it's active low?


No. The programming process pulls reset low, and it stays low while SCK clocks in programming commands. That is how it works.

Quote
I've verified several times, and my board is correct.


Could  you please state your pin numbers? What have you got connected to what? Not just it "is correct".

Go Up