howto: Use Atmel AVR Studio 5 to make a .hex file

Great! I guess if you know this kind of stuff, you can choose to use all kinds of different tools to do different things without any problems. But if you dive in without a clue, it helps to have the stuff on your screen exactly match the pictures in the guide. It doesn't help to be buried under a giant pile of 300 different options and opinions about which one is best for one thing, but another thing you have to use that one instead, and so on.

I mean, still today I really don't know the difference in 'Build' and 'Compile'... I just know that if I click things in the right order, something usable comes out the other end. I couldn't find a step-by-step guide anywhere that was relevant to only the things needed to put a custom firmware onto a driver. Lots of generalized stuff with a million distractions, and not knowing what any of it meant made it impossible to weed out the stuff that only applied to different hardware or different types of projects.

Yes, nice work comfy! I totally understand - everyone is at a different level. I've been doing C programming since about 1980, so, got a little unfair background. I was going to attempt a step-by-step install, but seems like the 5.x was more commonly adopted, and I would have had to start from scratch all over again, then I would assume too much knowledge for sure...

I think sometimes it's easier to give a clear explanation of something when you've only just figured it out - you still remember all the things you didn't know before you started. But something you know really well, inside out and backwards, you end up taking a lot of things for granted. I'm as bad about that as anybody.

What's that saying - 'experts are people who know more and more about less and less, until they know nothing at all'? Not really, it just sounds that way when they talk about what they know... watch some NASA press conferences on youtube for examples. I swear they have forgotten how to construct an actual sentence in English. I wonder what happens when they pull up at the McDonalds drive-thru? It must be hilarious. :D

Thanks for the clear presentation. This should take a lot of the fear and learning curve out of the process.

I wish someone had written a detailed guide like this when I started, quite a bit of a learning curve for me. I don’t claim to be all that smart anyway. So I would just like to say thanks for the time spent on this detailed guide, I’am sure it will help others who have had problems or some of those who might say “I got to try this, comfychair makes it look easy”.
I don’t do it the same way as you do, but the results are the same. Nice to see how a expert does it. :bigsmile:

The Tiny13A gets all the attention, deservedly so, but I'm liking the Tivo532 Z8 setup so far. It's really nice to be able to reprogram on-the-fly by just plugging in the connector to the exposed back of the driver. I'm using it in a P60 (L2T) and it's really nice to try different PWM levels, and turn around your source code changes to actually testing in a light in seconds. First couple of times you try it, think anyone will be amazed when coming from the Tiny13A environment. The Z8 has 8K bytes of program space - 8X more than the Tiny13A, so plenty of space to put in all the bells and whistles, not to mention 7135 regulation combined with direct drive mode.

Sorry to go little off topic here, but I'm thinking this Z8 setup may be getting hot soon so don't get too used to AVR Studio and Tiny13A's . I got 4.7A in a P60 on a Pana PF (over 1,300 lumens), in turbo mode, then Hi mode at a regulated 1.5A, and a nice low, then moonlight level -- nice...

I use Atmel Studio 6.1 without problem. Well, in fact there was one problem with luxdrv 0.30b source code, where there is “PROGMEM byte modes={ MODES };” I had to change it to “const PROGMEM byte modes={ MODES };”.
I found this on the big tread for AVR.

I stick to luxdrv code because I really like the short term memory and I’m not skilled enough to implement that short term memory in minidrv.

Yesterday I received a Convoy S6 from banggood, I flashed it right away.
My method is to use extreme burner AVR to check connection, erase chip (mainly to release lockbit fuse) and set low and high fuse. Then I use avrdude to flash hex as extreme burner AVR can’t do it properly (why?)

And in the end of the tutorial, once buildt, it should appear in “my documents”, you don’t need to save hex again.

AS5 takes whatever I paste into it and spits out a hex file ready to use, I don't really care other than that.

