Failed to upload code to ATmega328P U-TH after successfully burned the bootloader

Recently I followed Nick Gammon's guide to burn the bootloader to the ATmega328P -PU and use the chip at 8Mhz (internal RC oscillator). The process went smoothly so I decided to switch to using the ATmega328P U-TH (smd chip) too. However after burning the bootloader successfully according to Nick Gammon's "How to make an Arduino-compatible minimal board". I'm now unable to upload any code to the ATmega328P U-TH using the CP2102 USB to Uart module. The Usb-Uart module works completely fine as I have plugged it back to the ATmega328P-PU breadboard I made earlier and it still works as normal.
The board that I made is wired like this:
IC: ATmega328P U-TH

  • GND: Pin 3,5,21

  • Vcc: Pin 4,6,18

  • A 100nf ceramic capacitor between pin 3 & 4, pin 5 & 6, pin 18 & 21

  • Reset: Pin 29 to 10K Ohm to Vcc

  • Pin 30(RX) to TXD of Usb-Uart

  • Pin 31(TXD) to Rx of Usb-Uart

  • Pin 29(Reset) in series to 100nF capacitor to DTR of Usb-Uart

  • Vcc and Gnd to the respective Vcc (3.3V) and Gnd of Usb-Uart

Yes I've check continuity of all the wire on my board. I'm using the TQFP to DIP breakout board to make the SMD Atmega328P U-TH breadboard compatible. All the capacitors are soldered on the header of the breakout board so it shouldn't be too far from the chip. The error output is below:

Arduino: 1.8.13 (Windows 10), Board: "LilyPad Arduino, ATmega328P"
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:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf"

         Using Port                    : COM3
         Using Programmer              : arduino
         Overriding Baud Rate          : 57600
         AVR Part                      : ATmega328P
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PC2
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : Arduino
         Description     : Arduino

avrdude: stk500_getparm(): (a) protocol error, expect=0x14, resp=0xfc
         Hardware Version: 2
         Firmware Version: 0.16

avrdude: stk500_getparm(): (a) protocol error, expect=0x14, resp=0xfc

avrdude: stk500_getparm(): (a) protocol error, expect=0x14, resp=0xfc

avrdude: stk500_getparm(): (a) protocol error, expect=0x14, resp=0xfc

avrdude: stk500_getparm(): (a) protocol error, expect=0x14, resp=0xfc

avrdude: stk500_getparm(): (a) protocol error, expect=0x14, resp=0xfc
         Vtarget         : 420030.5 V
         Varef           : 197961888.0 V
         Oscillator      : 0.531 Hz
         SCK period      : 11340798.7 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: reading input file "C:\Users\Admin\AppData\Local\Temp\arduino_build_467026/ASCIITable.ino.hex"
avrdude: writing flash (1954 bytes):

Writing | ################################################## | 100% 0.56s

avrdude: 1954 bytes of flash written
avrdude: verifying flash memory against C:\Users\Admin\AppData\Local\Temp\arduino_build_467026/ASCIITable.ino.hex:
avrdude: load data flash data from input file C:\Users\Admin\AppData\Local\Temp\arduino_build_467026/ASCIITable.ino.hex:
avrdude: input file C:\Users\Admin\AppData\Local\Temp\arduino_build_467026/ASCIITable.ino.hex contains 1954 bytes
avrdude: reading on-chip flash data:

Reading | 
avrdude: stk500_paged_load(): (a) protocol error, expect=0x10, resp=0x00
avrdude: stk500_paged_load(): (a) protocol error, expect=0x10, resp=0x00

###avrdude: stk500_cmd(): programmer is out of sync
avr_read(): error reading address 0x0000
    read operation not supported for memory "flash"
avrdude: failed to read all of flash memory, rc=-2
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0xe0

avrdude done.  Thank you.


Could anyone tell me what did I do wrong? Maybe I'm missing something.

Thank you so much for your time

I see your data terminal ready (DTR) being used, but Nick specifically uses Request To Send (RTS) to reset the 328... ?

Screenshot from 2022-12-04 07-52-25

Could you be using dtr instead of rts?

:smiley_cat:

Could it be that the fuses are not set to allow reading of FLASH? That would indicate that something went wrong when you burned the bootloader.

I've been using the DTR pin of the CP2102 with the DIP version of the ATmega328P without any problems though. The same method should works with the SMD version of the Atmega328P right? I dont have any FTDI cable on hand so I can't really test it out. Maybe the Chip is faulty but the bootloader code show "No errors found" everytime so I don't really know what's wrong

Can you please tell me if the fuses are set correctly or not ? Honestly I'm just getting started to use the standalone Arduino


Atmega fuse calculator.
Written by Nick Gammon.
Version 1.11
Compiled on Dec  4 2022 at 22:10:57 with Arduino IDE 10813.
Attempting to enter programming mode ...
Entered programming mode OK.
Signature = 0x1E 0x95 0x0F 
Processor = ATmega328P
Flash memory size = 32768
LFuse = 0xE2 
HFuse = 0xDA 
EFuse = 0xFD 
Lock byte = 0xEF 
Clock calibration = 0xCE 
External Reset Disable.................. [ ]
Debug Wire Enable....................... [ ]
Enable Serial (ICSP) Programming........ [X]
Watchdog Timer Always On................ [ ]
Preserve EEPROM through chip erase...... [ ]
Boot into bootloader.................... [X]
Divide clock by 8....................... [ ]
Clock output............................ [ ]
Bootloader size: 2048 bytes.
Start-up time: SUT0: [X]  SUT1: [ ] (see datasheet)
Clock source: calibrated internal oscillator.
Brownout detection at: 2.7V.

If you're following a procedure, it's usually wise to follow it as described...

There is a major difference between DTS and RTS in communications. I would think Request to send (RTS) would be more likely to want a 'reset'... to be able to send it something ... which is were you're having the problem...

Is it easy to make the change and give it a try? Is it on a breadboard..?

:smiley_cat:

I tried using the RTS pin just like you told me, all the fuses are set the same as Nick's guide using the Lilypad bootloader. Nothing worked. So in my last ditch effort I used the MiniCore bootloader and everything worked! Thank you all for your help!

Great... glad you're up and running...

Take care ... have fun...

:smiley_cat: