Breadboard prototype works, but not production PCB

I've put together many successful prototype builds using ATmega1284P on a breadboard, using MightyCore and the Arduino client. I'm using a CH340 serial adapter to program the board. Here's my wiring:

  • I'm using an external crystal connected to ground by two 22pF capacitors.
  • The reset pin is pulled high using a 10K resistor.
  • A momentary switch separates reset and ground.
  • As for the programmer, it is connected to Vcc, GND, RX, TX and to Reset via a 100nF capacitor.

I can program it perfectly using the Arduino IDE and Mightycore, and upload a Blink sketch.

Now onto the PCB. I made a more permanent version using a PCB I designed, with a bunch of pins broken out in addition to the Vcc, GND, RX, TX and Reset pins needed to program the board. Here's the schematic and the PCB layout:

I've circled the programming headers in green. Essentially, it seems to me that the layout is exactly the same as my version on the breadboard, however when I attach my programmer to my programming pins and use the same settings to try upload in the Arduino IDE, I get an avrdude error:

avrdude: stk500_recv(): programmer is not responding

avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00

I know it's not a problem with the chip or the crystal or the other capacitors - when I solder in the chip preprogrammed with the Blink sketch, it works like a charm. I just cannot get it to program on my PCB version. Again, the breadboard version can be programmed with the same settings without a problem.

  • I've checked (and tried swapping) RX and TX
  • I've replaced the 100nF capacitor
  • I've tried hitting reset before, during and after the upload begins

Any ideas? It must be something wrong with my PCB, but can't for the life of me see what the problem is.

I don't see actual connections to +5V...

@westfw - 5V and GND are connected via copper pours on the top and bottom layers.

Are you sure?
Maybe I just can't tell from the picture...
I mean, I can see the thermals from the GND pour to the GND pins of the chip (and the caps), but either the +5V thermals are REALLY faint, or they're not there. (and why aren't the +5V traces from the chip to the caps merged with the ground plane?)

The 5V thermals are there, just on the bottom (blue) layer :slight_smile:

Okay, problem solved, and it was a tricky one to troubleshoot. The 1284P Mightycore bootloader didn't like my 20MHz crystal on the PCB. I swapped it out for a 16MHz, reflashed the bootloader with the 20MHz version and then replaced the crystal again.

Sorted. Weird!