USBasp target doesn't answer

Hello all. I have been struggling with a USBasp error for hours and would be very grateful for some assistance. I am trying to upload “blink” (really something else, but this doesn’t work either) to a standalone ATmega328P chip using a USBasp programmer. I am running Windows 10 with Arduino 1.8.12.
Steps:

  • I am using a new ISP adapter I recently purchased on Amazon (here).
  • I used the program Zadig as recommended elsewhere (here for example) to install the driver (I’ve tried both the “libusb-win32 (v1.2.6.0)” and “libusbK (v3.0.7.0)” drivers). The device is displayed in Device Manager with the name “USBasp” and does not not have any warning flags.
  • I wire the USBasp to the chip on a breadboard. RST to pin 1, SCK to pin 19, MISO to pin 18, MOSI to pin 17, and pwr and ground as appropriate. No 16MHz crystal.
  • Per this tutorial, I downloaded the “ATmega328 on a breadboard (8MHz internal clock”) zip and put the “breadboard” folder in a new “hardware” folder in my sketchbook.
  • Now in Arduino, I select Tools->Programmer->USBasp and Tools->Board->ATmega238 on a breadboard (8MHz internal clock). I leave Tools->Port unselected. I set the upload output to “verbose” in File->preferences and finally select Sketch->Upload using programmer.

Doing all of this (on two separate computers), I get the following output/error. What am I doing wrong!? Thank you for your help.

Warning: Board breadboard:avr:atmega328bb doesn't define a 'build.board' preference. Auto-set to: AVR_ATMEGA328BB
Sketch uses 936 bytes (3%) of program storage space. Maximum is 30720 bytes.
Global variables use 9 bytes of dynamic memory.
C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude -CC:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -cusbasp -Pusb -Uflash:w:C:\Users\matt\AppData\Local\Temp\arduino_build_313488/Blink.ino.hex:i 

avrdude: Version 6.3-20190619
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf"

         Using Port                    : usb
         Using Programmer              : usbasp
         AVR Part                      : ATmega328P
         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    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : usbasp
         Description     : USBasp, http://www.fischl.de/usbasp/

avrdude: auto set sck period (because given equals null)
avrdude: error: program enable: target doesn't answer. 1 
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.


avrdude done.  Thank you.

the selected serial port 
 does not exist or your board is not connected

I struggled with this set up as well. I'm using a WIndows10 machine and found this driver worked when I loaded it with ZADIG:

usbser (v1.0.0.0)

Once I had that and double checked wiring it works very well indeed - and I am using a m328p on a home built pcb with 16MHz crystal.

Try changing the driver and reply with progress.

I also found I must reset the AVR m328p on the board after plugging everything in and before uploading using programmer.

Note that I now find I don't have to reset if I remember to power up after everything is correctly connected.

Thank you, but still no success. After installing the "usbser (v1.0.0.0)" driver using Zadig, the device shows up in Device Manager with a warning flag. In properties it says "This device cannot start. (Code 10). A device which does not exist was specified." In Arduino, when I run sketch->upload using programmer, I get the following error (verbose output). I also tried resetting the chip by temporarily grounding pin 1 before uploading with no effect. Other ideas? FYI, I updated my initial post stating that I am likewise running Windows 10 and am using Arduino 1.8.12.

Warning: Board breadboard:avr:atmega328bb doesn't define a 'build.board' preference. Auto-set to: AVR_ATMEGA328BB
Sketch uses 8152 bytes (26%) of program storage space. Maximum is 30720 bytes.
Global variables use 1349 bytes of dynamic memory.
C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude -CC:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -cusbasp -Pusb -Uflash:w:C:\Users\matt\AppData\Local\Temp\arduino_build_531719/mp3_v4.ino.hex:i 

avrdude: Version 6.3-20190619
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf"

         Using Port                    : usb
         Using Programmer              : usbasp
avrdude: Warning: cannot open USB device: Function not implemented
avrdude: error: could not find USB device with vid=0x16c0 pid=0x5dc vendor='www.fischl.de' product='USBasp'

avrdude done.  Thank you.

the selected serial port 
 does not exist or your board is not connected

Regarding your original error message, these are the potential causes I know of:

Make sure the programmer’s cable is correctly connected to the target board. Pin 1 on the cable is indicated by a small triangle embossed on the plastic. Pin 1 on the Arduino board’s ICSP header is indicated by a white dot on the PCB’s silkscreen.

If your USBasp programmer has the official firmware, you must short the JP3 jumper to program chips that are running at <=1 MHz clock speed. The factory default clock configuration is running on the internal oscillator at 1 MHz. Many of the common Chinese USBasp clones come with a modified firmware that is able to work with chips running at the slower clock speeds without needing to set the jumper. There is also a alternate open source firmware provided by the community that has this functionality.


There is a similar error I get when there is a driver issue, but it’s “target doesn’t answer. 0” rather than “target doesn’t answer. 1”

I don't know if it is related to your current issue, but my avr shows up as m328p. I am selecting the board as "Arduino Duemilenove or Diechimila" and then selecting the processor as ATMega328p.

Also, I was getting a function not implemented error while I had the wrong driver set. That error disappeared when the correct driver was set in ZADIG.

Eureka! Thanks for the tips leading me to a solution!
Solution:

  • Short the JP3 jumper on the USBasp board by twisting a wire through the holes (no solder necessary)
  • Install the libusbK (v3.0.7.0) driver using Zadig
  • Select Tools->Programmer->USBasp
  • Select Tools->Board->ATmega238 on a breadboard (8MHz internal clock)
  • Select Tools->Burn Bootloader then wait for it to finish
  • Remove the wire shorting the JP3 jumper (no longer needed)
  • Select Sketch->upload using programmer

Explanation:
I now understand that a bare-bones ATmega328p runs at 1MHz (now I find that this is discussed in many other forums). This is considered "slow" for the USBasp programmer and so the USBasp must be set to communicate with the ATmega at this slow speed. This is done by shorting its JP3 jumper. With the jumper shorted, you can now communicate with the chip. Uploading sketches will work, but they will run slow (e.g. "blink" will pulse the LED every 8 seconds instead of every second). To get the chip running at 8MHz, something about the fuses needs to change (??) which can be done in multiple ways. One of these ways is to burn the Arduino bootloader onto the chip. Once this is done, the chip operates at 8MHz. If you really want 16MHz, you can add the extra crystal (but make sure to set the board to "Arduino Duemilenove or Diechimila" before uploading).
Well, I hope this is helpful for someone else.

... Phew!