Avrdude: stk500_getsync() ... : not in sync

I am trying to program an ATTiny44 through my uno r4 minima connected to a iMac desktop. I get the following error messages:

Sketch uses 1378 bytes (33%) of program storage space. Maximum is 4096 bytes.
Global variables use 33 bytes (12%) of dynamic memory, leaving 223 bytes for local variables. Maximum is 256 bytes.
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x32
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x32
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x2f
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x32
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x2f
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x32
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x30
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x32
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x34
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x20
Failed programming: uploading error: exit status 1

I see that there are similar topics in the past, but I don't see a solution, Thanks for your help.

I have seen that solved many many times.

I’ve seen that message quite a bit, and in my experience, it usually comes down to either hardware issues or a corrupted IDE.

For example, if I accidentally miss a bracket in my code, the IDE sometimes throws a cascade of strange errors that appear to be related to its own internal code rather than mine. In such cases, I’ve found that simply reloading the IDE often clears things up and helps it point to the real issue.

I’ve also had USB cables fail after several successful uploads. Longer cables and USB hubs tend to make the problem worse. Swapping the cable or connecting directly to the PC usually helps.

All of this assumes you’ve selected the correct board and port in the IDE.

As a side note, I’ve often seen messages like resp=??, but haven’t yet found a good reference explaining what the codes actually mean, maybe someday I’ll stumble across a full list!

Hi @rotobob.

Are you using the UNO R4 Minima board as an "Arduino as ISP" programmer?:

https://docs.arduino.cc/built-in-examples/arduino-isp/ArduinoISP/

Or are you using the UNO R4 Minima in some other way?

The solution is that you are using the wrong board setup and you need to change it.

In other words the Arduino is not getting back the answers it expects, so it tries ten times before it gives up. The resp part of the error message is the response it is receiving instead of the expected one.

Thanks for your help.
I was not running the ArduinoISP sketch first. Now it says Done Uploading but the ATTiny44 doesn't appear to do anything.

I'm just trying to run the blink sketch as shown below

/*
  Blink

  Turns an LED on for one second, then off for one second, repeatedly.

  Most Arduinos have an on-board LED you can control. On the UNO, MEGA and ZERO
  it is attached to digital pin 13, on MKR1000 on pin 6. LED_BUILTIN is set to
  the correct LED pin independent of which board is used.
  If you want to know what pin the on-board LED is connected to on your Arduino
  model, check the Technical Specs of your board at:
  https://docs.arduino.cc/hardware/

  modified 8 May 2014
  by Scott Fitzgerald
  modified 2 Sep 2016
  by Arturo Guadalupi
  modified 8 Sep 2016
  by Colby Newman

  This example code is in the public domain.

  https://docs.arduino.cc/built-in-examples/basics/Blink/
*/

const int  LED = 2;

// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED, HIGH);  // turn the LED on (HIGH is the voltage level)
  delay(1000);                      // wait for a second
  digitalWrite(LED, LOW);   // turn the LED off by making the voltage LOW
  delay(1000);                      // wait for a second
}

That is great progress!

Make sure you have the LED connected to the correct pin on the ATtiny44. A common mistake when working with bare microcontrollers is assuming that the Arduino pin numbers are the same as the physical pin numbers on the chip. This is not guaranteed, and also very unlikely. There is an arbitrary mapping between the Arduino pin numbers and the I/O pins on the chip, which is defined by the core variant in the Arduino boards platform you are using to add support for the ATtiny44 to Arduino IDE. You should consult the platform's documentation to determine the pin mapping. If you can't find the information, just tell us exactly which boards platform you are using and we will be able to direct you to the pin mapping information.

I can't find the core variant. I'm using an Arduino Uno R4 Minima.

I did find a different pin that was cycling up and down every second. So I started testing different values for the output pin numbers one at a time. I mapped pins 2 - 10 to the actual physical pin that each one activated on the ATTiny44, but I couldn't find a physical pin activated for pins 11-13 as used in the program. I don't understand why. Every pin on the device should be able to be used as an output except pins 1 and 14 which are vcc and ground pins.

I remain grateful for your help.

I'm going to ask you to provide the full verbose output from a compilation of the sketch you uploaded to the ATtiny44.


:red_exclamation_mark: This procedure is not intended to solve the problem. The purpose is to gather more information.


