Pages: 1 [2] 3 4   Go Down
Author Topic: avrdude: not in sync again  (Read 18098 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 6
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I only skimmed through this thread because I'm looking for something else entirely...

   When I first got my Duemilanove it worked flawlessly for about 3 hours of messing around writing and loading sketches to get a feel for it. As soon as I started messing with Serial.print() it stopped accepting sketches with the sync error.

  I found that when I load a sketch now I have to watch the Arduino. As soon as the TX/RX leds blink when the sketch is trying to transfer I have to hit the reset button. It then takes the sketch every time.

Hope this helps, or is at least on topic...

:Patrick
http://RedBinary.com
http://Odometron.com
Logged

SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 137
Posts: 6788
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
avrdude: stk500_getsync(): not in sync: resp=0x30
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51
FWIW, I did some experiments.  This is exactly the error I get if I set my arduino environment to use a serial port exists, but that echos output to input rather than being an actual arduino.  (For my tests, I used the ftdi cable and put a jumper between the rx and tx pins.)

If you set upload.verbose=true (the default is false), you'll get very detailed debugging in the console window.  (but alas, not very UNDERSTANDABLE info.  Sigh.)  Here's the output from the loopedback serial port:
Code:
hardware/tools/avr/bin/avrdude -Chardware/tools/avr/etc/avrdude.conf -v -v -v -v -pm168
       -cstk500v1 -P/dev/tty.usbserial-FTD61T6Q -b19200 -D
       -Uflash:w:/Users/billw/Documents/Arduino/demo16x24/applet/demo16x24.hex:i


avrdude: Version 5.4-arduino, compiled on Oct  9 2007 at 11:20:31
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/

         System wide configuration file is "hardware/tools/avr/etc/avrdude.conf"
         User configuration file is "/Users/billw/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port            : /dev/tty.usbserial-FTD61T6Q
         Using Programmer      : stk500v1
         Overriding Baud Rate  : 19200
avrdude: Send: 0 [30]   [20]
avrdude: Send: 0 [30]   [20]
avrdude: Send: 0 [30]   [20]
avrdude: Recv: 0 [30]
avrdude: stk500_getsync(): not in sync: resp=0x30
avrdude: Send: Q [51]   [20]
avrdude: Recv: Q [51]
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51

avrdude done.  Thank you.

And here's the beginning of a successful download:
Code:
hardware/tools/avr/bin/avrdude -Chardware/tools/avr/etc/avrdude.conf -v -v -v -v
      -pm168 -cstk500v1 -P/dev/tty.usbserial-FTD61T6Q -b19200 -D
      -Uflash:w:/Users/billw/Documents/Arduino/demo16x24/applet/demo16x24.hex:i


avrdude: Version 5.4-arduino, compiled on Oct  9 2007 at 11:20:31
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/

         System wide configuration file is "hardware/tools/avr/etc/avrdude.conf"
         User configuration file is "/Users/billw/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port            : /dev/tty.usbserial-FTD61T6Q
         Using Programmer      : stk500v1
         Overriding Baud Rate  : 19200
avrdude: Send: 0 [30]   [20]
avrdude: Send: 0 [30]   [20]
avrdude: Send: 0 [30]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]
         AVR Part              : ATMEGA168
         Chip Erase delay      : 9000 us
         PAGEL                 : PD7
         BS2                   : PC2
         RESET disposition     : dedicated
         RETRY pulse           : SCK
         serial program mode   : yes
         parallel program mode : yes
         Timeout               : 200
         StabDelay             : 100
         CmdexeDelay           : 25
         SyncLoops             : 32
         ByteDelay             : 0
         PollIndex             : 3
         PollValue             : 0x53
         Memory Detail         :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65     5     4    0 no        512    4      0  3600  3600 0xff 0xff
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           flash         65     6   128    0 yes     16384  128    128  4500  4500 0xff 0xff
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : STK500
         Description     : Atmel STK500 Version 1.x firmware
avrdude: Send: A [41] . [80]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [02]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [81]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [01]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [82]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [98]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [03]
avrdude: Recv: . [10]
         Hardware Version: 2
         Firmware Version: 1.16
avrdude: Send: A [41] . [84]   [20]
avrdude: Recv: . [14]
Logged

