Arduino Sketch upload issue - avrdude: stk500_recv

2019-01-16 02:31发布

问题:

I have an Arduino Duemilanove with an Atmega 328. I am working on Ubuntu 12.04, and the Arduino IDE's version is 1.0. Recently, I tried to upload a few of the sample sketches onto it, such as the Blink one. However, none of my attempts are working and they result in the same error every time I try it - avrdude: stk500_recv(): programmer is not responding.

I have enabled '/dev/ttyUSB0' under Tools -> Serial Port. I have also selected the correct board (Duemilanove with Atmega 328) from the list. Yet, I am not able to resolve the issue. I have searched online as well and none of the other responses for this problem seem to be working for me. Could someone tell me why I am encountering this issue and help me resolve it?

Update: I tried turning the onboard Atmega and fitting it in the other direction. Now, I encounter no problems uploading, but nothing happens afterwards. The onboard LED also does not seem to be blinking.

回答1:

I had this problem with a Crowduino, running the Arduino IDE on OSX. The solution for me was to switch on verbose output during upload (in the arduino IDE preferences pane).

Then, when uploading, you can see avrdude sending three packets avrdude: Send: 0 [30] [20] (with corresponding RX flashes on the board) right before the avrdude: ser_recv(): programmer is not responding error.

The trick is to hit the reset button on the board immediately before these three packets are sent. Then the program will be uploaded successfully.



回答2:

Make sure that there is no input on the Tx/Rx pins, then it will work.



回答3:

I know this is an old post, but there is some voodoo-talk in the answers around here amongst good ideas, let's try to be a bit more real about what's happening and sum up the good stuff to check:

Basically, when that happens, it is a good idea to enable verbose mode for avrdude, to get a better idea of what's happening. To do so, you only need to go in the preferences and check the verbose mode box. It's also a good idea to move away from the arduino IDE, and launch a console to be more comfortable on reading avrdude's output, that you'll get on clicking on the upload button.

What's important here to put 3 or 4 -v to the command call. Here's how looks like such avrdude commands, with made up parameters as they are totally dependent on how the Arduino has been installed:

avrdude -v -v -v -v -C /path/to/avrdude.conf -patmega328 -P/dev/usbport -U flash:w:/path/to/firmware.hex

A good way to get the correct command line to use is to copy it from the verbose output of the Arduino IDE output log when verbosity has been enabled.

When you get avrdude: stk500_recv(): programmer is not responding, it basically means that something wrong is happening, before the flashing actually begins. Basically you have to check (from hardware to software, low level to high level):

  • if the cable and/or connectors does not have microcuts ;
  • if no solder points are short circuiting (i.e. touching something metallic around), that means:
    • if there is no short circuit on the PCB between Rx and Tx (usually pins 1 and 0) ;
    • if there is no contact with a metallic element below the board, or tiny bits between a component's legs (like the FTDI, the atmega chip or any other) ;
  • if the atmega chip is not out of power (GND/VCC shortcut or cut or VCC input being dead…) ;
  • if the 1 and 0 pins of the Arduino are not being used by some shield or custom design (/!\ does not apply to the leonardo as it has independent USB handling) ;
  • if the USB to UART converter does not have a problem (FTDI on older duemilanove or Atmega16U2 on newer Unos) ;
  • if the Atmega328 chip is fried or wrongly installed ;
  • if the bootloader has been overwritten or is failing ;
  • if the right baudrate is applied for entering the bootloader ;
  • if the right settings are set for the target MCU and Board ;

usually the avrdude -v -v -v -v can help a lot find at which stage it is failing. Whether it can't make a USB connection at all (cable failing, USB/UART, PCB…), or it is a bootloader problem.

Update: I tried turning the onboard Atmega and fitting it in the other direction. Now, I encounter no problems uploading, but nothing happens afterwards. The onboard LED also does not seem to be blinking.

I'm afraid that if you reversed the position of the atmega, and then it does not work, the fact that you placed the power source on digital pins may have burnt your chip.



回答4:

I had the same problem – this is why I found this Question.

I only had to change the Processor from “ATmego328P” to “ATmego328P (Old Bootloader)”

Problem solved – at least for me.



回答5:

Try to see if your board was selected correctly. Click on menu Tools --> Board and check if the correct board is select.



回答6:

You can check if you have any jumper wires plugged into pin 0 and 1. thoses pins are used for serial communication and plugged wires can can prevent the code from being uploaded on the board.

If nothing is plugged, it might be a bug with avrdude, you can try updating it.

Hope it helps! :)



回答7:

I met this issue too, and I resolved it by re-installing USB serial driver. Pls see also:http://arduino.cc/en/Guide/Howto and http://www.ftdichip.com/Drivers/VCP.htm



回答8:

Above error comes in 3 stages

  1. If boot loader has been crashed
  2. if you not selected proper port and proper board from IDE
  3. If you communicating with other Serial port are connected.I.e GND and Tx pin are connected to other communicating device


回答9:

I solved the issue on OS X Yosemite 10.10 following these instructions:

http://www.mommosoft.com/blog/2014/10/24/ftdi-chip-and-os-x-10-10/

However the trick proposed by hoipolloi was a working temporary workaround, on this version too.



回答10:

On Windows 7, I had this problem multiple times, each time with different error messages. Basically, the IDE is sending to the wrong port. To fix this, simply go to "Tools" -> "Ports" -> [select the COM port that your board is on].

Make sure to double check your board's port:

1) Start the device manager

2) Make sure, your Arduino driver is listed under the port matching your IDE's port settings (mentioned above)

3) My board is listed under port COM1. If you want, you can simply change the port in the driver's advanced settings:



回答11:

I have this problem on my Arduino running on Mac also. It happens on two of my Arduinos (A Arduino Uno and an Arduino Pro connected with FTDI).

For the Uno, I hook the cable up to my computer and press upload, and then start counting until the "TX" LED flashes. Then repeat the upload, but just before the TX LED flashes, hit the reset button, and the upload succeeds.

I later determined that changing the USB cable fixed this issue.



回答12:

I had the same. On my first trying of Arduino UNO. My solution was quite simple. Just plug out then plug in usb cable. Hope it works for you.



回答13:

First, ensure that /dev/ttyUSB0 works. E.g. plug in mouse and check it works. Second, try select other board. It is often that non-original boards do not recognized correctly under their names. Third, try press reset button manually while uploading sketch. Probably automatic reset is broken.



回答14:

I solved a problem in my case by downloading and installing old FDTM drivers from here.

Try to install FTDIUSBSerialDriver_10_4_10_5_10_6_10_7.mpkg, then re-start Arduino.



回答15:

Just thought I'd point out that my brand new Arduino Uno Rev3 board uses the following LInux driver:

Device Drivers    
|-USB Drivers
  |-USB Modem (CDC ACM) support

This is known as the: CONFIG_USB_ACM: option in the most recent LInux 3.x kernel.

This device then comes up as: /dev/ttyACM0 or similar.



回答16:

so I found the cause of this... Changing my serial port to /dev/tty.usbmodem2131 fixed it. Turns out I was using the wrong serial port this whole time!



回答17:

You can try:

  • Check in preferences.txt serial.debug_rate: serial.debug_rate=9600
  • Else try to hit the reset button of your arduino just when uploading.
  • Else try to select another card in arduino->tools menu and then reselect your card in the list.


回答18:

just thought i'd add in a solution that worked for me running on a mac pro (desktop)

I was getting the same error and it turns out its because I had the USB connected to a peripheral device (my monitor) rather than a USB on the PC itself. Stopped any errors right away and a simple solution.



回答19:

This combination of the above answers solved the problem for me:

  • performed the java update:

    sudo apt-get install default-jdk

  • then killed the arduino IDE and restarted it

  • my correct board now showed up (arduino Mega 2560, where before Mega 1280 was only option)

  • for the drivers, I did this:

    sudo chmod a+rw /dev/serial/by-id/usb-Arduino__www.arduino.cc__(a bunch of numbers)

after that, my arduino IDE shows /dev/ttyACM0 in the tools/serial port menu

Now, everything works great!



回答20:

Thanks @hoipolloi for the right direction in finding the solution. Anyway, I had to do a bit different steps to fix the issue.
I my case the UNO had worked fine but suddenly stopped after some playing with sketches. I was receiving the stk500_recv(): programmer is not responding all the time and nothing worked. Then I paid attention that the LED 13 is always ON on my board. It looked like some hard looped sketch was running over and over on the board and was blocking any input to the board. Not sure, it's just my gues.
I tried clicking the RESET at all the possible moments without any luck and suddenly tried the following steps:

  1. Unplug the board.
  2. Click and hold RESET.
  3. Plug it again.
  4. Wait for a couple of seconds.
  5. Release the RESET button.

After this I noticed the onboard 13 LED turned off for a second and then turned on again. It looked like there were a short reset window when the board is actually being reset. Then as in @hoipolloi's solution I caught the moment of "reset" right before the 3 packets are sent and that worked.
Hope this will help you to figure out the problem if none of other solutions works.

TIP. If you do not see the three Send: 0 [30] [20] lines when uploading the sketch in your console, do the following:

  1. Click "Upload" in your Arduino IDE.
  2. Look at the log window. You will be able to find a line like this:

E:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude -CE:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -carduino -PCOM3 -b115200 -D -Uflash:w:C:\Users\Sergey\AppData\Local\Temp\build44ca75bc60fd83cc8ef41e35d4d83388.tmp/sketch_sep07a.ino.hex:i

  1. Looks like it swallows line break or space symbols like here -CE:\Program Files.... It should be -C E:\Program Files. Copy this like into Notepad, add missing spaces to make the line this:

E:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude -v -v -v -v -C "E:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf" -patmega328p -carduino -PCOM3 -b115200 -D -U flash:w:C:\Users\Sergey\AppData\Local\Temp\build44ca75bc60fd83cc8ef41e35d4d83388.tmp/sketch_sep07a.ino.hex:i

  1. Add 4 -v instructions like I did above.
  2. Open the Command Line, paste the command into it and run.

Now you will see much more verbose thanks to 4 -v arguments. Originally, Arduino Studio uses just one.



回答21:

Have you got anything connected to the RESET pin on the Arduino?

I've encountered this issue with a graphic LCD which needed connecting to the RESET Pin. Disconnecting the jumper wire between the LCD and the RESET pin while uploading the code fixed it for me, all you'd have to do then is reconnect once the code has finished uploading.



回答22:

Did you install/update the driver for the FTDI cable? (Step three on http://arduino.cc/en/Guide/Howto). Running the Arduino IDE from my Raspberry Pi worked fine without explicitly installing the drivers (either they were pre-installed or the Arduino IDE installer took care of it). On my Mac this was not the case and I had to install the cable drivers in addition to the IDE.



回答23:

I just spent the last few hours on this same issue... Just go here "http://www.ftdichip.com/Drivers/VCP.htm", download the latest drivers and reboot. Should work just fine after that. I also downloaded a nightly of the Arduino software, but I don't hunk that made a difference.



回答24:

I was having the same issue and resolved it myself.

First: I have an (OSEPP UNO r3 PLUS). It's an Arduino UNO REV 3 made by OSEPP.

I just bought an OSEPP Motor and Servo controller shield. I just got motors working and then I stumbled upon the same error. avrdude: stk500_recv(): programmer is not responding.

I guess while it was connected it made/assigned a new serial port. Found in the arduino program under "Tools > Serial Port". I just reselected the one related to the UNO and bam, problem resolved.

Hopefully that helps someone.



回答25:

I had the same problem with the arduino Due, most of the solution proposed did not work. the L LED was constantly on. My problem was resolved by unistalling the IDE and picking the experimental version 1.5.8, then in the board I chose the bottom option Arduino Due (programming port) of course you need to connect the usb on the programming port too.



回答26:

This might be retarded but it struck me: Make sure your USB cable (on the Arduino side) is properly connected (fully plugged in). Make sure the device has been detected as described here (for Windows): https://stackoverflow.com/a/26913070/3361975



回答27:

I tried to connect my servo to the arduino 5V pin, bunt the processor and that is why I got this failure

avrdude: stk500_recv(): programmer is not responding

Solution: buy new arduino and external 5V power supply for the servo.



回答28:

Try to load a program without -b (the baud rate option). In ~/.arduino15/preferences.txt set build.verbose=true, when arduino.cc is not running. In the verbose output you will find the hex file which you should load from a console:

avrdude -v -v -v -v -C/usr/share/arduino/hardware/tools/avr/etc/avrdude.conf -patmega328p -carduino -P/dev/ttyUSB2  -D -Uflash:w:/tmp/build2314497724350388190.tmp/sketch_nov13b.cpp.hex:i

I just replace the chip 128 with the 328 version and from Decimile my board name was changed to Uno or Ethernet due to the new baud rate 115200.



回答29:

If you are connecting your Arduino through a USB Hub, try to connect it directly into one of the USB ports on the Mac instead.
That worked for me.



回答30:

I had to select correct board. Go to Tools->Boards->Arduino Nano for example.



标签: arduino