Arduino Nano uploads code only once stuck on second upload

Hi everyone,

I'm using a clone Arduino Nano with an ATmega328P and a CH340 USB chip.

When I upload code the first time, it works fine. But when I try to upload a second sketch or upload again, it just gets stuck on "Uploading…" in the Arduino IDE

I can fix this by reburning the bootloader using a USBasp and this AVRDude command:

C:\avrdude\avrdude.exe -C C:\avrdude\avrdude.conf -c usbasp -p m328p ^
-U efuse:w:0xFD:m -U hfuse:w:0xD9:m -U lfuse:w:0xFF:m ^
-U flash:w:"C:\avrdude\atmega.hex":i

But this is very annoying to do every time.

I already tried:

  • Selecting ATmega328P (Old Bootloader) in the Arduino IDE
  • Pressing the Reset button during upload
  • Changing USB ports and cables

Still, it only works once after that, it hangs unless I re-burn the bootloader.

My Questions:

  1. Is my AVRDude command correct for this clone Nano?
  2. Why does it only upload once?
  3. How can I fix it permanently, so the Arduino IDE uploads every time?

Thank you in advance

What are the upload results when you use the IDE? (the IDE should time out)

There are lock bits to protect the bootloader section from a software update you have to set.
With USBasp it is able read out everything from ATmega to check the settings - flash, fuses, etc.

I have never burned a bootloader in 60+ years of programming. Maybe the serial monitor was left open, and that prevented the second upload.

Welcome!
I have seen that many times. Most of the time, cycling the power, closing the IDE and reloading it solves the problem. Nice part the IDE automatically reloads the sketch I was working on. Generally a shorter cable will give better results. I also add a delay(3000) or something like that in the setup() just after I set the baud rate. This allows things to settle down and If my software floods (locks up by constantly printing) it gives me a moment to recover.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.