Germany
Offline Offline
Newbie
*
Karma: 0
Posts: 22
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@Red Binary:
I tried your suggestion but get the same error anyway. However, I did find that only the RX led is blinking when the sketch should be uploaded. Is this the same for you or should both be lighted? I get the feeling there's no response from the chip back at all as if there just isn't any bootloader on it, only the default sketch (that's blinking the L led).

I also found this thread in the forums:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1183647052/0

May it be the ones who produced my board made the same fault and just didn't lock the bootloader before uploading the test sketch? I don't know where they're produced, but it came in a green sealed antistatic plastic bag.

I decided to order an STK500 to have more flexibility in future but it will need some days until i get it smiley-razz

There's also a tutorial how to burn a bootloader onto the Atmega168 with a selfmade parallel programmer but I didn't have the time to try it yet, so propably that's my next station.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 6
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I tried just now to make sure by trying to upload the blink example sketch.

The sketch that was on it during the first try was streaming serial data, so the TX LED was flickering for that and got:

Code:
avrdude: stk500_getsync(): not in sync: resp=0x57
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0xd7

So, again I uploaded blink (so that there would be no serial comms in the sketch itsself) by waiting for the RX LED to indicate that the comms are being attempted and immediately pressing reset.

Then I try to upload again without pressing reset. The RX LED blinks 3 times - 3 retries, I assume. A 10 sec or so delay, then a single blink. Another long delay and the IDE gives the fault:

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

When a successful transfer occurs both RX & TX go nuts...   Not sure that our issues are identical. I am working on the assumption that my issue is that somehow the bootloader is not going into reset when the comms occur. Since I have the work-around band-aid I haven't pursued it any further.

Do you want me to try in verbose mode and post the successful & failed results?

Did you get the successful transfer results that you posted on a different Arduino?

:Patrick
http://RedBinary.com
http://Odometron.com
Logged

Germany
Offline Offline
Newbie
*
Karma: 0
Posts: 22
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ok, I just tested with verbose on and get:

for the loopback:
Code:
Binary sketch size: 1116 bytes (of a 14336 byte maximum)

D:\arduino-0012\hardware/tools/avr/bin/avrdude -CD:\arduino-0012\hardware/tools/avr/etc/avrdude.conf -v -v -v -v -pm168 -cstk500v1 -P\\.\COM6 -b19200 -D -Uflash:w:C:\Dokumente und Einstellungen\Kc.Work\Eigene Dateien\Arduino\sketch_090127a\applet\sketch_090127a.hex:i



avrdude: Version 5.4-arduino, compiled on Oct 11 2007 at 19:12:32
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/

         System wide configuration file is "D:\arduino-0012\hardware/tools/avr/etc/avrdude.conf"

         Using Port            : \\.\COM6
         Using Programmer      : stk500v1
         Overriding Baud Rate  : 19200
avrdude: ser_open(): setting dtr
avrdude: Send: 0 [30]   [20]
avrdude: Send: 0 [30]   [20]
avrdude: Send: 0 [30]   [20]
avrdude: Recv:
avrdude: stk500_getsync(): not in sync: resp=0x30
avrdude: Send: Q [51]   [20]
avrdude: Recv:
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51

avrdude done.  Thank you.

for the board with atmega168 on it:
Code:
Binary sketch size: 1116 bytes (of a 14336 byte maximum)

D:\arduino-0012\hardware/tools/avr/bin/avrdude -CD:\arduino-0012\hardware/tools/avr/etc/avrdude.conf -v -v -v -v -pm168 -cstk500v1 -P\\.\COM6 -b19200 -D -Uflash:w:C:\Dokumente und Einstellungen\Kc.Work\Eigene Dateien\Arduino\sketch_090127a\applet\sketch_090127a.hex:i



avrdude: Version 5.4-arduino, compiled on Oct 11 2007 at 19:12:32
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/

         System wide configuration file is "D:\arduino-0012\hardware/tools/avr/etc/avrdude.conf"

         Using Port            : \\.\COM6
         Using Programmer      : stk500v1
         Overriding Baud Rate  : 19200
avrdude: ser_open(): setting dtr
avrdude: Send: 0 [30]   [20]
avrdude: Send: 0 [30]   [20]
avrdude: Send: 0 [30]   [20]
avrdude: Recv:
avrdude: stk500_getsync(): not in sync: resp=0x00
avrdude: Send: Q [51]   [20]
avrdude: Recv:
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51

avrdude done.  Thank you.

if i take the atmega of the board and don't do a loopback, the output is the same as with atmega.

the only difference between the output for the loopback/chip seems to be the error code of the first avrdude error: resp=0x00 for the atmega, resp=0x30 for the chip.


@Red Binary:
i got no successful transfer yet. this also is my first arduino smiley-razz


[update]
I managed to write a new bootloader and some sketches onto the chip using this tutorial:
http://www.geocities.jp/arduino_diecimila/bootloader/index_en.html

however, i tried three different bootloaders:
- the original diecimila bootloader that was in the arduino package
- an atmega168 bootloader that is mentioned in this tutorial http://wolfpaulus.com/journal/embedded/arduino2.html
- the adaboot bootloader http://www.wulfden.org/TheShoppe/freeduino/ADABOOT.shtml

and none of them could solve the problem, same avrdude: not in sync error. anyway, i'm glad i can try some sketches now smiley-grin any suggestions how to go on debugging the problem further?
« Last Edit: February 01, 2009, 05:05:48 pm by KidCrazy » Logged

SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 137
Posts: 6788
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

In another thread, it was starting to look like a mis-configured FTDI chip might be to blame for some of these problems.  You might want to try the instructions here:  http://www.arduino.cc/playground/Main/FTDI
"(Re)programming the default settings into the FTDI FT232RL chip"
Logged

Germany
Offline Offline
Newbie
*
Karma: 0
Posts: 22
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@westfw: you propably meant this thread i think?
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1233502260/4

i programmed the ftdi chip with the setting file from the tutorial you mentioned but this seemingly didn't help. same error as before. however, i saved the settings that were on the chip before and compared to the one in the tutorial. there are definitely some differences, but i'm not so far i could say if something could be wrong here.

perhaps someone with a running duemilanove could compare my ftdi setting files with his own? here it is:
duemilanove_kidcrazy_default.ept
Logged

Germany
Offline Offline
Newbie
*
Karma: 0
Posts: 22
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

*sigh* okay, i just managed to lock myself completely out of the arduino when i did some experiments with sending serial data from the board to my computer.

i wrote this small sketch, compiled it in the arduino ide and uploaded it with the same method i wrote the bootloaders on the chip.

Code:
#define LED 13

byte i;

void setup(){
  pinMode(LED, OUTPUT);
  
  Serial.begin(9600);
}

void loop(){
  // led on while sending
  digitalWrite(LED, HIGH);

  for(i=0;i<10;i++){
    Serial.println("!!!!!!!!!!!!!!!!!!!!!!");
    delay(100);
  }  
  
  // led off afterwards
  digitalWrite(LED,LOW);
  delay(6000);
}

but now the door i had for flashing the chip is also shut:
avrdude: ft0 open failed


even though the board is now sending something, i don't get the expected output in the arduino serial monitor ( output dump here).

output should be
22 !s
hex: 0x21
binary: 00100001

but i get some completely different output which consists mostly of the sequence
hex: 06 0C 06 3F
binary: 110000011000000011000111111
(pay attention to the almost doubling of each bit compared to the expected output)

and sometimes this sequence loses the one or other character (you can see this in the output dump i mentioned above).

second: expected duration of the led burning should be 1 sec on and 6 seconds of for one loop. but a whole loop appearently is about 14 seconds long and the led burns for 2 seconds.

could it be there is something wrong with the configuration so the chip is using it's internal 4 Mhz clock instead of the external 8MHz one?

at least i think this could explain the double delay time, the doubled bits in communication and the sometimes lost characters (because of the internal clocks inaccuracy) and such the communication problems i got.

however, since i don't have any possibility to access the atmega now, i will have to wait for the stk500 i ordered until i can verify this. perhaps one of you knows if i could be right with this or if this just isn't possible because of the one or other reason.

Kc
Logged

Cincinnati
Offline Offline
Newbie
*
Karma: 0
Posts: 14
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey, I read your first post, read farther and then got lost towards the end. I'm absolutely new to this stuff also, but have an duemilanove and had the same errors w/my windows xp, sp3. It took me a few hours to figure it out but the simplest fix was to get to the port window, actually plug in the usb and watch what port it identified. Then I right clicked it, deleted it, unplugged it. Then I plugged it in again and the "new hardware" recognized it as new again and I reinstalled the environment.
Then it worked fine. It was as if the first time I either didn't install the new hardware correctly or it didn't recognize it the first time.
I am new at this and know how difficult it is to get started myself.
I hope this helps.
james040
Logged

Germany
Offline Offline
Newbie
*
Karma: 0
Posts: 22
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hey there smiley

haven't been here for some time. this was first because i got a real bad flu and second because my sweet little daughter was born on valentines day smiley-grin cheerioh.

okay, back to topic. i now got the stk500 and am able to reprogramm my chip whatever deep shit will occur during my experiments *hehe*.

however, i saw sameone posting that the new update of the bootloader should eliminate all those "avrdude: not in sync" errors. i tested and burnt it on the chip using the stk500, still same problem. i even exchanged the chip by another atmega168. so i come to conclusion it's neither a problem with the chip nor with the bootloader and i have to search on the duemilanove board itself...

as i stated in some post above, i have a guess there might be a problem with the clock. does anyone know what the atmega would do if it was programmed to use an external clock but the crystal just wouldn't be working?

i'm going to do some more testing soon...

bye,
  Kc
Logged

SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 137
Posts: 6788
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So kidCrazy: are you able to get the normal serial download to work AT ALL, say after you've downloaded a new bootloader with the STK500?  Or are you only able to burn programs with the STK500?

Congrats on your new daughter!
Logged

Germany
Offline Offline
Newbie
*
Karma: 0
Posts: 22
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@westfw: thanks. she's already keeping me busy half of the night smiley-grin

no, the normal serial download isn't working at all. i was only able to download sketches/bootloaders to the chip by stk500 or by ftdi bitbang mode using this tutorial so far
« Last Edit: February 18, 2009, 05:24:02 am by KidCrazy » Logged

Germany
Offline Offline
Newbie
*
Karma: 0
Posts: 22
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

yay! success at last!! smiley-grin

i noticed that there was something wrong with the timing or clock settings (sketches i uploaded by bitbang mode or by stk500 just took double the time that they should take, so a delay(500) would stop action for a whole second instead of a half). i was just around to check the fuse settings for clock selection when i accidently dropped by the directory for atmega168 bootloaders (arduino-0013\hardware\bootloaders\atmega168) and found file "ATmegaBOOT_168_pro_8MHz.hex" which i then uploaded for test and... IT WORKS. i can upload sketches through arduino ide now.

i can't exactly reconstruct what was on the chip when i got it delivered, but apparently it was the wrong bootloader. so if you also got this "avrdude: not in sync again" problem and the usual solutions (reinstall serial port driver, select correct com port) don't work, you might try to reburn the bootloader (e.g. with ftdi bitbang method). but pay attention that you burn THE RIGHT ONE: for arduino duemilanove with atmega168 apparently it's "ATmegaBOOT_168_pro_8MHz.hex" and not "ATmegaBOOT_168_diecimila.hex" which i took for all my tries smiley-razz
[edit: just noticed my "duemilanove" has got a 8MHz oscillator instead of a 16MHz which caused the problems. so don't do this if you don't have one with 8MHz oscillator yourself]

hope this will help anybody to get to success a little faster than me.


[update]
okay, only partly success. i can upload now, but the timing still seems to be incorrect. delay(1000) pauses for 2 seconds. also serial communication doesn't return the expected values. the ascii table example sketch does return the correct table if i set the serial monitors speed to 4800 baud instead of 9600. what could be the problem here?

[update 2]
okay, found it. wrong settings for the selected board. in file "arduino-0013\hardware\boards.txt" changed line

diecimila.build.f_cpu=16000000L

to

diecimila.build.f_cpu=8000000L

now it's working as expected. don't know why noone else seemed to have problems here? is the duemilanove normally shipped with 16MHz oscillator? mine has a 8MHz. could it be my vendor just cheated me?
however, i'm happy i can now go on with some "real" work smiley

« Last Edit: February 18, 2009, 08:30:59 pm by KidCrazy » Logged

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 375
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, it should be 16MHz.  Where did you get your board?
Logged

SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 137
Posts: 6788
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Did you get around to checking the fuses?  I believe it's possible to mis-program the fuses to use the internal oscillator (~8MHz) instead of the external crystal (which SHOULD be 16MHz - can you read the numbers on the crystal?)
Logged

Pages: 1 [2] 3 4   Go Up
Jump to: