howto: flash ATtiny with AVRDude and command prompt

If you know you have a working .hex file, and have reasonable certainty everything is still good on your programmer/cables/clip, you can use the .bat file method with no issues. If for whatever reason the flash doesn't work the window closes REALLY FAST! and it's pretty easy to tell if it worked or didn't.

But yes, for the first time with a new file, or after making changes, open the command prompt manually and paste/type in the commands. Once you've verified it works you can whip up a .bat file to go with each new version so you don't have to do all that mess every time you want to flash the same one again.

Question for DBC. You went to bed at 2.58 (all my time) posted again at 3.10, 5.07, and 6.29. How much sleep do you live on?

Being a flashaholic, he can not sleep until the problem is solved.

I went to bed just after midnight my time, didn’t get up til 8:30. Immediately set about fixing the issue with my SOIC clip and getting it working, flashed my first driver a bit later this morning. (yep, dreamed it, slept on it, got up and fixed it) But I DID get some sleep! I wasn’t up posting at all hours like you’re saying Steve, sorry. Couldn’t even have been sleepwalking as I shut down the entire system every night.

My wife would shoot my if I was a sleepwalker. Pure and simple.

Hi!
I want to try this flashing :slight_smile: but I have a few beginners questions:

1)How do I choose which driver is good for flashing? Are these Nanjg 105c with ATMEL TINY chip OK?
2)Can you give me a suggestion where to order “TEST CLIP 8PIN SOIC” because shipping costs to my country from “digikey” site are $120. :~

@WarHawk-AVG
Thanks for this useful thread!

Many many Chinese/HK sellers have the test clips with free shipping worldwide. For those of us in the U.S. it's much quicker to buy from U.S. sellers (and it's sometimes cheaper, too). Just search ebay for 'SOIC-8 clip' (adding a dash between SOIC and 8 will give you matches for 'SOIC8', 'SOIC 8', and 'SOIC-8' so you don't miss anything).

This driver uses the exact same hardware, just a different firmware version and if you're going to reflash them anyway who cares, right? They're also cheaper.

Hey guys I’m having some problems writing, I have my ribbon cable soldered to the pins on the ATtiny13A (clip coming from china still a few weeks out) and it is working correct, the issue is I dont know where to put the .hex file I want to write. I have created a folder on my C drive just like instructed and placed the .hex in there, I then used the “flash”.bat file RMM posted and of course edited it to be the EXACT name of the .hex I’m wanting to flash, the ONLY one in the folder but when I try to run “flash” in the CMD i get this-

What am I doing wrong?

edit found what I was doing wrong, I was naming my files with “.hex” in the name, apparently thats bad. its working now. :slight_smile:

The point of that flash.bat is to NOT have to edit it for every different file you flash.

If I want to flash nlite.hex I type:

flash nlite

If I want to flash STARMOM.hex I type:

flash STARMOM

Got it, changed it back to that way.

Why does it work that way? What does that %1 tell it?

Is there a way to make a .bat file to read the chip and save its contents?

%1 is just the first variable you type in after the bat file, essentially:

flash %1

is what you're typing in.

And if your “flash” program happens to change its name from time to time, such as to test different version numbers (e.g. “Flash2 %1” or “Flash3.65-rev.1” %1) you can use %0.

It’s so simple:

%0 %1 %2

(etc. depending on how many variables the program will accept) and all you need do is copy the “Flash2.BAT” to “Flash3.65-rev.1.BAT” and bob’s yer uncle!

The %0 is replaced by the .BAT filename.

I would make mine

@%0 %1 %2 %3

so as not to echo the command line, but that depends on the status output of the program.

Just an old-school tip from yer old uncle Dimbo…

(Gosh I miss MS-DOS!) (NOT!!)

Now you've gone and made it complicated! No reason to do that in this case. I grew up on DOS, I didn't have Windows or a mouse for some time so I learned my way around this stuff a little bit.

Sub

I am getting “error; content mismatch” and some funny characters at the beginning (look at the second and third line). What I am doing wrong?

Post your .bat file please...

what are you typing into he CMP prompt and also do you set it to AVRUSB or are you trying to do it just from C:/?

Here it is:
https://dl.dropboxusercontent.com/u/23983522/usbavr.bat

posting from a phone so I can't see that.

Copy/paste it here.

Also are you changing the directory to your AVRUSB folder using the CD command?

I was following the instructions from the first page
Here is the bat content:

This is what I type in CMP and yes I am using CD command

And where do you have the avrusb folder, directly in C or inside another folder?


i see an issue with your bat, getting to my computer now, check back in 5min.

It is in the root of C:
here is the screenshot of the whole story: