1
\$\begingroup\$

Before I can program my ATmega32 through USBasp but now only in 30 times or more try I can program ATmega32.

I get this error

avrdude: error: program enable: target doesn't answer. 1 

program command

avrdude -c usbasp -p m32 -u -U flash:w:pd.hex

What's problem and solution?

When I try with -F option, I get below message.

avrdude: Device signature = 0x887b15
avrdude: Expected signature for ATmega32 is 1E 95 02
\$\endgroup\$
  • \$\begingroup\$ Welcome to EE.SE. A search on this site for the error message "avrdude: error: program enable: target doesn't answer" reports (currently) 19 other hits plus yours. As explained in "How do I ask a good question?", it will improve your chances of replies if you show what research you have already done, what have you already tried and what happened etc. You can edit your question to add that information. \$\endgroup\$ – SamGibson Jul 29 '18 at 15:00
1
\$\begingroup\$

The problem is given in the error message:

target doesn't answer

Possible reasons are:

  • Incorrect/slacky wiring: Might seem unlikely if you did not change anything since you've successfully programmed the avr before. However, expecially if using a breadboard or jumper cables: Double-Check your connections. Also test for short-circuits between signals.
  • Hardware failure: Overvoltage, a short circuit or drawing too much current from the avr can damage the device so that it is simply broken.
  • Clock speed: If the clock is too high for your target, you cannot program it. Decrease the baudrate by using the -b-option with avrdude.
  • Fuses: Improper settings of the fuses might have locked you out, e.g. by disabling the reset pin.
  • Supply voltage missing or not stable. Use a proper supply and bypass capacitors.
\$\endgroup\$
  • \$\begingroup\$ When I try with -F option I get this message. avrdude: Device signature = 0x887b15 avrdude: Expected signature for ATmega32 is 1E 95 02 \$\endgroup\$ – user3865434 Jul 29 '18 at 15:23
  • \$\begingroup\$ do not use -F option. It is not for for this case \$\endgroup\$ – P__J__ Jul 30 '18 at 21:59
4
\$\begingroup\$

I was pulling my hair out as I had received 20 Atmega328P's and the first one I was able to get programmed with my USBasp Programmer, but swapping the processors I was not able to program on breadboard or within an UNO.

Thanks to some posts I felt confident it was a fuse setting where it was speaking too fast. I have an external 16MHz crystal in my setup so I used:

/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avrdude -P usb -v -C /Applications/Arduino.app/Contents/Java/hardware/tools/avr/etc/avrdude.conf -v -B 10 -c usbasp -p m328p -U lfuse:w:0xFF:m -U hfuse:w:0xDE:m -U efuse:w:0x05:m

I found most of this command in other forums but the magic I needed was the "-B 10" to get it to only speak at a 10us clock rate. Once I did this command line command on my Mac, I was able to use the Arduino GUI to do a Burn Bootloader or Upload Using Programmer without issue.

The problem seems to be the USBasp board/sw did not auto clock down to find a happy setting. I am using the Amazon HiLetgo which claims "USBASP V2.0" but has very back-level firmware as well, so I needed to update that with the latest (2011) usbasp from Thomas Fischl named: usbasp.2011-05-28 that was a pain also but it's a one time deal though I am waiting on a second programmer to arrive and I will have to re-flash it also.

\$\endgroup\$
0
\$\begingroup\$

You should connect the protocol SPI of USBasp to the microcontroller. These are MISO, MOSI, SCK and RESET.

Then connect an XTAL of 16MHz with 2 capacitors of 22pF to ground.

Finally, connect a resistor of 10K ohms of RESET to VCC.

Check: https://www.electronics-lab.com/burning-the-bootloader-on-atmega328-using-usbasp-programmer/

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.