I can,t upload my program to arduino.

:frowning: :frowning: :frowning:

Initially my arduino board(UNO) was working properly.Then,i purchased a new micro-controller
Atmel mega328 and replace the old Atmel mega 328 with new one.Then,i can,t upload my program in arduino board.So,anyone told me its solution.

Are any thing special in builtin mega 328 in arduino board?
why the other micro controller is not working?

Error Message

Arduino: 1.6.6 (Windows 7), Board: "Arduino/Genuino Uno"

Sketch uses 450 bytes (1%) of program storage space. Maximum is 32,256 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 2,039 bytes for local variables. Maximum is 2,048 bytes.
avrdude: ser_open(): can't open device "\.\COM4": Access is denied.

Problem uploading to board. See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.

This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.

Your new board is not running on COM4 - perhaps you plugged it into a different USB port or perhpas Windows just used a new port number.

Go to Device Manager and see which port your Arduino is now available on (unplug it / plug it back in and watch the Ports section) then change the Port number under the Tools menu in the IDE.

Watch my video #16 which shows you how to do all this, URL is in the signature of this post. Whilst there you might as well subscribe to my channel !

First of all make sure that your microcontroller has been correctly fit on your development board. Now, why did u actually replace your microcontroller chip.. Were u facing an upload issue earlier as well?

Access denied error has nothing to do with the chip in the socket - that failure happens before it's gotten that far. Even if you saw the board in half and throw out the part with the chip, you can get far enough to get sync errors.

Possible causes:

  • Using Arduino 1.6.8 on windows. This has a horrible bug that causes continual arduino resets and upload failures with access denied. 1.6.5r5 is recommended - 1.6.6 added a ton of compile bugs, 1.6.7 fixed only some of them, and 1.6.8 introduced the serial bug that rendered the IDE unusable on windows.
  • Leaving another application open, using the serial port that the Arduino is on. This can be obvious - if there's an open serial monitor (sometimes I've seen Arduino fail to close the serial monitor when you tell it to upload) or another serial terminal using it, or it can be less obvious - a number of pieces of software exist which assume that any serial port is (whatever device the software is meant to interface with, often a modem) and connect to it and try to use it.
  • Wrong port is selected, and you've selected a port that is in use by another application, and should be.
  • I've seen one report of it being actually caused by driver problems, and was fixed by installing correct drivers for the serial interface.

Why was the chip changed? Was there a problem with the board before the chip was changed?

The new micro controller is connected properly.I think the new micro controller needs some process
like boot loader.

The new micro controller is connected properly.I think the new micro controller needs some process
like boot loader.

Please read my post above.

The chip does need bootloader installed unless it came with one (installing bootloader requires another Arduino, or an ISP programmer like the USBAsps ( available on ebay for $2-3 incl shipping )), but you have a different problem - a non-bootloaded chip will produce an out of sync error, not access denied. Access denied means the IDE couldn't even open the serial port - the USB<->serial converter is a separate part

Thanks a lot to all,I am successed to burn a boot loader in my new micro controller.Now,my board is working properly.