Arduino nano ATmega328p with CH341 won't upload When I try to upload a sketch to an Arduino Nano, it stays stuck on uploading, and after a time it shows the following error code:


stk500_getsync() attempt 1 of 10: not in sync: resp=0xc2
stk500_getsync() attempt 2 of 10: not in sync: resp=0xc2
stk500_getsync() attempt 3 of 10: not in sync: resp=0xc2
stk500_getsync() attempt 4 of 10: not in sync: resp=0xc2
stk500_getsync() attempt 5 of 10: not in sync: resp=0xc2
stk500_getsync() attempt 6 of 10: not in sync: resp=0xc2
stk500_getsync() attempt 7 of 10: not in sync: resp=0xc2
stk500_getsync() attempt 8 of 10: not in sync: resp=0xc2
stk500_getsync() attempt 9 of 10: not in sync: resp=0xc2
stk500_getsync() attempt 10 of 10: not in sync: resp=0xc2


Sometimes the resp=0xc2 variable changes to another hex code.

The weird thing here is that before this happened everything worked fine. I could upload and the serial communication was fine. But after trying to upload the same sketch with a different variable, this started to happen.

Windows recognizes the COM port, in Arduino the COM port is selected. Sometimes, without doing anything, the Arduino works fine again, I can see the serial communication fine, but after some time the serial communication stops sending and again I can't upload the sketch.

I have 2 Arduino Nanos. Both of them start presenting the same problem. But the other one has the Power, RX, and TX led always on and this one never worked again, like the other one that sometimes can upload the sketch and see the serial communication that the last sketch was sending. I have an Arduino Mega, this one has the ATmega16U2 to communicate to USB and this one works fine. And I also have a NodeMCU Lua, with CH341. But this one works just fine.
If you are using a fairly recent version of the Arduino IDE, try using the old bootloader for the 328P.
Go to Tools --> Processor:"ATmega329P" --> ATmega328P(Old Bootloader)