I´m new to the Arduino family, but I think you should try the code with a new Atmega chip on your board. Perhaps your Atmega chip is broken. Good luck…
No, before you spend any money (and waste time) on a part that may not be the problem, you should perform the serial loop back test to see if the board’s 8u2 USB serial convertor chip is functioning or not. A failure of serial communications for any reason will give you the error code you are seeing.
- unplug board from pc.
- Put a jumper wire from a ground pin to the reset pin.
- Put a jumper wire from digital pin 0 to digital pin 1.
- Open the arduino IDE and click on tools/serial port and write down the avalible ports.
- Close the arduino IDE
- Plug in the arduino to the PC, it should sound the new USB connection, if not you have a PC arduino driver problem.
- Open the arduino IDE and click on tools/serial port and you should see a new port number that wasn’t shown in step 4. If you don’t have a new port number avalible you have a PC arduino driver problem.
- Select the ‘new’ comm port number.
- Click on the serial monitor button.
- Anything you type in the serial monitor’s send window and then send should echo back into the monitor’s receive window.
If that works then you have no serial communications problems, only then might you want to try a new replacement 328 chip. Be sure you know what bootloader is installed in the replacement chip you purchase as that determines what board selection you have to use.
If the serial test does not work then there is mostly likely a problem on your arduino board other then the 328 chip and you will not cure it by replacing the 328 chip.