howto: flash ATtiny with AVRDude and command prompt

You need to have a USBASP from here

You also need a SOIC chip from here

Wire the correct pins from the USBASP to the SOIC clip

Then install USB drivers for the USBASP and AVRDude
https://www.dropbox.com/sh/5nsfkghk5so38bv/ikrOuVTTKh

Create a directory on the root partition (I choose c:\avrusb)

Copy the .bat file and the.hex file into that directory

right click on .bat file, select edit, and make sure the EXACT name of the.hex file is in the *.bat file

Open a command prompt (start orb, type cmd, then change directory to the directory with the .bat file and.hex file)

cd c:\avrusb

Run the *.bat file, if you have all the pins wired correctly, the driver and AVRDude loaded and the SOIC clip on the chip, you should see the commands flash by pretty quick and erase and reprogram your ATtiny13A with new custom firmware

Typical output would look something like this
C:\cd avrusb

C:\avrusb>ls
STAR.V1.1.hex avrusb.bat

C:\avrusb>avrusb

C:\avrusb>avrdude -p t13 -c usbasp -u -e

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

Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0×1e9007
avrdude: current erase-rewrite cycle count is 269554199 (if being tracked)
avrdude: erasing chip
avrdude: warning: cannot set sck period. please check for usbasp firmware update
.

avrdude done. Thank you.

C:\avrusb>avrdude -p t13 -c usbasp -u -Uflash:w:STAR.V1.1.hex:a -Ulfuse:w:0×75:m -Uhfuse:w:0xff:m

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

Reading | ################################################## | 100% 0.03s

avrdude: Device signature = 0×1e9007
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 “STAR.V1.1.hex” avrdude: input file STAR.V1.1.hex auto detected as Intel Hex avrdude: writing flash (996 bytes):

Writing | ################################################## | 100% 0.72s

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

Reading | ################################################## | 100% 0.56s

avrdude: verifying …
avrdude: 996 bytes of flash verified
avrdude: reading input file “0×75”
avrdude: writing lfuse (1 bytes):

Writing | ################################################## | 100% 0.03s

avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0×75:
avrdude: load data lfuse data from input file 0×75:
avrdude: input file 0×75 contains 1 bytes
avrdude: reading on-chip lfuse data:

Reading | ################################################## | 100% 0.02s

avrdude: verifying …
avrdude: 1 bytes of lfuse verified
avrdude: reading input file “0xff”
avrdude: writing hfuse (1 bytes):

Writing | ################################################## | 100% 0.02s

avrdude: 1 bytes of hfuse written
avrdude: verifying hfuse memory against 0xff:
avrdude: load data hfuse data from input file 0xff:
avrdude: input file 0xff contains 1 bytes
avrdude: reading on-chip hfuse data:

Reading | ################################################## | 100% 0.03s

avrdude: verifying …
avrdude: 1 bytes of hfuse verified

avrdude done. Thank you.

C:\avrusb>

*.bat file courtesy of comfychair

Thanks, now if I can just get the USB programmer installed I might, might, just get somewhere.

I use this bat file.

If you want to flash NLITE.hex, for example, just type:

flash NLITE

Nice…flag to install whatever *.hex file is in the directory automatically…sweet! Thanks

% = “all” in a batch file…so %1 means all1.hex, excellent

Thanks for the thoughtful how-to.

What is the interface pin-out between the USB programmer and the SOIC clip?
How do you get from the 10 pin ribbon cable connector on the USB programmed to the individual pins on the SOIC clip?
Someons please post a picture for me. I’m a little slow :bigsmile:

Make sure you move jumper to 3.3vdc on the USBASP

I'm confused a bit by what you mean by "% = "all" in a batch file". %1 is basically "variable 1", so it would be the bat file then whatever comes after becomes %1, or "variable 1". I think that you can have up to 4 of these, after that you've got to change how you write the batch file.

Example:

FLASH STAR1.1 LOCK
BATCH %1 %2 (if it were actually used).

Yup, you are right

So with the *.hex being the next file in the directory, it becomes argument variable %1 automatically…good call

I had 3 different .hex files in the directory, so I manually go in and edit the.bat just to make 100% sure I ain’t doing something wrong…lord knows with my luck I would run the *.bat and erase 90% of my drive or something

No, it doesn't automatically choose any hex file, that's the point of it; you choose which hex file you want to flash by which name you put after typing flash. I have about 50 in my folder, this makes it easier for me. You don't ever need to edit the hex file unless you are flashing one with different fuses.

I’m supposed to move the jumper to 3.3 not leave it on 5?

gotcha…by typing the name you are setting the variable…duh

this is why you guys are the masters and I am still learning :smiley:

Yes

I think that mine is still on 5, has always been on 5. Came that way, I figured that it was setting the input voltage but that was just a guess (USB standard is 5V).

I believe jumper is for VCC going to the ATtiny 13…I guess 5vdc would work, but I set mine to 3.3

Per the data sheet
Operating Voltage: – 1.8 – 5.5V

https://www.dropbox.com/sh/s2rll5mwqnjtcki/kb50msUgkK

I guess it doesn’t matter

Very carefully identifying each wire at the mcu, then attaching that wire to it’s proper point in the plug going into the usbasp. No dice. Changed the jumper. No. Tried a brand new driver. Nope. Even with the clip actually on an ATiny13A, on top of the diagram, tracing that wire to the block, everything looks perfect. No deal.

Bedtime, again.

Found this, in case anyone is looking

http://letsmakerobots.com/node/36841

Crazy question…do you have WinAVR or avrdude installed?

http://winavr.sourceforge.net/

Not needed - as others already said, both positions work fine

Everything now seems to be working properly, so I have to figure out the flash part. Then I’ll be good to go, until I wake up tomorrow and have to start all over…

Ok, I edited the Flash.bat file from Comfy to read the actual .hex file I just created a little while ago. I plugged in my USB Programmer with a driver attached to the clip and then double clicked the Flash.bat file…BAM! so much happened so fast then closed that I am not sure what it did! lol A command window opened, lots of stuff flashed by, then it closed. So, am I to assume that this driver is now flashed? Easy as that? Daaaaang! :slight_smile:

This was a blown driver, so I can’t test it, but I now know that when I double click that file stuff happens! Still have to find out if it’s the right stuff… No FET boards yet, guess I’ve got to get busy and strip down a Qlite and put an FET on it the hard way, find out if all this works.

Confusing, exasperating, exciting and rewarding, what a mixed bag!