Thursday, February 28, 2019

Arduino - avrdude: stk500_getsync() not in sync - How to fix


This is  reminder for me and hopefully useful for others either new to Arduino or using different boards.

Sometimes on uploading you can get an error message

avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x00




Of course the attempt number changes as it tries 10 times.

There are a few relatively obvious things that can help stop this error message.

Select the right board.  If you're using an Uno, select Uno. If you're using a Leonardo, select Leonardo.

Select the correct processor: ATMega328 is the Uno one and the default

Make sure your USB port is selected.

Even after doing both of these and it all looking right you might still be getting the error message.

This is where we get into a discussion about Arduino compatible boards.  The Arduino is an Open Source design and so it is perfectly legal and acceptable for anyone to copy the design and make their own boards and sell them (but they cannot call it an Arduino, topic for another day)

Some of these compatible boards use a different USB chip (CH340) and the ATMega328 could have a different bootloader to the actual Arduino.

if you are using a compatible board that has a CH340 make sure to install the driver for the chip otherwise you may not even be able to see the board in the IDE.

Then for the bootloader there is an alternative option under the Processor called "ATMega328P (Old Bootloader)"  Not where I expect to see an alternative bootloader option but there it is.


ATMega328p (Old Bootloader)


This is the one I have to use for compatible boards.

So, once the correct board, processor, and port are selected you should be able to program your Arduino with ease.

Finally, finally. If you're running Linux and not Windows there is one more thing to take into account and that's permissions.  By default a regular user account does not have permission to read/write to USB serial ports so you have to add your user to the group with access. 

The command you need is as follows where [USERNAME] is replaced with your username.

sudo usermod -a -G dialout [USERNAME]


WARNING: This command is run using sudo and so has root access.  It's always the right thing when finding commands online that use sudo to do your own research before blindly using the command.
So, here's where I got the command from https://www.arduino.cc/en/Guide/Linux/


Hope you find this useful as I expect I'll be back here again when I set up my next computer or buy some new compatible boards.


2 comments:

  1. Muy bueno, me ha servido, gracias

    ReplyDelete
  2. I change the Processor to "ATMega328P (Old Bootloader)" and it works!! Thanx bro

    ReplyDelete

Note: Only a member of this blog may post a comment.