I have the UNO with the ATMEGA328P. When I try to upload my program I get the Message "Problem Uploading to Board". I have the COM port set (COM4 (Arduino Uno). Nothing is connected to Pin 1 and 2. The green light is on and the Orange is flashing. I've tried a new USB cable. I've also opened my sketch in the IDE rather than double clicking it. Thank you. Below is a portion of my output:
System wide configuration file is "C:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf"
Using Port : COM4
Using Programmer : arduino
Overriding Baud Rate : 115200
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0xb5
Try the loopback test, set if the 16U2/USB interface is working.
Jumper Reset to Gnd.
Connect pins 0 and 1 (Rx and Tx).
Open the serial monitor, and type something. Does what you type get repeated back after you hit Enter? If not, the 16U2 is not working. Perhaps dead, perhaps needs reprogramming.
If it works, then perhaps your '328P is needs a new bootloader, or your sketch is too busy blasting stuff out on Tx for the download to start. Try this: under File Preferences, turn on Verbose outputs. Press & Hold Reset, then start the download. When you see "compiled xxx of 32xxx bytes" release Reset. Might take a few tries to get the timing right.
If you can't get that to work, then reinstalling the bootloader is the next step.
Remove any connections to pins 0 and 1. These pins are used for communication with your computer, including uploads. Connecting anything to these pins can interfere with uploads.
Do a loopback test following these instructions. If it passes, you know the USB to TTL serial adapter chip on your Arduino board is good. If it fails, your board is damaged beyond economical repair and should be replaced.
If the loopback test passes. Try doing a Burn Bootloader:
Connect an ISP programmer to the ICSP header on your Arduino board. If you don’t own an ISP programmer, you can follow these instructions to make one out of a spare Arduino board: https://www.arduino.cc/en/tutorial/arduinoISP
Select your board from the Tools > Board menu and any other custom Tools menus (e.g. Tools > Processor).
Select the appropriate programmer from the Tools > Programmer menu.
Thanks for your help. I did try the loopback test and that test worked. It sent back my the data I typed after I pressed enter.
I tried the test of holding down the reset button and releasing it when the output turns orange. I assume that when it starts uploading the code. I still get "An error occurred while uploading the sketch".
I think the next thing to do is burn Bootloader. Someone else posted instructions for that.
I guess I'll need to get an ISP Programmer or make one from an Arduino. The loopback test works. I'll check the store and order the ISP programmer. I don't think we have a spare Arduino. Our machine shop has been using these Arduinos. Not the best idea. I normally write SW for embedded systems.
You could be using a charge-only cable which cannot transfer data. Use proper data cable and make sure it's working. Also check the installed drivers carefully, uninstall the drivers and install all drivers which are verified for Arduino.