Bootloaded successful but can't upload code using 32-pin ATmega328p

I made an “Arduino” on a breadboard using an ATmega328 28-pin DIP. I am using a Sparkfun FTDI Basic to upload code (https://www.digikey.com/product-detail/en/sparkfun-electronics/DEV-09716/1568-1103-ND/5318745?utm_adgroup=Interface%20-%20Modules&utm_source=google&utm_medium=cpc&utm_campaign=Shopping_Integrated%20Circuits%20(ICs)&utm_term=&utm_content=Interface%20-%20Modules&gclid=CjwKCAjwgdX4BRB_EiwAg8O8HT547HS-VWGjOJe98m23ASAOVcS5Q3MTYVWiub7ozC5hKWR73SItyRoCixMQAvD_BwE).

The breadboard “Arduino” works great!

I had the design printed as a PCB but I changed to a TQFP 32-pin ATmega328p. Everything else is the same as on the breadboard. I was able to get the bootloader on the PCB ATmega328p using another Arduino, but I can’t upload code. I get the following error when I try to upload code:

avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x91

PCB “Arduino” TQFP 32-pin ATmega328p Connections:
Pin 2 (D4) --- sensor output (the ATmega pin will be configured as an input)
Pin 3 (GND) --- GND
Pin 4 (VCC) --- 5V
Pin 5 (GND) --- GND
Pin 6 (VCC) --- 5V
Pin 7 (XTAL1) --- 20 MHz crystal
Pin 7 (XTAL1) --- 22 pF capacitor --- GND
Pin 8 (XTAL2) --- 20 MHz crystal
Pin 8 (XTAL2) --- 22 pF capacitor --- GND
Pins 9-14 (D5, D6, D7, B0, B1, B2) --- each pin connected to a different multiplexer latch pin
Pin 15 (MOSI) --- connected to data-in pin on 6 different multiplexers
Pin 17 (SCK) --- connected to the serial clock pin on 6 different multiplexers
Pin 21 (GND) --- GND
Pin 27 (SDA) --- (open when uploading code) connected to a master microcontroller (another Arduino)
Pin 28 (SCL) --- (open when uploading code) connected to a master microcontroller (another Arduino)
Pin 29 (RESET) --- 1 k pull up resistor --- 5V
Pin 29 (RESET) --- 0.1 uF capacitor --- DTR (Sparkfun FDTI Basic)
Pin 30 (RX) --- TX (Sparkfun FDTI Basic)
Pin 31 (TX) --- RX (Sparkfun FDTI Basic)
Note: GND and 5V are supplied by the Sparkfun FDTI Basic

I have made other PCB projects in the past using the 28-pin DIP ATmega328p, but this is my first time uisng the TQFP 32-pin ATmega328p. Is there any difference that I should be aware of?

Did you burn a bootloader in using the IDE, which also programs the fuses?
Serial download without doing that first.

With 20 MHz crystal, be sure to add and use MiniCore with the IDE.

Thanks for the response. Unfortunately this did not solve my problem… It may have made it worse. First, I will respond to your question.

Did you burn a bootloader in using the IDE, which also programs the fuses?
Serial download without doing that first.

I was able to burn the bootloader using Arduino version 1.8.12 and the program from File:Examples:ArduioISP downloaded to the Arduino Uno.

I then burned the bootloader using an Arduino Uno with the following settings:

Board: “Arduino Uno”
Port: “COM4 (Arduino Uno)”
Programmer: “Arduino as ISP”

I’m not sure I understand your question about fuses but perhaps the above will answer it. If not then can you please clarify. Also, I have no idea what you mean by “Serial download without doing that first”.

Now to your second post, I downloaded MiniCore and installed it. I downloaded the program from File:Examples:ArduioISP to the Arduino Uno. I then attempted to burn the bootloader using an Arduino Uno with the following settings:

Board: “ATmega328” Note: this is under the heading Minicore
Clock: “External 20 MHz”
BOD: “BOD 2.7V”
Compiler LTO: “LTO disabled”
Variant: “328P / 328PA”
Bootloader: “Yes (UART0)”
Port: “COM4 (Arduino Uno)”
Programmer: “Arduino as ISP (MiniCore)”

and got the following error:

avrdude: Version 6.3-20190619
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch

System wide configuration file is “C:\Users\NAME\AppData\Local\Arduino15\packages\MiniCore\hardware\avr\2.0.5/avrdude.conf”

Using Port : COM4
Using Programmer : stk500v1
Overriding Baud Rate : 19200
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x29
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x69
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x29
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x29
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x69
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x29
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x29
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x29
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x29
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x29

avrdude done. Thank you.

Error while burning bootloader.

To verify my connections I tried burning the bootloader in the same way I did before. I changed the settings to the following:

Board: “Arduino Uno”
Port: “COM4 (Arduino Uno)”
Programmer: “Arduino as ISP”

and got this error

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

Error while burning bootloader.

I have checked and double check my connections. I was able to burn the bootloader prior to installing MiniCore. Is it possible that MiniCore changed a setting that is preventing me from burning the bootloader like I originally did?

Ok, I managed to burn the bootloader on a second pcb. I was able to get the bootloader installed normally and with MiniCore so I either bricked the other pcb or I didn’t have the connections right.

However, I am still having trouble uploading code.

I get this error:

avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x90

when I use these settings:

Board: “ATmega328” Note: this is under the heading Minicore
Clock: “External 20 MHz”
BOD: “BOD 2.7V”
Compiler LTO: “LTO disabled”
Variant: “328P / 328PA”
Bootloader: “Yes (UART0)”
Port: “COM5”
Programmer: “AVRISP mkII (MiniCore)”

Likewise, I get this error:

avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x34

when I use these settings (with the bootloader installed using MiniCore):

Board: “Arduino Uno”
Port: “COM5”
Programmer: “AVRISP mkII”

Does anyone have thoughts on what is going on/what I can test?

"Pin 29 (RESET) --- 1 k pull up resistor --- 5V".

Try changing to a 10K pull up resistor.

I had a similar thought and replaced the 100 nF capacitor with a 100 uF capacitor and it worked. I just came back to report this good result when I saw your comment. I think replacing the 1k with a 10k would produce a similar result.

Thank you Crossroads and kprims for your replies!

Using the 1k resistor and 100 nF capacitor on the reset pin works with my DIP chip on a breadboard, but apparently not with my TFQP on the PCB. Does anyone know why this could be? Obviously the pulse produced by the capacitor when the DTR pin switches low is different when I increase the capacitance (and similarly if I had changed the resistor). Is there a difference between the two chips, a difference in PCB vs breadboard, or something else that made it necessary to increase the time constant of the RC circuit on the reset pin?

I’ve used a 328P and a PB TFQP, both with 100nF and 1k resistors. I did use a 10k at first but moved it to a 1k. Does the job.

Now I did have an issue with my first IC and I got similar errors. I came to the conclusion of that it was bricked, as once I changed the IC, I followed the same procedure and all was fine. Not sure if I uploaded a 328P bootloader to a PB.

Not had issues since. I use a USBasp for the bootloader and a FTDI module to upload the sketch.

RandyG06:
I had a similar thought and replaced the 100 nF capacitor with a 100 uF capacitor and it worked. I just came back to report this good result when I saw your comment. I think replacing the 1k with a 10k would produce a similar result.

When using a resistor instead of a cap, does it go between reset and ground (on the Uno) like the cap does?

Im having this issue too. Can get the bootloader on, but not the code.

I have tried a 100nF ceramic and a 10uF electrolytic cap. Have not tried a resistor.

Thanks in advance.