Bootloader reflashed, flashing code via USB gives "not in sync: resp=0x00"

Let me preface by saying that before posting, I have read a number of forum posts regarding the "not in sync: resp=0x00" error, as this is a general error, and none I have seen describe my specific issue. I have done a fair bit of troubleshooting now, without success, so now I turn to the community for help.

I have an Arduino Uno, that I have been programming successfully with a USBAsp programmer like this one. After deciding to go back to programming via the Arduino's USB interface, I used the USPasp flashed the bootloader via the following process:

Tools>Programmer>USBasp
Tools>Burn Bootloader
IDE responds with "Bootloader burned successfully"

However, after disconnecting everything and connecting the Arduino via USB, flashing my code gives the error:

avrdude: stk500_getsync(): not in sync: resp=0x00

The following is a list of troubleshooting I already performed:

  • Wrong board selected? - I selected board with Tools>Board>Arduino Uno; also tried Arduino Duemalinove or Diecimila with Processor>ATmega328P as this is the same chip
  • Wrong COM port? - Port identifies itself as Arduino Uno; disappears when I unplug the Uno; tried all the other COM ports anyway
  • Is the ATmega328P dead? - The board executes code that was last placed on it; reading Tools>Get Board Info gives me information about the Uno that is connected
  • Is it an issue with drivers? - Tried it on both my Windows PC and Linux laptop, same result; Windows PC used to write to the board properly beforehand
  • Loopback test? - Performed it according to instructions I have seen, and I get no response
  • Is my USB cable broken? - Tried another cable, neither work; the previous cable also used to work
  • Is my USB port not powering the Arduino adequately? - Tested 5V and 3.3V, both were at adequate levels

I suspect that the fault may be with the ATmega16U2 chip, however most testing instructions I found involved a second Arduino which I do not have. There are 4 test points marked JP2 on the board next to the Atmega16U2 that I thought of testing, but not sure how to approach this problem. Do I test for continuity? Test for voltages? And between which combination of pins? According to the datasheets, the points correspond to PCINT3-6, although I am not sure what that means.

I have also heard about the watchdog and how it may be causing issues, although I don't really know how to test for that or fix it.

Any help is appreciated, thank you!

Since your loopback test is failing it seems like you have a problem with the atmega16u2 chip. Already you have a USBasp then could try reflashing the atmega16u2, lets see if that solves the problem also make sure you have nothing else hooked up to tx and rx pins

Thank you for the advice, I didn't consider doing that! As I have an Uno R3, there is already an ICSP header for the ATmega16u2.

I hooked up everything and followed the instructions https://github.com/arduino/ArduinoCore-avr/tree/master/firmwares/atmegaxxu2.

Most importantly, I executed the following (without the -F flag as instructed at first, but neither worked):

avrdude -p at90usb82 -P usb -c usbasp -U flash:w:UNO-dfu_and_usbserial_combined.hex -U lfuse:w:0xFF:m -U hfuse:w:0xD9:m -U efuse:w:0xF4:m -U lock:w:0x0F:m

And this was the response:

avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: error: program enable: target doesn't answer. 1 
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.


avrdude done.  Thank you.

If using -F, the following happens:

avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: error: program enable: target doesn't answer. 1 
avrdude: initialization failed, rc=-1
avrdude: AVR device initialized and ready to accept instructions
avrdude: Device signature = 0x403e41
avrdude: Expected signature for AT90USB82 is 1E 93 82
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.

avrdude done.  Thank you.

The warning for the usbasp has not stopped me from programming the ATmega328P, so I assume this isn't the reason I can't communicate with the device? As a side note, I double-checked the wiring (I had it wired incorrectly at first, after realising that the top is actually near the AREF pin) but still nothing. Is the ATmega16u2 dead?

You need to update the firmware of usbasp to proceed. So consider updating the firmware of the usbasp then try again

Is there any way of doing that without requiring a second usbasp (or an Arduino with a working ATmega16u2)? The main reason why this whole journey started was because I wanted to use the Arduino to upgrade the usbasp firmware. I was holding off since it still works when flashing the ATmega328P.

I don't think you can't do anything without any other programmer. Check if the atmega16u2 goes to dfu mode and try using dfu mode to upgrade it

The warning for the usbasp has not stopped me from programming the ATmega328P, so I assume this isn't the reason I can't communicate with the device? As a side note, I double-checked the wiring (I had it wired incorrectly at first, after realising that the top is actually near the AREF pin) but still nothing. Is the ATmega16u2 dead?

Try this command now you are hooked up correctly.

avrdude -p atmega16u2 -P usb -c usbasp -U flash:w:Arduino-COMBINED-dfu-usbserial-atmega16u2-Uno-Rev3.hex -U lfuse:w:0xFF:m -U hfuse:w:0xD9:m -U efuse:w:0xF4:m -U lock:w:0x0F:m

@m_k_akash Thank you for your advice, I'll try using the DFU programmer later today

@kprmis That setting the device as the atmega16u2 didn't change anything, but it seems the device signatures still do not match:

avrdude: Device signature = 0x50f609
avrdude: Expected signature for ATmega16U2 is 1E 94 89

@m_k_akash

Using dfu-programmer (and following the instructions here) I get the "no device present" error"

>$ sudo dfu-programmer atmega16u2 erase
dfu-programmer: no device present.

However, the chip seems to be okay? It identifies itself correctly via lsusb:

>$ lsusb
Bus 002 Device 034: ID 2341:0043 Arduino SA Uno R3 (CDC ACM)

avrdude: Device signature = 0x50f609

Does the signature change most times?

If it does, double check each lead for problems. Sometimes you can hold/push them while running the command and get it to go.
Check for a cold solder joint on the 12 MHz crystal.

@kprims You are right, the signature changes every time I call avrdude (maybe I'm reading too much into this, but the device remained 0x50**** while I had the usbasp programmer connected and tried the command a few times to see the device signature, but after replugging the usbasp, the first byte changed).

I checked every lead, via DMM continuity test, between each pin, programmer to ICSP header, everything signalled perfect connection. I also tested the same lead to reflash the ATmega328P a few times just now, with success every time.

I also checked the solder on the crystal, and all seems good (continuity test also succeeds, although I'm not sure that's how the crystal is meant to behave when unpowered). However, since the ATmega328P operates properly (I usually run the Arduino for extended periods of time unattended and it's not failed yet), I assume the crystal is not at fault here.

@m_k_akash I did more experiments with the DFU programmer. After reading this, I decided to try using the Flip programmer under windows, and following the rest of the instructions here. I understand that those instructions are for the 8u2 not 16u2, so I changed the commands accordingly. However, at the part where it said "Reset the 8u2 or 16u2" by shorting the RST and GND pins (on an ICSP header on the UNO R3), and no reset occurs.

I heard about the 16u2 having a "strong reset" which I'm unable to just reset by shorting the two pins. Is there any other way I'm able to perform a reset on the 16u2?

Thank you both for your help so far!