3
\$\begingroup\$

I am trying to connect my atmel atmega8 with usbasp (V0.2) to my PC. I follow this tutorial to connect my atmega to usbasp.

I have a 6-pins connector:

o MISO   o VCC

o SCK    o MOSI

o RESET  o GND

Once I connect my usb to my PC, led turns on, and in Control Panel (win7) I see "libusb-win32 devices". After having compiled main.c with winAVR "make" command, if I try to use "make program" command or I write in cmd this:

avrdude -p atmega8 -P m8 -c usbasp -U flash:w:main.hex

system tells me:

avrdude: error: programm enable: target doesn't answer. 1
avrdude: initialization failed, rc=-1
Double check connection and try again, or use -F to override this check

How can I solve this problem?

\$\endgroup\$
3
  • \$\begingroup\$ Has this particular programmer and setup on the PC been working with another AVR before or is it your first try with this environment? \$\endgroup\$
    – wollud1969
    Commented Sep 6, 2012 at 14:01
  • \$\begingroup\$ it worked for a while yesterday with extremeBurner. Now with this program, I only manage to read and write EEPROM. I am not able to work with flash memory. \$\endgroup\$
    – molfab
    Commented Sep 6, 2012 at 16:26
  • \$\begingroup\$ if you are able to post a picture of your breadboard setup we can probably rule out any problems there pretty quick \$\endgroup\$
    – justing
    Commented Sep 6, 2012 at 16:29

4 Answers 4

2
\$\begingroup\$

Check the pinout, then check it again once more.

One frequent problem is speed - vanilla Atmega8 is too slow, USBasp has a switch that switches it to slower mode - you can try that.

\$\endgroup\$
4
  • \$\begingroup\$ agree according to fischl.de/usbasp/Readme.txt you need to be sure that jumper J3 is set on the USBasp to support the slow 1MHz factory clock programming \$\endgroup\$
    – justing
    Commented Sep 6, 2012 at 16:40
  • \$\begingroup\$ Can be this problem that make me able only to read and write EEPROM and not FLASH memory? \$\endgroup\$
    – molfab
    Commented Sep 7, 2012 at 8:09
  • \$\begingroup\$ can you communicate with atmega without any writing? just type command: avrdude -p atmega8 -c usbasp \$\endgroup\$
    – miceuz
    Commented Sep 7, 2012 at 10:49
  • 1
    \$\begingroup\$ BTW, i've noticed, you are using an avrdude flag -P that sets communication port, i guess it should be -P usb, not m8 \$\endgroup\$
    – miceuz
    Commented Sep 7, 2012 at 10:50
1
\$\begingroup\$

I solve out the problem, and I want to share it with you: First, by using a multimeter, I find out that pin schematic was wrong (datasheet for 6-pin doesn't exists and I trusted a similar one). The right configuration is this:

| o VCC   o MISO  |
| o MOSI  o SCK   |D
| o GND   o RESET |

Moreover, there was a problem with clock speed, because my USBASP programmer works with a default different clock speed than my uc. In this case, I found out that I have to solder two pins highlighted as "speed pins". I would like to post you a photo, but stackexchange doesn't allow me to do that as I am a new user.

\$\endgroup\$
1
  • \$\begingroup\$ Note that this is not the right configuration for most avr programmers. It is normal to give the pins with 1 at the top left, which is MISO, top left when looking at the PCB header from the pin side. Your pinout looks like it may be the same, but looking at the socket from the bottom of the pcb. Can you confirm the orientation of your pinout? \$\endgroup\$ Commented Oct 16, 2013 at 12:57
1
\$\begingroup\$

I experienced the exact same problem, and still do when I don't draw the power for my ATmega8 from the USBasp. In case you are using an external power source for your microcontroller, consider trying to use the one from the USBasp itself.

Also, (as mentioned before) the datasheet for the pinouts was wrong. I follow the cables and solder joints directly from the ATMega8 on the USBasp (not the one you are programming) to find out which connection should go where.

It took me two days to get the USBasp working, and although it was frustrating, it was worth it for the price and learning experience. Good luck.

\$\endgroup\$
1
\$\begingroup\$

I have at times had this happen and cannot load bootloader to 328 chips. Like something gets corrupted on the chip. What has fixed it for me is hooking up either a 8 or 16 Mhz crystal to it with associated 22pf caps.

\$\endgroup\$

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