Hi,
I have made three sets of boards with atmega328p chips. Each set is 100~200 boards and they serve different purposes, so the functionality, connected chips, etc is all different between them.
These boards can be divided into two groups, 'good' and 'bad'. Bad is on the order of ~5~10% of total boards.
On all boards, programming through AVRISP MKII ICSP works to load optiboot 8.0 with 38400 baud upload rate.
With 'good' boards, avrdude upload succeeds, sketch is loaded, and uart rx and tx are working.
On 'bad' boards, avrdude will fail, usually with
avrdude: initialization failed, rc=-1
or
stk500_getsync() not in sync
If I load the full sketch along with the bootloader with ICSP, UART i/o and sketch both work fine on 'bad' boards.
If I scope the reset pin of good or bad boards, DTR toggle holds reset low for 250us, so that shouldn't be it.
Using 5v or 3.3v does not make a difference in the behavior.
I also tried Optiboot recompiled for slower upload rates (tried 38400 and 9600). This works on the working boards, but does not fix the 'bad' ones.
Of the boards, two sets were from a different pcb house, assembler, and part source, same issues. It looks like a design issue. In some instances, swapping the ATMEGA328 device between a 'good' and 'bad' board will cause the fault to follow the chip, sometimes stay with the board, and sometimes both boards are fixed. This makes me think that something is borderline out of spec.
The overall setup is very bare bones. Internal 8MHz oscillator, 3.3v power (LDO on one board, switching on the others), a few 1uF decoupling caps, 10k pullup + 1uF between reset and DTR. Series 100ohm on uart lines (setting to 0-ohm did not change behavior). Fuses are set to FD DC E2.
Ideas?