avrdude: stk500_getsync(): not in sync: resp=0x00 - A SOLUTION - Page 1
Forum section: electronics / general

author: Electro Fan
author_rank: Super Contributor
timestamp: September 12, 2015, 04:31:19 am
content: I was working with an Arduino Uno and got this error:avrdude: stk500_getsync(): not in sync: resp=0x00After searching Google and YouTube I found various discussions of the problem and several suggested fixes. None of the fixes I found worked for my version of this problem.I'm not sure if the fix I found is practical (cost-effective and also timely enough given the lead time to order a programmer) for other users with this error message but the fix described below worked for my situation and I have a hunch it will work consistently for other situations since it effectively copies the code from one chip (via a PC) to another, as follows:In my case, I happened to already have a TL866CS (which is the subject of much discussion in a long thread in the EEVBlog Specific Forum). I simply took a working Atmega328P out it's socket, plugged it into the TL866CS and read the Atmega code into the MiniPro PC software (which comes with the TL866CS) and then swapped out the good Atmega 328P with the Atemga 328P that had been giving me the error message. With the erroring Atmega 328P sitting in the TLC866CS programmer I hit the Write ("Programming chip") icon in the MiniPro software program and the code from the good Atmega 328P (still resident in the MiniPro software on my PC) wrote to the chip that had been erroring. I moved the previously erroring Atmega 328P back into the Arduino socket and now the Arduino IDE was happy - no more "avrdude: stk500_getsync(): not in sync: resp=0x00"The TL866CS fixed the Arduino problem. Here is where I purchased the TL866CS:http://www.ebay.com/itm/USB-MiniPro-TL866CS-Universal-BIOS-Programmer-EEPROM-FLASH-8051-AVR-GAL-PIC-SPI-/221092473435?hash=item337a236a5b(the seller offers other packages with various adapters, in case you need those)PS, it is of course easy to upload a sketch from the Arduino IDE to an Arduino board. I could be wrong (someone will correct me on this, I'm sure) but it doesn't seem so easy to move the sketch from an Arduino board to the IDE (on the PC); if it was easy this would negate the need for a programmer such as the TL866CS to address difficult errors as the IDE could serve as the intermediary needed to transfer code from a good chip to a bad chip. Feel free to let me know if there is an easy way to move a full sketch with all the bits necessary to clone a chip using just the IDE. Even if this is possible the TL866CS is still a handy tool but if cloning a chip isn't so straight forward with the IDE then the TL866CS might be a very good tool for some Arduino users.

author: amyk
author_rank: Super Contributor
timestamp: September 12, 2015, 12:59:38 pm
content: Now that you've graduated to a real programmer, you don't have to be bound by the Arduino platform. You can write code for the MCU directly.

author: ralphd
author_rank: Frequent Contributor
timestamp: September 12, 2015, 06:34:16 pm
content: I would never recommend anyone spend > $40 for an AVR programmer.Buy as USBasp for 162c:http://www.aliexpress.com/item/1LOT-New-USBASP-USBISP-AVR-Programmer-USB-ISP-USB-ASP-ATMEGA8-ATMEGA128-Support-Win7-64K/32319529474.html?ws_ab_test=201407_3,201444_6,201409_5

author: retrolefty
author_rank: Super Contributor
timestamp: September 12, 2015, 07:45:32 pm
content: QuoteNo, not possible within the Arduino IDE.What I have used to 'clone' AVR chips is a free GUI front-end for AVRDUDE. It allows one to read code, EEPROM, fuses, lock byte, etc and then transfer/write it to another chip. It has a menu to select many programmer types and AVR chip types. Here is a newer one from Adafruit that I plan on checking out.https://blog.adafruit.com/2013/02/19/avrdudess-a-gui-for-avrdude/

author: donotdespisethesnake
author_rank: Super Contributor
timestamp: September 13, 2015, 09:58:36 am
content: Cloning a working Arduino will clone the bootloader, so I guess the bootloader got corrupted in your non-working Arduino.Of course, you can just use an Arduino as an ICSP programmer for another Arduino. There is a page somewhere describing how to use it to download a bootloader.Real programmers use emacs.https://xkcd.com/378/

author: Psi
author_rank: Super Contributor
timestamp: September 13, 2015, 11:03:40 am
content: Quote from: ralphd on September 12, 2015, 06:34:16 pmi've had too many atmega's get bricked by corrupt fuse bits with USBasp programmers to ever use one again.It seemed to get confused or out of sync in the middle of writing flash sometimes, when it goes to check the fuse bits are the same pre/post flash (safety check) it reads garbage and then try's to fix it but is in fact corrupting fuse memory. And not in a fixable way. Ive had some Atmegs get into RC osc clock speeds that should not be possible. Probably due to undocumented fuse bits being set/cleared.Didnt happen all that often, but far to often for my liking.Never had the problem with other programmers, not even once

author: ralphd
author_rank: Frequent Contributor
timestamp: September 13, 2015, 05:14:51 pm
content: Quote from: Psi on September 13, 2015, 11:03:40 amThere are number of different hardware implementations of the USBasp. I also think the first one I ever bought didn't have the software sck option firmware, even though it had been out for a couple years. I primarily use the "USBASP V2.0 LC Technology" hardware with the latest (2011-05-28) official firmware. I also have a couple of the USBISP/USBASP like these:http://www.dipmicro.com/store/USBASP2They were advertized as a USBASP by a Aliexpress seller, but when I got them I found out they were not. After some searching I figured out how to re-flash them to work like a proper USBASP.Neither have given me any problems other than occasionally not recognizing the target chip, which usually seemed to be pushing the SCK rate too fast (i.e. with a 1Mhz AVR). I've certainly never had any fuse or flash corruption. While I don't have a lot of AVR MCUs (20 or so), I do flash them a lot, especially when I'm doing bootloader development.Another really cheap alternative to a USBasp is to flash the USBISP code to a pro mini and then use it as a programmer. The Pro Minis sell for ~150c on AliExpress.

author: Electro Fan
author_rank: Super Contributor
timestamp: September 13, 2015, 09:34:09 pm
content: Quote from: retrolefty on September 12, 2015, 07:45:32 pmavrdudess looks very good:http://blog.zakkemble.co.uk/avrdudess-a-gui-for-avrdude/- many favorable comments over an extended period of time but I did notice this fairly recent entry (so maybe the TL866CS is still a handy tool to have around along with avrdudess):---saulJuly 31, 2015 at 6:50 am (UTC 1) Link to this commentReplyissue, problemUnable to detect MCUavrdude.exe: stk500_getsync() attempt 1 of 10: not in sync: resp=0x15avrdude.exe: stk500_getsync() attempt 2 of 10: not in sync: resp=0x15avrdude.exe: stk500_getparm(): (a) protocol error, expect=0x14, resp=0x14avrdude.exe: stk500_getparm(): (a) protocol error, expect=0x14, resp=0x01avrdude.exe: stk500_initialize(): (a) protocol error, expect=0x14, resp=0x10avrdude.exe: initialization failed, rc=-1Double check connections and try again, or use -F to overridethis check.avrdude.exe: stk500_disable(): unknown response=0x12avrdude.exe done. Thank you.

author: Electro Fan
author_rank: Super Contributor
timestamp: September 13, 2015, 09:39:31 pm
content: Quote from: amyk on September 12, 2015, 12:59:38 pmThanks!... but I'm pretty sure I have a (long) way to go yet....

author: Electro Fan
author_rank: Super Contributor
timestamp: September 13, 2015, 09:42:19 pm
content: I might have put this post/question in the wrong place but maybe someone here can address/answer it? Thankshttps://www.eevblog.com/forum/blog/eevblog-411-minipro-tl866-universal-programmer-review/msg752732/#msg752732a little off topic....If I program an Atmega328P with an Arduino Uno using the IDE to make a sketch - and I program an LCD attached to the Arduino to display 1234 - and then I read the Atmega with a TL866CS and the MiniPro software - I find two entries in the MiniPro software for 1234 - one entry happens to be on line 860 and other is a few lines down at 8F0. If I then use the TL866CS MiniPro software to edit 1234 to make abcd on line 860, the MiniPro software will make the changes on line 860 to show abcd and leave line 8F0 as 1234. All makes sense so far.If I then move the Atmega back to the Arduino the attached LCD display will show 1234 (apparently reading line 860). Still good.However, if I then use the Arduino IDE to change the 1234 characters to xxxx (or any 4 characters) and I put the Atmega back into the TL866CS, the MiniPro software will show that both line 860 and line 8F0 have been changed to xxxx.Question: what is the meaning (reason for) the duplicate entry a few lines down from the initial entry and why does the Arduino programming approach change both lines vs. the TL866CS/MiniPro approach which will change the two lines independently?Thanks, EFPS, a question was asked about the TL866 MiniPro software and Windows 10 - they seem to be working fine together with my setup

author: tombi
author_rank: Regular Contributor
timestamp: September 22, 2015, 02:09:26 am
content: Could it be the data is being stored in both the code (text) and data segments for some reason?http://www.nongnu.org/avr-libc/user-manual/mem_sections.html

author: tombi
author_rank: Regular Contributor
timestamp: September 22, 2015, 05:29:08 am
content: Actually could it be because you are holding the string (1234) in a variable and not declaring it const? See tip#5 in here.http://www.atmel.com/images/doc8453.pdf

author: Electro Fan
author_rank: Super Contributor
timestamp: October 15, 2015, 01:54:53 am
content: Getting back to this thread, I'm still not sure what the duplicate data is about but I appreciate the suggestions.On a distantly related item (from earlier in this thread), I saw this:https://youtu.be/3fjrKEJCE40Not sure how long Atmel Studio 7 has been around but there is a reference to importing sketches - not sure if that just means moving software from the Arduino IDE to Atmel Studio 7 or if it means you can actually pull sketches data back from the Atmega chip on the Arduino board to Atmel Studio 7.

author: brobbuilder
author_rank: Contributor
timestamp: October 15, 2015, 02:32:47 am
content: Real programmers use pushbuttons and metronomes.

author: amyk
author_rank: Super Contributor
timestamp: October 15, 2015, 03:31:59 am
content: Quote from: brobbuilder on October 15, 2015, 02:32:47 amIndeed.

author: Electro Fan
author_rank: Super Contributor
timestamp: October 15, 2015, 04:37:48 am
content: hard to believe anyone even needs software instead of a button