(SOLVED) Bootload + Upload Sketch on ATmega328P-AU

Hi,

I recently purchased an ATmega328P-AU chip. I am trying to load the Bootloader onto the chip and upload a sketch using an Arduino Uno board as an ISP. I have been working on it for a day now and I still didn't manage to even upload the Bootloader. Here's the error I get:

avrdude: Yikes! Invalid device signature.
Double check connections and try again, or use -F to override
this check.

I understand that the ATmega328P-AU is not the typical format for the Arduino Uno board chip but I didn't think this would be an issue here (I've read that it had been done by many already). Is there some kind of compatibility issue I should account for? Here are the processes I followed:

https://www.arduino.cc/en/Tutorial/ArduinoToBreadboard

... accounting for the differences in pins for the ATmega328P-AU vs. ATmega328P-PU, of course. I tried using both Arduino UNO and Arduino NANO as the Boards selected (I believethe Nano kind has ATmega328P-AU as a chip?). I used "Arduino as ISP" as a programmer. I verified my connections many times already and I am quite positive they match those from the links above. I have even tried using Optiboot to load the Bootloader but that didn't work either (if you suggest that I use Optiboot as an alternative, I can provide you with further information on the errors I got).

I am still fairly new to Arduino, so there might actually be a crucial step I skipped without knowing, or something of the kind. Also, if there is anything incoherent about the previous ways of doing, please let me know. Even a simple alternative to burning the Bootloader and uploading a sketch would be greatly appreciated.

Do verbose upload so it will tell you what the signature it sees is.

Do you have a crystal connected?

If not, did you do burn bootloader with Uno selected? If you have no crystal connected, but tried to burn bootloader as Uno the first thing it did was set it to use an external crystal (at which point it can no longer be programmed without an external crystal or clock source).

Thank you for your quick answer.

I do have a 16 MHz crystal connected to the PB6 and PB7 pins of the chip, in series with 22 pF capacitors as indicated.

I tried uploading again with verbose activated and I get:

avrdude: Device signature = 0x000000
avrdude: Yikes! Invalid device signature.
Double check connections and try again, or use -F to override
this check.

0x000000, that doesn't look good... Is it possible that I burned the chip?

vsylvestre:
Thank you for your quick answer.

I do have a 16 MHz crystal connected to the PB6 and PB7 pins of the chip, in series with 22 pF capacitors as indicated.

I tried uploading again with verbose activated and I get:

0x000000, that doesn't look good... Is it possible that I burned the chip?

That indicates wiring problem or incorrectly connected crystal after the chip has been set to use external crystal. Tells you very little about what's going on.

You say "in series" - that's not what you want (and may well not be what you have).

The two traces from the crystal should go direct to PB6 and PB7.
There should also be a 22pf (or whatever your crystals expect) capacitor between each of those traces and ground. ("in series" might imply that they're between the crystal and the chip, which is wrong).

I'm really sorry, I wrote that in a rush and that's definitely not what I actually meant. The design is exactly as you stated: there are two 22 pF capacitors between each of the crystal's traces and ground, and those two very traces also go to the PB6 and PB7 pins. I am sure those connections are correctly wired.

However, does it mean otherwise that it's another wiring problem in my circuit? Also, I just want to make sure - is it safe to assume that the bootloading should work just fine for the ATmega328P-AU using the Arduino UNO as ISP?

Yes, Atmega328P-PU and Atmega328P-AU both have same device signature - only difference is the plastic package and the metal legs that come out.
If you have SCK, MISO, MOSI, Reset, Power, Gnd connected correctly, the programmer can't tell and doesn't care which physical package you have.

I figured you didn't mean in series like that - but if you had, by some chance, thought that was how to do it, that would have been a really easy fix :wink:

CrossRoads:
Yes, Atmega328P-PU and Atmega328P-AU both have same device signature - only difference is the plastic package and the metal legs that come out.
If you have SCK, MISO, MOSI, Reset, Power, Gnd connected correctly, the programmer can't tell and doesn't care which physical package you have.

Ergo, one or more of those isn't connected right :wink:

Bust out the ohm meter, flip it to continuity mode, and check that...
No SPI pins are shorted to eachother, ground, or vcc
No crystal pins are shorted to eachother or other pins, ground, or vcc.
Reset is not shorted to any other IO pins, ground, or Vcc (
Switch it back into resistance mode, and confirm that reset pullup is ~10k as expected.

Test continuity between the pins on the board, and the pins on the programmer, make sure all are correct. Be particularly careful about MISO and MOSI, which by virtue of the similar names, are easy to confuse. MOSI goes to MOSI, MISO to MISO - they're not crossed like serial RX/TX.

It's not the problem, but did you remember the 0.1uf decoupling caps (IME, inadequately decoupled AVRs will start to talk, though they often barf when you try to write to them)? You need one for each Vcc pin (to ground) and one from AVcc to ground as well, as close to the chip as possible. Use 0.1uf ceramic caps.

DrAzzy:
I figured you didn't mean in series like that - but if you had, by some chance, thought that was how to do it, that would have been a really easy fix :wink:

Ergo, one or more of those isn't connected right :wink:

Bust out the ohm meter, flip it to continuity mode, and check that...
No SPI pins are shorted to eachother, ground, or vcc
No crystal pins are shorted to eachother or other pins, ground, or vcc.
Reset is not shorted to any other IO pins, ground, or Vcc (
Switch it back into resistance mode, and confirm that reset pullup is ~10k as expected.

Test continuity between the pins on the board, and the pins on the programmer, make sure all are correct. Be particularly careful about MISO and MOSI, which by virtue of the similar names, are easy to confuse. MOSI goes to MOSI, MISO to MISO - they're not crossed like serial RX/TX.

It's not the problem, but did you remember the 0.1uf decoupling caps (IME, inadequately decoupled AVRs will start to talk, though they often barf when you try to write to them)? You need one for each Vcc pin (to ground) and one from AVcc to ground as well, as close to the chip as possible. Use 0.1uf ceramic caps.

Thank you very much for the suggestions.

I tried every single thing - I made sure that no pins were grounded, connected to each other or to the source directly. I double-checked every single one of my connections. The resistor shows 10k. I made sure I had not confused MOSI and MISO. I also added 1uF decoupling caps at AVCC and VCC. I still get the exact same error message.

I was curious whether it was the pin that was the problem here (I might have burned it in the process, somehow); but I just tried using an ATmega328P-PU I had ordered yesterday, and it still does not work. I get the same error. There must be something I'm doing wrong.

Now, I'm wondering: is it possible that the chips arrived already bootloaded?... This is all I can think of a solution right now (however, I still can't upload a sketch, so I believe that shouldn't be the case).

Turns out that the chips I bought weren't the issue - the actual Arduino UNO I used as the programmer was. I still can't figure out what exactly on the board was the problem, for having checked the connections so many times I thought I would have noticed... Anyway, I used another UNO and it worked like a charm.

Thank you both very much for your help!

If the uno is otherwise functional, I'd wager poor connections. Male dupont jumpers don't always make a good connection (just look at them next to a male pin header pin)... I try to avoid using them as much as possible. The female dupont jumpers, used with pin header, on the other hand, work very well.