Connect ATTiny84A to USBASP for programming

Go To Last Post
6 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Good news everyone,

 

Today I encountered a problem with attiny84A - there is no clock input (SCK) on the chip to connect it to USBASP.

The pin description in datasheet does not mention SCK, as well as Timing and Control unit is not directly connected to any pin.

 

USBAsp interface provides VCC, GND, RST, MISO, MOSI, and SCK to connect to the chip.

I use ATTiny84A-PU, 14 pin. The datasheet for your convenience: http://www.atmel.com/images/doc8006.pdf

 

How do I connect ATTiny84A with USBASP to burn a program?

 

Appreciate any suggestions.

Regards,

Gary

Last Edited: Sat. Sep 16, 2017 - 08:48 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

SCK is on PA4 whihch is pin#9 on a DIP14 package.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for fast reply. I had to spend some time setting up tools on my computer.

I tried pin 9, but it does not seem to work.

Burning with avrdude,

Command:

avrdude -p t84 -c usbasp -e -u -U flash:w:/Users/mac/Documents/AVR/block_att84A_bt/firmware/main.obj

Output:

avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: error: programm 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.

NOTE: In original post I provided a link to a wrong microcontroller (attiny13). I apologize for this mistake. It is now fixed.

 

Last Edited: Sun. Sep 17, 2017 - 10:58 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Frist, I would not worry about the "cannot set sck period. . . " error.  It does not affect the programming process.

Next,  the "program enable: target does not answer" error is most likely caused by a wiring problem.  If you have MOSI, MISO, SCK and GND connected correctly and power applied to the ATtiny84, you should get a reply with the part ID.  Check you connections again.

And last, I believe you want to load the HEX file into the ATtiny84, not the object file. 

 

I'll upload an example of a successful avrdude response for an ATtiny84 after I start the development station later tonight.

Launching C:\WinAVR-20100110\bin\avrdude -pt84 -cusbasp -Uflash:w:TestDragon.hex:a
Output:

avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e930c
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: reading input file "TestDragon.hex"
avrdude: input file TestDragon.hex auto detected as Intel Hex
avrdude: writing flash (3210 bytes):

Writing | ################################################## | 100% 2.45s

avrdude: 3210 bytes of flash written
avrdude: verifying flash memory against TestDragon.hex:
avrdude: load data flash data from input file TestDragon.hex:
avrdude: input file TestDragon.hex auto detected as Intel Hex
avrdude: input file TestDragon.hex contains 3210 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 1.69s

avrdude: verifying ...
avrdude: 3210 bytes of flash verified

avrdude done.  Thank you.

avrdude finished

 

Alan

Last Edited: Mon. Sep 18, 2017 - 12:02 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

First off.   Try to read the Signature e.g.

avrdude -p t84 -c usbasp

You have a proper Chinese USBASP.   It will set SCK automatically.

 

I assume that you have never set DWEN or RSTDISBL fuses.   Or used any silly CLKPR values.

You just need to check your "wiring".    Jumper wires and breadboards break.

 

David.

Last Edited: Sun. Sep 17, 2017 - 11:10 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Good news, my setup is now working!
Thank you very much, Alan and David.

The problem was wiring: I connected MISO to MOSI and MOSI to MISO, as was suggested by a diagram I found on internet.

As an output format for avrasm2, I am now using Intel HEX (-fI parameter). After I corrected these everything started working.

You are correct, David, I did not set DWEN, RSTDISBL or CLKPR.

The USBASP is set to 5V with a hardware switch.

I spent quite a bit of time setting everything up to work with old 10.6.8 Macbook Pro. I can share my setup details if anyone is interested.

Kind regards and much appreciation,

Gary