Avrdude Mac OS X 10.6 AVRISP mkii - Hex not downloading to ATtiny13a chip

I am attempting to program an ATtiny13a micro with avr-gcc and on Mac OS 10.6. I chose this as my first micro project after reading a "beginning AVR programming" article on MIT's High-Low tech website. It seemed simple enough, and cheap enough to try.

The sample code compiles no problem. I have changed the -mmcu flag to "attiny13a", otherwise I have made no changes to the "blink light" sample code. However, I have not been able to download the hex file onto the micro using avrdude.

Is this even possible? By possible I mean possible to do on a mac? There are tutorials that indicate that this is doable, but they always seem to be 2 or 3 years old. Perhaps there are incompatibilities with my hardware. Is anyone developing using a Mac, the AVRISP mkii, and ATtiny13a, or something similar?

Should I be using a different programmer?

I wired up my micro to the programmer following this article: Programming the Atmel ATtiny2313 in Mac OS X | Evil Mad Scientist Laboratories

Here is my error msg:

Programmer Type : STK500V2
Description : Atmel AVR ISP mkII
Programmer Model: AVRISP mkII
Hardware Version: 1
Firmware Version Master : 1.10
Vtarget : 0.0 V
SCK period : 8.00 us

avrdude: stk500v2_command(): command failed
avrdude: stk500v2_command(): unknown status 0xc9
avrdude: stk500v2_program_enable(): cannot get connection status
avrdude: initialization failed, rc=-1
avrdude: AVR device initialized and ready to accept instructions
avrdude: Device signature = 0x000000
avrdude: Yikes! Invalid device signature.
avrdude: Expected signature for ATtiny13 is 1E 90 07

Thank you for reading this. Any help/constructive criticism is greatly appreciated!!

Eraticus

Hello
I guess you have seen my post: Guide: How to use an Arduino as an In System Programmer (ISP) - Microcontrollers - Arduino Forum ?
Have you tried using that instead? And then change "-p m168" to "-p t13".
Have you seen this guide as well: Arduino AVR In System Programmer (ISP) – uCHobby ?
What command are you using? For example I used: "avrdude -p m168 -P /dev/cu.usbserial-A700dX8R -c avrisp -b 19200 -U flash:w:main.hex"
Can you sent me a link for the guide you are talking about?
Yes it is possible to do on a mac, as I am on a mac as well. I recommend Crosspack: http://www.obdev.at/products/crosspack/index.html as includes everything you need, including an AVR compiler and AVRDude.

Have you seen this page as well: Resources for getting started with AVRs | Evil Mad Scientist Laboratories ? :slight_smile:

That was a lot of questions, hope it helps anyway.

  • Lauszus

Lauszus,

I read your article with much interest, and will be trying it out as soon as possible.

The avrdude command I am using looks like this:

avrdude -b 1 -p t13 -c avrisp2 -P usb -e -U flash:w:blink.hex -v -v -F

Eraticus

The vast majority of the times I've seen a device signature listed as 000000, FFFFFF, or some combination thereof, it has been a bad connection in the ISP lines and/or I had them plugged in the wrong place, and/or the target chip didn't actually have power.

Essentially, if it doesn't cough up a valid valid looking signature, there is no communication at all.

Eraticus
You should have a look at this guide: AVR Tutorial - AVRDUDE
Also see this page: AVRDUDE: 2.2 Programmers accepting extended parameters

As I can tell your command is a bit wrong: avrdude -b 1 -p t13 -c avrisp2 -P usb -e -U flash:w:blink.hex -v -v -F
But your almost there :wink:

Try something like this instead:
avrdude -p t13 -c avrisp2 -P usb -U flash:w:blink.hex

I do not recommend using the -F and -e commands, see the two links above for information.
The -v -v command is up to you.

Alternative, just try the following command, to see if you got connection:
avrdude -p t13 -P usb -c avrisp2

If that does not work, try changing usb to the serial port. Try typing "ls -l /dev/cu.*" in the terminal, and you will see all your ports, it will look something like this: /dev/cu.usbserial-A700dX8R

Also make sure that you are in the same directory, as the blink.hex file, using the cd command. Alternative just move the file to "Macintosh HD", then you do not have to worry about that :slight_smile:

  • Lauszus

Looking through the forums here and at avrfreaks, I've seen libusb mentioned as something that needs to be compiled into avrdude.Is it a safe assumption that I do not need to recompile avrdude from crosspack? Also, Do I need to install a driver for the USB chip on the AVRISP mkii programmer?

When I plug in the AVRISPmkii, no new devices appear in /dev/cu.* The ones listed seem to be associated with bluetooth.

eraticus$ ls /dev/cu.*
/dev/cu.Bluetooth-Modem /dev/cu.RN42-0847-SPP
/dev/cu.Bluetooth-PDA-Sync

Thank's again for all your help!

Eraticus

I think your are right, the problem is that the AVR ISP mkII is not plug n' play. See this guide: Arduino Playground - OSXISPMKII

When your AVR ISP mkII is recognized try the following command, and tell me if it works:
avrdude -p t13 -P usb -c avrisp2

  • Lauszus

When I run the command listed above, I get this result:

MacBook-Air:code eraticus$ avrdude -p t13 -P usb -c avrisp2

avrdude: stk500v2_command(): command failed
avrdude: stk500v2_command(): unknown status 0xc9
avrdude: stk500v2_program_enable(): cannot get connection status
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.

avrdude done. Thank you.

Also, there is a green led which flickers within the the AVRISPmkii case, and the external LED turns green after running.

I have an image of my circuit here:

https://picasaweb.google.com/lh/photo/gmIBkztTyYNTR6V_aKBd1lAj_MyYI1hBYKATjou3xTU?feat=directlink

The wire color is coded like this:

Green: MISO
Blue: SCK
YELLOW: RST

RED: VCC
ORANGE: MOSI
BLACK: GRND

I am powering the + - rails with the regulated 5V output from my Arduino Uno board.

I looks like you have connected the opposite way. The pin at the top left is number 1, you have connected MOSI to it, which should be connected to pin 5. Just swap you chip around, and check if that works. Also try adding a capacitor to it as described on this post: Arduino AVR In System Programmer (ISP) – uCHobby :slight_smile:
Also see the last reply on this post: http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=73102

  • Lauszus

Lauszus,

Yes, the AVRISP mkii manual on page 26 shows the labels for the board pins, not the female cable! When I reversed the cables left over right, I got success. Thank you for your help!!!

Just in case anyone else wants to do this, here is a picture of the working programming circuit:

https://picasaweb.google.com/lh/photo/iaVWflN9W9hmIsUJodTU-VAj_MyYI1hBYKATjou3xTU?feat=directlink

Nice. Glad I could help :wink:

  • Lauszus