Issues setting up a custom Arduino based board.

I've been working on getting a custom board using an ATMega328P-PU chip set-up on my Windows 7 PC. It initially appeared under my Device Manager as Atmega16U DFU, so I downloaded FLIP and flashed the Uno R3 firmware into it. The board then shows up as Arduino UNO R3 in my Device Manager. I open up the IDE, select the appropriate COM port, verify and upload. When I try to upload I get a "avrdude.exe: stk500_getsync(): not in sync: resp=0x00" error. I've tried unplugging/resetting the board and reflashing the hex file. I can upload my program to a default Arduino Uno, and the device manager shows no differences.

The only difference I can see between the two is one has a 1311, and the other has a 1440 on it, which I assume are date codes. Any advice?

Windows will not recognise an Atmel328P, as it is a serial device, so I presume you have a USB to serial converter somewhere. What is it, and have you got a schematic/link to the board?

ChilliTronix: Windows will not recognise an Atmel328P, as it is a serial device, so I presume you have a USB to serial converter somewhere. What is it, and have you got a schematic/link to the board?

Op is cloning entire board:

It initially appeared under my Device Manager as Atmega16U DFU

I am using a USB A/B cable to connect to my board from my computer. The cable works fine for a factory built Arduino Uno, so I do not believe it is an issue with USB connection, especially when using FLIP, I was able to flash the Arduino Uno hex..

Ok… let me try this again…

The Atmega328P is not a USB device, so what USB device are you using? Have you got a link to it? What does it now appear as in device manager?

mrburnette: Op is cloning entire board:

So I presumed but I have no information on what USB to serial device he is using, and how things are connected up and that will be the problem.

I'm using the Mega16U2 chip.

OK,,,, so the chip is a micro controller.... what firmware is loaded on it?

I loaded the Arduino-usbserial-atmega16u2-Uno-Rev3.hex from C:\Program Files\Arduino\Arduino ERW 1.0.5\hardware\arduino\firmwares.

OK, and have you loaded the arduino drivers? The chip is not a standard USB controller and it does need them.

What have you got in device manager that is new when you plug it in?

The board then shows up as Arduino UNO R3 in my Device Manager. I open up the IDE, select the appropriate COM port, verify and upload. When I try to upload I get a "avrdude.exe: stk500_getsync(): not in sync: resp=0x00" error.

before you can "upload" to your atmega328, you have to install the bootloader in the m328 IN ADDITION TO the firmware in the 16u2. The 16u2 firmware allows that chip to do USB/Serial functions, but the bootloader in the m328 is what does the loading from Serial to the AVR flash. (and unlike the 16u2, the m328 does not have anything like the DFU "default bootloader.")

ChilliTronix: OK, and have you loaded the arduino drivers? The chip is not a standard USB controller and it does need them.

What have you got in device manager that is new when you plug it in?

The only thing I've successfully loaded into my chip is Arduino-COMBINED-dfu-usbserial-atmega16u2-Uno-Rev3.hex. I have used the devcon86.exe program (from the Arduino/Arduino ERW1.0.5/drivers directory) on my PC, with no change in results.

I don't have a new unit, but in Device Manager it initially was under Atmel USB Devices -> ATmega16U2 DFU. I'm currently able to reset it to Atmel USB Devices -> ATmega16U2.

westfw: before you can "upload" to your atmega328, you have to install the bootloader in the m328 IN ADDITION TO the firmware in the 16u2. The 16u2 firmware allows that chip to do USB/Serial functions, but the bootloader in the m328 is what does the loading from Serial to the AVR flash. (and unlike the 16u2, the m328 does not have anything like the DFU "default bootloader.")

Would I do the upload from FLIP, and if so what bootloader would I use? Right now, I'm looking in C:\Program Files\Arduino\Arduino ERW 1.0.5\hardware\arduino\bootloaders\atmega but none of the hexes with atmega 328 load in FLIP.

You need an AVR ISP programmer to put the bootloader on a m328. There are ways to turn an existing arduino into an ISP programmer, or even code that you can load on the 16u2 to do the programming (with additional hardware modifications.) See one of the many tutorials on programming a bootloader into a bare m328. (http://www.gammon.com.au/forum/?id=11637 ) Or you can buy a $5 dedicated programmer via eBay.

You want C:\Program Files\Arduino\Arduino ERW 1.0.5\hardware\arduino\bootloaders\optiboot\optiboot_atmega328.hex

I tried Gammon's tutorial, and was able to get up to the example sketch. When I tried to load the example sketch, I got the same "avrdude.exe: stk500_getsync(): not in sync: resp=0x00" error.

Can you post a picture of your wiring as to how you are trying to upload the bootloader to the Atmega328.

I’ve attached a picture of how I’m doing the wiring, as well as pictures of both sides of the board.

I realized that the back side was not included in my last post.

Hmm....

So you have two ICSP headers, one for the 16u2 and one for the Atmega328.

You appear to have loaded the firmware to the 16u2.

What bootloader have you loaded on the Atmega328?

What speed is the crystal?

I tried Gammon's tutorial, and was able to get up to the example sketch.

Can you go into more detail as to which steps you did, and which ones worked? Your wiring via the jumper cables looks like it might be OK, but I don't see anything that disables the auto-reset of the Uno, which I think is still important to do. (?) How are you connecting when you are getting the sample sketch upload failure? Through the 16u2 USB to the new chip? Have you done a "loopback test" on your custom board?