Problem uploading sketch to Breadboard, getting er

Hi all,

I've been lurking around for a bit and have finally taken the plunge and built a breadboard version with the ATMEGA 328p. It has the Arduino bootloader on it.

Once it is turned on, the led I attached to pin 13 blinks. Hooray ! I have wired up a FTDI Basic Breakout board to program a sketch and once I press the upload button, the following happens:

-The Sketch is successfully compiled.
-The TX & RX on the Breakout board flash a few times.
-The following error is displayed:

Binary sketch size: 1010 bytes (of a 30720 byte maximum)
avrdude: stk500_getsync(): can't communicate with device: resp=0x90
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x94

I am using Com4 set at 9600,8,N,1,N

All looks like it is wired properly, I am selecting the right board (selecting the 328 chip) but still the error.

One thing that may affect this is that instead of using a 16 MHz crystal, I am using a 16.670 MHz crystal.

Any help would be greatly appreciated.

Thanks !

AMOTY

Hi, I did mine using a MAX232 IC to the ATMega 328 on a breadboard..

Here are some items to check/troubleshoot :-

  1. Make sure the Rx/Tx pins are correct... Pin 2 (RX) & 3 (TX) on the chip

  2. DTR connected to Pin 1 for "auto reset" with a 0.1uF capacitors ( not sure why... )

  3. Speed should be 57600 for uploading..

If DTR is not connected, try to press the reset button a few sec after pressing the Upload button...

Not so sure about the crystal tho..

Hope this helps..

DTR connected to Pin 1 for "auto reset" with a 0.1uF capacitors ( not sure why... )

The boot loader only looks to see if there is a program to down load for a few seconds after reset. Unless you auto reset the board you have to hold down the manual reset, click upload, wait for the size message to appear, wait two more seconds and then release the reset.

Speed should be 57600 for uploading.

The upload speed is set automatically there is no need to do anything.

I am using a 16.670 MHz crystal.

Yes that is about 5% out, it is enough to make it not work.

Stanley - The RX/TX are correct, I added the 0. uF capacitor between Pin 1 and DTR, Speed is now 57600. Sadly, no change, but I like the idea for the Auto-Reset. Will keep that one !

Grumpy_Mike - I thought that the crystal might be problematic. Looks like I will have to get a 16MHz crystal.... or as close as possible to try this out. Will have to pick one up tonight. I guess I can reuse the 16.670 MHz in a project that does not need timings or to be re-programmed.

Thanks to both of you for replying.... very helpful in all regards.

I'll post back to let everyone know what ended up happening.

/me

Following Grumpy_Mike's argument, you expect 0x14=00010100B, you receive 0x94=10010100B. Including a starting and an ending bit, each byte requires 10 bits. The start and the end bits are both 1. If you're 4% faster, your ending bit is interfering with your last bit (MSB):

Does this make sense?

Yes and this assumes that the PC end is spot on, this has a tolerance too and if you take that into account it halves the margin of error you can allow for your arduino.

AMOTY is using an FTDI chip so the PC side only deals with USB. The problem only occurs between FTDI and Arduino.

I have just connected my Freduino to a desktop PC running Windows XP , the USB driver loaded correctly and all look well untill I tried to upload a sketch when it failed with a similar error to AMOTY

avrdude: stk500_getsync(): not in sync: resp=0x00
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x951

The board works fine when connected to my laptop also running Windows XP and it uploads sketches with no problem, any suggestions :o

Further to my last, I have solved my issue and this might help others. The only difference bewteen my laptop where everything worked and the desktop where the upload failed was the desktop had a newer version of Arduino.exe. So I looked around the settings a bit and sure enough the new software defaults to teh bard with the ATmega 328 chipset whilst mine has the ATmega 168. Once I changed this setting all was well.

The setting is under Tools>Board ;D

Well, I tried a 16.257 MHz crystal (all I could find locally) and no luck !

Actually, some luck but then strangeness. I was able to upload... once. After that I started getting the following error:

Binary sketch size: 1010 bytes (of a 30720 byte maximum)
avrdude: stk500_getsync(): not in sync: resp=0x00
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51

Soo much frustration now. I suppose I will have to bite the bullet and order a few 16MHz crystals and wait the days it will take to get here.

Anyone have any other hints ?

AMOTY :cry:

SUCCESS !!!

Ok, I finally figured out what was going wrong.

I need a 16MHz crystal (although the 16.25 MHz works fine).

Second, I get the error because the bootloader is already loaded. Sooooo... what I have to do is:

Once the 'Binary Sketch Size' message pops up, I hit the reset button quickly and away it goes !

Success every time !!!

Hope this helps someone else, and thanks to all who helped me.

:wink: /me

Once the 'Binary Sketch Size' message pops up, I hit the reset button quickly and away it goes !

I hold down the reset and click upload. Then when the message apperes
I count / say to myself "one and two" after the message before releasing the button.
I find that if you hit it too quickly after the message then it won't work.

I hold down the reset and click upload. Then when the message apperes
I count / say to myself "one and two" after the message before releasing the button.
I find that if you hit it too quickly after the message then it won't work.

True, that is why I did as Stanley suggested and place a 0.1 uf capacitor between pin 1 (reset) and the DTR pin of the programmer.

Always successful !!!

:smiley: