Go Down

Topic: avrdude: not in sync again (Read 19340 times) previous topic - next topic

KidCrazy

Hi there from a very newb on arduino or microcontrollers in general :)

Today I got my first Arduino, a Duemilanove, and tried it directly when I came back from work. I used the exact procedure as written in the "Getting started with Arduino" book by Massimo Banzi:

1. downloaded "arduino-0012-win.zip" from arduino.cc
2. extracted it
3. plugged the Arduino with to my laptop by USB
4. installed the drivers from "drivers\FTDI USB Drivers" directory (both low level driver and serial to USB converter)
5. put a LED into GND + PIN13 with short lead to GND
6. started Arduino IDE and tried to upload the blink sketch

Now here is where the problem is: The sketch is compiled but Arduino returns with Error:

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


By googling I found that this probably means the connection between my PC and Arduino is not working properly.

What the Arduino does:
- Power LED is burning bright green :)
- The L LED and LED on PIN13 blink with a period of about 2.5 seconds (apparently this means the bootloader is on the chip)
- When pressing the reset button, the L and 13LED are only dark as long as the button is pressed but instantly go on blinking with first flash exactly when I release the button (shouldn't there be a delay of 2 seconds first?)
- If I unplug the USB cable (no power) and plug it in again, TX and RX LEDs do blink some times rapidly, then the L and 13 LEDs blink rapidly and finally go back to blinking once in 2.5 seconds
- If i try to upload a sketch, the L+13 LEDs do blink some times (2 or 3), then the RX LED does also blink about 3 times and then L+13 LEDs go on blinking as before (2.5 secs period)


So now I'd like to know if this is all normal for the Arduino (except the errors showing from avrdude) i.e. if I should search the error in my own PC/connection cable or if there's something wrong with the Arduino or the bootloader.

My system:
- I got a Lenovo X60 Tablet PC
- Windows XP with all current updates
- One real serial port (COM1) and two bluetooth stacks installed (COM4+COM5), USB Serial Port is on COM6 and selected in Arduino IDE
- Arduino Diecimila selected as Board in the IDE
- Arduino 0012 Alpha running

Hope there's any help possible. I'd not like to send it back and wait for another week or two until I can try it :P :D

Thanks in advance for any suggestions,
 Kc

KidCrazy

There's really nobody who can say anything to this? o_O

ptool64ar

Quote
Posted by: KidCrazy Posted on: Today at 18:04:51
There's really nobody who can say anything to   this? o_O


The Kid seems to be right about this.  
Having had the same problem, I looked through the internet for a solution, and really didn't find one.

I found that there were, and are, several people with same problem, and nobody on the boards I looked through could do much to help.  They all give out the same suggestions, all of which you have probably already done.  Arduino troubleshooting page isn't much help.

You could try googleing: avrdude: stk500_getsync(): not in sync: resp=0x00  or
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51


I sidestepped the problem by programming the atmega chip with a parallel programmer, as I explained in this post:

Quote
ptool64ar
YaBB Newbies

Reply #14 - 26.01.2009 at 05:43:12 | Remove  

I got it working by using parallel programming.  At least I'll be able to use Arduino that way, which ain't so bad.
I used the "Parallel Port Programmer" described by Arduino; here: http://www.arduino.cc/en/Hacking/ParallelProgrammer
AND, Burning sketches to the Arduino board with an external programmer,  FIND THAT HERE: http://arduino.cc/en/Hacking/Programmer  
This is done without a bootloader, so it says in that information page.

I'm sitting here looking at that blinking light, finally
I even modified, slightly, the blink program from a one second blink to a two second blink.  But , since the LED in the sketch uses the same port as the SCK port on the ATMEGA168, (one of the ports used by the parallel programmer) you will need to remove that LED before programming.  You can put it back in after the program is uploaded, and it blinks   .  

You will need to make a couple of mods in  Preferences.txt file in C:\Documents and Settings\Owner\Application Data\Arduino , which is the (per-user local version of the pref. file) as the instructions state.(where it says: upload.using=bootloader, replace the word bootloader with the word parallel)

Here's something else, if you should use that homemade arduino programmer, - that pref. file doesn't include this statement: set the parallel port defaults (used if upload.programmer=dapa). That statement is in one of the main pref., default , files.  I copied it from the main pref. file, found in The "arduino-0012/lib", then inserted it in the smaller (per-user local version of the pref. file) I inserted that statement without the # in front of it.


Arduino doesn't say much about those preference files, and its difficult to find the (per-user local version of the pref. file), which should be found as "preferences.txt" in C:\Documents and Settings\Owner\Application Data\Arduino  I have to use my PC's "Search" procedure to find that file, and had to tell it to search in "hidden files" on top of it all.

That's the best I could do.  However you might find a mistake in your settup.  One that I can think of is the pin-13 enigma.  There are two pin-13's on arduino.  One is the actual pin-13 of the Atmega168 chip, the other is the "arduino pin 13", which is one of the header pins on the arduino board and is actually connected to pin-19 of the Atmega168, just to add a little confusion to an already confusing situation.  (the arduino pins are NOT numbered the same as the microcontroller pins)

potool64ar

westfw

Did you check out http://arduino.cc/en/Guide/Troubleshooting ?
With two bluetooth serial ports, I'm sort of suspecting that you have some sort of background "thing" that is interfering with the Arduino IDE access to the USB serial port, but since I don't have a PC with bluetooth, I'm not sure exactly what would be suspect...

KidCrazy

thanks for your posts :)

@ptool64ar:
that's a good idea. i think i'll be going to build a parallel programmer in the next days and first try to rewrite the bootloader so i can see if that's where the problem is. if it is not, at least using the programmer to write new sketches onto the chip would be more satisfying than not being able to persuade the board to do anything other than blink a led :P

@westf:
yes, i read the troubleshooting guide several times, but there seems no help from this. interference between the bluetooth ports may be possible but i already tried deactivating both and it shows no difference. what i find strange is, that there obviously IS some data going through to the arduino. the board reacts with flickering the L and RX leds but then goes back to normal blinking before the upload seems to be done.
but it also does this when i just send some arbitrary data over the port through the serial monitor. so it seems to me like the transfered data just isn't in a valid format or as if the arduino just doesn't respond to any command sent there. unfortunately, i got no idea how to check what really is going through the cable so i could do some more investigation on this. how do you actually debug such things?

westfw

It wouldn't be the bluetooth ports themselves that would cause interference; it'd be whatever app is monitoring those ports for whatever device is expected to show up, like a palmtop hotsync thing.

If your harware-aware, you can try removing the AVR from the socket, putting a jumper in between digital pin 0 and 1 (rx/tx) on the digital headers, and talking to the board with the "serial monitor" function of the arduino IDE.  This creates what is know in the comm industry as a "digital loopback" scenario; anything you type in the serial monitor should echo back, with associated blinking of the rx/tx LEDs.  If you see no or partial echoing of your typeing even though both LEDs are blinking, then something is eating characters that should be going to the arduino...

KidCrazy

Hi again,

there's news from the frontier :)

Today, first thing i tried was your suggestion, westfw. I removed the atmega from its socket, shorted digital pins 0 and 1 and sent something through the serial monitor. came back exact like i sent it so i think the data transfer from my pc should be allright, correct?

I also sat down and built a parallel programmer cable. I measured the electrical resistance of each line and double checked the wiring so it should be ok I think. I installed giveio (i had some problems with the installation at first, but it is shown in "device manager" -> "non-pnp devices" now) and applied the registry patch.

However, when I go into Arduino IDE and choose "Tools" -> "Burn bootloader" -> "w/ Parallel Programmer" I get this error:

avrdude: AVR device not responding
avrdude: initialization failed, rc=-1
avrdude: Yikes!  Invalid device signature.
avrdude: Expected signature for ATMEGA168 is 1E 94 06
avrdude: AVR device not responding
***failed;  
avrdude: verification error, first mismatch at byte 0x0000
        0x3f != 0x00
avrdude: verification error; content mismatch

:P

westfw

I dunno.  That's one of the problems with homebrew hardware; there are SO many things that might be wrong.  Even if your parallel programmer build is perfect, and windows isn't doing anything strange to it, you could STILL have a DoA ATmega chip that is causing you all your grief...

KidCrazy

hmmm... is there any way i can check if the atmega is working at all?

retrolefty

"hmmm... is there any way i can check if the atmega is working at all? "

Yes, substitute it with a new one. They are cheap and it's not like a spare atmega isn't a useful thing to have around.

Lefty

ptool64ar

Are you having any luck with your arduino?

I don't think there is any help for this problem.  Nobody seems to know what causes it, nor does anybody know what those error codes mean.

If you look through the internet by googleing :avrdude: stk500_get sync(): not in sync: resp+0x00  and/or avrdude: stk500_disable():protocol error, expect=0x14, resp=0x51 you will find that many people had or have this problem and they have posted them on several forums.  They all get the same replies that don't help.  The questions and answers just go round and round.

It seems to be a problem that is common to arduino.  And by reading the internet posts, it can be seen that it has been a problem for two or  three years.  Yet no solution, and nobody seems to know what to do or what its all about.  Its not even mentioned in the arduino troubleshooting page.  Some people have gotten lucky and stumbled on a fix, but can't explain what they did.

So far I've programmed a Parallax Basic Stamp very easily with Pbasic on a PIC microC.   An Atmega32 using Bascom-AVR, which goes quite smoothly and Atmega168/8 using WinAVR, which was somewhat difficult at first.  They all have their problems, but none of them presented an almost unfixable problem as this one that arduino poses.

I thought that I had it made when I was able to program my arduino by using parallel programming.  It worked on one or two simple sketches, but then gave me lots of problems on a more complicated sketch, which was one that I really wanted to use.  The problems grew worse and worse so I replaced the atmega168 with a new one and was able to burn a new bootloader on it.  

Great, I thought to myself, now things will work.  So time to upload good old Blink and :avrdude: stk500_get sync(): not in sync: resp+0x00 .  Yup, I says to myself, time to give up on this.

Its probably my computer, but I didn't get into this to become a computer expert.  I just wanted to get microcontrollers working so that I could use them for small projects.  Looks like I'll have to work with Bascom or WinAVR.  (The full Bascom-AVR program = $100, I use the free (quite)limited version. WinAVR is quite complicated and has few examples)

Sorry for the long story :'(
Patrick


Digger450

Sorry to hear you are giving up Patrick.  This particular error is often mentioned and often solved when the user realizes they have to select the correct com port.  I know that you've said this is not the problem in your case.  I don't think it's fair to be upset with the Arduino folks when you yourself even admit that it is most likely a problem with your hardware.  It's very hard to diagnose problems of this nature over the internet as you may not tell us something you don't think is important but in reality is the cause of your problems.  I mean, it could be something as silly as a bad cable or a null modem cable.  Or it could be other software on your computer interfering with the comport.  It could also be a simple wiring mistake or power supply issue.

Good luck.

KidCrazy

#12
Jan 30, 2009, 08:48 pm Last Edit: Jan 30, 2009, 08:49 pm by KidCrazy Reason: 1
okay, i wanted to give it another try and went for a new atmega168. unfortunately i could only get my hands on an atmega8-16. i read they are pin-compatible. does that mean i can just exchange the current chip by the new one on the board and "should" be able to programm it?

LaughingLemon

I've had the same problem. I managed to fix it by re-installing the driver. I noticed in the device manager (I'm running Windows Vista) that although the device was listed under USB Controllers, it was also listed under "Unknown Devices" as not installed correctly. I uninstalled this and the one under USB Controllers and re-installed it (just unplugged the device and plugged it in again). When the drivers were installed correctly, there was an entry under USB Controllers as before and another catagory, Ports (COM & LPT), with an entry USB Serial Post (COM8). Then using COM8 in the IDE, the sketch uploaded okay.

wiz

Just to back up what every one else is saying. Every time I have had this problem on Windows it is because I have been trying to use the wrong com port.

While programming, the Arduino leds flash and everything appears to be working ok but the error appears afterwards.

I seem to remember a similar dos problem years ago with com1 & com3 having a lot in common as well as com2 & com4


Go Up