howto: flash ATtiny with AVRDude and command prompt

To see what happened when running the bat-file you can add a line to the end of the file:

PAUSE

Then the window stays open until you hit a key.

It ran by so fast and then closed, I have no real idea what happened until I put it in a light. Working on that part as we speak…

Copy the command string from the .bat file and paste it into the window, that's how you should be doing it until you know for sure it works. And use the 'test connection' string if you're still figuring out if it's wired right:

avrdude -p t13 -c usbasp -n

-----

I have the same USBASP programmer from FT as most everybody else, but it's never worked for me with the jumper on 3.3v. Moved it to 5v and it works fine.

I used that test string as provided by the Wikipedia and finally got it all working this morning. Just flashed my first new Qlite, then stripped it and put an FET on it, am seeing 5.90A with no bypass in the driver spring…from an Efest 35A 18650. :slight_smile:

Thank y’all so much for bearing with me! This has been certainly interesting, if not frustrating. But the reward sure feels good! :slight_smile:

Edit: Bypassed the driver spring, how about 6.61A from the Efest 35A!!!

Just double clicking the .bat file runs the command, since there isn’t a stop command it does it and closes when complete…this is why opening a static command prompt to run the command is usually the way to go otherwise it opens does it’s thing, then closes

as above add the pause string above will cause it to stop and wait once it completes the command string

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:/?