Please do this:

  1. Select File > Preferences... (or Arduino IDE > Settings... for macOS users) from the Arduino IDE menus.
    The "Preferences" dialog will open.
  2. Check the box next to "Show verbose output during: ☐ compile" in the "Preferences" dialog.
  3. Click the "OK" button.
    The "Preferences" dialog will close.
  4. Select Sketch > Verify/Compile from the Arduino IDE menus.
  5. Wait for the compilation to finish.
  6. Right click on the black "Output" panel at the bottom of the Arduino IDE window.
    A context menu will open.
  7. Select Copy All from the menu.
  8. Open a reply here on this forum topic by clicking the "Reply" button.
  9. Click the <CODE/> icon on the post composer toolbar.
    This will add the forum's code block markup (```) to your reply to make sure the error messages are correctly formatted.
  10. Press the Ctrl+V keyboard shortcut (Command+V for macOS users).
    This will paste the compilation output into the code block.
  11. Move the cursor outside of the code block markup before you add any additional text to your reply.
  12. Click the "Reply" button to publish the post.

In case the output is longer than the forum software will allow to be added to a post, you can instead save it to a .txt file and then attach that file to a reply here.

Click here for attachment instructions

  1. Open any text editor program.
  2. Paste the copied output into the text editor.
  3. Save the file in .txt format.
  4. Open a reply here on this forum topic by clicking the "Reply" button.
  5. Click the "Upload" icon (Upload icon) on the post composer toolbar:

    The "Open" dialog will open.
  6. Select the .txt file you saved from the "Open" dialog.
  7. Click the "Open" button.
    The dialog will close.
  8. Click the "Reply" button to publish the post.

Alternatively, instead of using the "Upload" icon on the post composer toolbar as described in steps (5) - (7) above, you can simply drag and drop the .txt file onto the post composer field to attach it.

You are only using that as the programmer through which to upload the compiled Arduino sketch program that runs on the ATtiny44 microcontroller. So making statements like this is sure to cause confusion.

FQBN: attiny:avr:ATtinyX4:cpu=attiny44
Using board 'ATtinyX4' from platform in folder: /Users/roberttower/Library/Arduino15/packages/attiny/hardware/avr/1.0.2
Using core 'arduino' from platform in folder: /Users/roberttower/Library/Arduino15/packages/arduino/hardware/avr/1.8.6

Detecting libraries used...
/Users/roberttower/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=attiny44 -DF_CPU=1000000L -DARDUINO=10607 -DARDUINO_attiny -DARDUINO_ARCH_AVR -I/Users/roberttower/Library/Arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I/Users/roberttower/Library/Arduino15/packages/attiny/hardware/avr/1.0.2/variants/tiny14 /Users/roberttower/Library/Caches/arduino/sketches/E762BA9ED1FFFDAD3F239EC7059D9562/sketch/Blink_for_attiny44_pins_updated.ino.cpp -o /dev/null
Generating function prototypes...
/Users/roberttower/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=attiny44 -DF_CPU=1000000L -DARDUINO=10607 -DARDUINO_attiny -DARDUINO_ARCH_AVR -I/Users/roberttower/Library/Arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I/Users/roberttower/Library/Arduino15/packages/attiny/hardware/avr/1.0.2/variants/tiny14 /Users/roberttower/Library/Caches/arduino/sketches/E762BA9ED1FFFDAD3F239EC7059D9562/sketch/Blink_for_attiny44_pins_updated.ino.cpp -o /private/var/folders/0z/crg026ds63v17r452pj4m2x40000gn/T/1104157826/sketch_merged.cpp
/Users/roberttower/Library/Arduino15/packages/builtin/tools/ctags/5.8-arduino11/ctags -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives /private/var/folders/0z/crg026ds63v17r452pj4m2x40000gn/T/1104157826/sketch_merged.cpp

Compiling sketch...
/Users/roberttower/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=attiny44 -DF_CPU=1000000L -DARDUINO=10607 -DARDUINO_attiny -DARDUINO_ARCH_AVR -I/Users/roberttower/Library/Arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I/Users/roberttower/Library/Arduino15/packages/attiny/hardware/avr/1.0.2/variants/tiny14 /Users/roberttower/Library/Caches/arduino/sketches/E762BA9ED1FFFDAD3F239EC7059D9562/sketch/Blink_for_attiny44_pins_updated.ino.cpp -o /Users/roberttower/Library/Caches/arduino/sketches/E762BA9ED1FFFDAD3F239EC7059D9562/sketch/Blink_for_attiny44_pins_updated.ino.cpp.o
Compiling libraries...
Compiling core...
Using precompiled core: /Users/roberttower/Library/Caches/arduino/cores/attiny_avr_ATtinyX4_cpu_attiny44,clock_internal1_ac6cf214a932b510a322afd984176522/core.a
Linking everything together...
/Users/roberttower/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-gcc -w -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections -mmcu=attiny44 -o /Users/roberttower/Library/Caches/arduino/sketches/E762BA9ED1FFFDAD3F239EC7059D9562/Blink_for_attiny44_pins_updated.ino.elf /Users/roberttower/Library/Caches/arduino/sketches/E762BA9ED1FFFDAD3F239EC7059D9562/sketch/Blink_for_attiny44_pins_updated.ino.cpp.o /Users/roberttower/Library/Caches/arduino/sketches/E762BA9ED1FFFDAD3F239EC7059D9562/../../cores/attiny_avr_ATtinyX4_cpu_attiny44,clock_internal1_ac6cf214a932b510a322afd984176522/core.a -L/Users/roberttower/Library/Caches/arduino/sketches/E762BA9ED1FFFDAD3F239EC7059D9562 -lm
/Users/roberttower/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-objcopy -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 /Users/roberttower/Library/Caches/arduino/sketches/E762BA9ED1FFFDAD3F239EC7059D9562/Blink_for_attiny44_pins_updated.ino.elf /Users/roberttower/Library/Caches/arduino/sketches/E762BA9ED1FFFDAD3F239EC7059D9562/Blink_for_attiny44_pins_updated.ino.eep
/Users/roberttower/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-objcopy -O ihex -R .eeprom /Users/roberttower/Library/Caches/arduino/sketches/E762BA9ED1FFFDAD3F239EC7059D9562/Blink_for_attiny44_pins_updated.ino.elf /Users/roberttower/Library/Caches/arduino/sketches/E762BA9ED1FFFDAD3F239EC7059D9562/Blink_for_attiny44_pins_updated.ino.hex
/Users/roberttower/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-size -A /Users/roberttower/Library/Caches/arduino/sketches/E762BA9ED1FFFDAD3F239EC7059D9562/Blink_for_attiny44_pins_updated.ino.elf
Sketch uses 692 bytes (16%) of program storage space. Maximum is 4096 bytes.
Global variables use 9 bytes (3%) of dynamic memory, leaving 247 bytes for local variables. Maximum is 256 bytes.

OK, I see you are using the old school "attiny" boards platform from David Mellis. So the Arduino pin mapping is as shown in this diagram:

So we would expect your sketch to blink an LED connected to physical pin 11 on the DIP package of the ATtiny44 IC (PA2):

Do you have the LED connected to that pin?

OK. Yes, when I assign LED = 2, pin 11 on the chip flashes the led.

I can now make each of the pins cycle (yay!), except pin 4, which is PB3. The ATTiny44 data sheet says "To use pin PB3 as an I/O pin, instead of RESET pin, program (‘0’) RSTDISBL fuse." Do you know how to do that?

Great news!

Neither the "attiny" boards platform you are using, nor even the far more feature rich alternative "ATTinyCore" platform provide support for doing this via Arduino IDE. So you would need to use a standalone tool such as AVRDUDE to accomplish this.

However, you should be aware that the reset functionality is required to program the ATtiny44 via the ISP programmer, including setting the configuration fuses. So if you did program the RSTDISBL fuse, you would find that you were no longer able to upload sketches to the ATtiny44, and that you couldn't even use your ISP programmer unprogram the RSTDISBL fuse. The only way to restore the reset functionality is using a special "high voltage" programmer.

So the only time it makes sense to program the RSTDISBL fuse is you have a 100% finished project that requires the extra I/O pin, where you are going to program the chip with that program and never update it again.

Otherwise, you are better off just using a chip with more I/O (e.g., ATmega328P).

Ok. My current project requires 11 I/O pins, so I'm good with the attiny44.

Thanks for all of the help and information!

You are welcome. I'm glad if I was able to be of assistance.

Regards, Per