[Solved] Atmega328P doesn't start on custom PCB

Hi there!

Few weeks ago I designed a custom PCB with an Atmega328P.
The link for the schematics and PCB files are here: project files
I encountered the typical "device signature 0x000000" error message, exactly like this one, except my firmware version was 1.18.
It may pe important that I installed an 8MHz crystal and tried to burn the Pro Mini 8MHz (3.3V) bootloader.
Vin is 12V, chip VCC is stable 5V (4.92 to be exact), crystal caps are both 20pF. If I have to redesign the board, I'll use a 16MHz ceramic resonator like the one on the nano.

Looking forward for solution!

UPDATE: (solution)
Thank you for your help, I really appreciate it! I didn't solder one of the crystal pins so it just responded with error. Now soldering error is corrected, everything works fine

The best thing you can do is to embed a picture of the schematic in your OP- making people visit an external site is a bit of a pain. I’ve attached it here to make things easier.

You’re missing the 0.1uF decoupling caps for the microcontroller.

662f438dc6f849f08e2a20c918800ed0.png

Thanks for the answer!

How many do I need?
Is it ok if I just place a cap right next to the VCC pins? Or do I need 2?

One decoupling cap for each power pin as close as it is able.

It may pe important that I installed an 8MHz crystal and tried to burn the Pro Mini 8MHz (3.3V) bootloader.

Tried to burn the bootloader, but did it ?
What is the purpose of D1, D2?

It didn' work. The 0x000000 error happened with the bootloader.
I'll try to add rhose caps.

The diodes are just optional ways to power the board when programming as this is not the final one, they are not even soldered to the board.

Are you sure the bootloader is there? Try to read-out it. Are the fuses set correctly?

Zero response means that there is no connection to the target, so if previous is OK, you have to check serial line.
Serial data must pass to the MCU also DTR (RESET). The MCU have to have working clock, check it.

No, the bootloader isn't there. I got the error when I try to flash it.

Whwn I soldered the chip on a nano board, it immediately flashed the bootloader. Same wires, same programmer.

The MCU has an 8MHz crystal, but the decoupling caps are missing. I'll try to add those on the PCB then retry.

First you have to upload the bootloader.
How it is powered while you are trying bootload via ISP? D2 and its purpose...

I know that I have to upload a bootloader.
I've tried to power it with the onboard regulator and also over ISP. D2 is just shorted at the moment.
Added 2 pieces of 100nF capacitors right next to the chip's VCC pins but I still can not even burn the bootloader.

Can you post the error message that you get when you try to burn the bootloader please?

How can he read out the fuses if ISP programming isn't working?

Unfortunately, the dead-giveaway as to what the problem was is long gone - if you enable verbose upload, and then try to burn bootloader to a virgin (never been programmed) chip, and you see it successfully write the fuses, but then gets 0x000000 error, the issue is that you set it to use a crystal but the crystal isn't present or isn't oscillating. Of course, by the time anyone decides to post, they've almost certainly tried more than once so the information is gone, and likely didn't have verbose upload enabled, so it was never displayed in the first place. This is of course useless information now, but maybe it will be useful in the future (the takeaway is, always enable verbose upload, and if you ever see it write the fuses successfully, but fail to write the hex to flash when burning bootloader, you now know exactly what the problem is).

Without knowing that, there are still only two things that will cause the signature to read as 0x000000:

  • Wiring problem with one of the ISP pins - check that there is continuity from the pin on the programmer to the pin on the target (I get out the pinout chart and use pointy probes to contact the pins on each IC itself, allowing me to rule out any connection problem except for a cold solder joint between the IC and the PCB which doesn't normally make contact, but does when you press on it with the probe when measuring continuity, and yes, that has happened to me more than once. I have personally experienced bad connections at every imaginable point in the cable between programmer and target, systems where everything was fine except the socket that the target was plugged into, bad jumper cables, you name it). Also check that none of the lines are shorted to Vcc, GND, or eachother. (though RESET shorted low or MISO shorted high produces a different incorrect sig)

  • Fuses set to use crystal or external clock, but said is not present, or is not oscillating (due to defective crystal, excessively long traces to/from crystal or loading caps, inappropriate loading caps, or one of the crystal pins shorted to something, usually ground (verify that they aren't connected to ground) - if using SMD caps and soldering them at home, it's easy to get a solder bridge under the cap)

Thank you for your answers!

I finally managed to get it working.

DrAzzy:

  • Wiring problem with one of the ISP pins - check that there is continuity from the pin on the programmer to the pin on the target (I get out the pinout chart and use pointy probes to contact the pins on each IC itself, allowing me to rule out any connection problem except for a cold solder joint between the IC and the PCB which doesn't normally make contact, but does when you press on it with the probe when measuring continuity, and yes, that has happened to me more than once.

My XTAL1 pin was like 0.1 mm over the pad. I observed it for like 5 minutes before I realized there's no solder. Now I'll ask my friend to make a stencil so I won't make this happen again.

Well that would do it!

TBH - you don't need a stencil for small runs if you drag solder it (if doing reflow, you really do - some people insist that you can just apply the paste by hand, but it is much harder, much higher liklihood of having the problem you describe) - I prefer drag soldering over reflow if I'm assembling without a stencil (I consider SOIC to be faster to solder than DIP by hand - drag soldering is pretty magical when you get the hang of it). Soldering SMD passives with an iron sucks though.