I know the project folder created as soon as you hit 'build' contains the .hex, but it also has a bunch of other files that aren't needed. I find it easier to save the hex directly on its own, give it a name that identifies it, instead of going through all the crap of naming the AVRGCC projects. Paste, build, save, then I'm done with it and don't want to see it anymore. I do all the editing of the input files in notepad beforehand, unless I miss something and it fails to build correctly. Even then, after I make changes and get it to go through so I know it works, I copy the source from the AS5 window and paste it back into the txt file I keep in the folders with each version of FW (along with a .bat file with the avrdude commands in it, so I can just connect to a driver and double-click, no futzing with opening command windows for me please, unless I just have to).

I have WinAVR installed, just because it automatically sets up avrdude - I'm sure there's a way to do it without the unneeded WinAVR stuff, but this works for now, it should work for anybody else who just wants to stick firmware onto a driver and isn't really interested in launching a new career as a (apologies in advance for the following link) software developer. I only care about this stuff to the extent it lets me make better flashlights. :p

Driver for the USBASP programmer is libusb-win32, again, no real reason other than because it works and that's really all I care about.

Brilliant!!!

I have AVR Studio 6 so I will be building the .hex file soon...just waiting on my daggum programmer!

There is this combobox that says ‘debug’. I’d switch it to ‘release’ if you are not planning on actually using a debugger. That debug stuff just uses up space in the controller for nothing then.
Very nice how-to! It’s no fun to find out all that stuff alone if you are not to familiar with that kind of software!

I don’t have anything against that Z8, but keep in mind that that 13A is not exactly the pinnacle of the Tiny family, more like an ancient dinosaur or something. :wink: Some of them have really nice features (like 16bit timers for more pwm steps than you will ever want for dimming), and they are just a few lines of code away if you already have invested time and money in the AVR platform.

It's also very good to use Notepad++ (portable) to read the *******.c file to edit ;)

Thanks Comfychair,

That was very clear, much better than just words written in the flashlight wiki, or the long thread...

For a good overview, could you post a few links in your OP with other useful information about the setup, different firmware etc to keep it all easy to find...

Really appreciate your work!

thanks Comfy, that’s a great help. I knew that if I procrastinated long enough the good peeps on here would help me get started with the minimum of fuss. I’ll bookmark this and come back to it in a few days to kick myself into gear. This electronics/ code stuff doesn’t come easily to me!

Added a paragraph at the top with links to the free-to-use firmwares.

Great help, thanks

Tido's code is missing

#define F_CPU 4800000 in the BLF_VFD zip file

It fails to compile the driver.c code in the main dir, the sub directories (Fixed Modes, Programmable, Simple) have pre-compiled .hex files in them based upon the default driver.c code, has 3 mode levels...I compiled one with the mode setting to 5 with nothing else changed (but it's untested)

This is under Atmel Studio 6.1

Don't use 6.1, it just doesn't compile these, the 5.1 as mentioned above works like a champ...go figure

Pardon me while I smack myself in the forehead and have a V8

Why do y’all sometimes speak English and sometimes Swahili? Or Greek? Russian? I don’t know what it is but there’s big chunks of it I just plain can’t make head or tails out of!

Thanks Comfy for pointing me/us in the write direction. I have bitten off my first chunk and ordered the programmer and clip. Now I see it’s all in Chinenglish and barely decipherable. Oh well, off to get me a box of Capn Crunch for the mystic decoder ring…

Swahili? Or Greek? Russian?

It's actually code...programming nerd language :D

All that text gobbledy gook, plug into a compiler [the copy/paste thing], the computer then takes the text (from the links above) and builds a .hex file which is the program in "computer language" the chip can then run

The ATtiny13A is actually a 20mhz computer with a 1Kb "solid state harddrive" inside it EEPROM...a very limited computer but it allows with the above coding to turn on and off different pins at different frequencies and stuff for the different levels

Makes sense. Haven’t looked at any of that since keypunch class. But I’m game. May not be the best to start this late at night, so tomorrow I’ll come back in here and start opening stuff up and digging around. Maybe I’ll learn something!

I’m really not as bad as all that, even though it’s not anything I’ve done before the layout has some sense to it…once I figure out what buttons to press and in what order the problem will be remembering it. :wink: