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.