AVR Drivers

From Flashlight Wiki
Revision as of 22:04, 3 April 2011 by Brted (talk | contribs) (create new page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Some drivers have an ATMEL microprocessor on board to control different modes. ATMEL processors are programmable therefore the same driver can be loaded with different settings to give different numbers of modes, different output levels, as well as flashing modes like strobe or SOS, along with features like mode memory. This page will summarize some of the things you will need if you want to program your own drivers. This is based on a BLF discussion thread where you can go for help or to get answers to your questions.

All of this is based on AVR tools developed for Atmel chips, which is mostly open source (free). Wikipedia article.

Things You Will Need

Drivers

Of course you will need a driver first. There are several NANJG drivers available that include an ATMEL TINY13A chip that can be programmed. These chips can also be locked down so they can't be changed, but so far none seem to be. However, some variants of NANJG drivers use a PIC chip that can not be programmed with AVR tools. See Popular Drivers to see some of the drivers people have been using. Most of these use current regulators to limit the current delivered to the LED while the Atmel chip itself turns the power on and off very quickly, leaving it on for full power, or flashing on and off quickly to simulate a lower mode. By slowing the flashing more, you get strobe modes or SOS modes.

Hardware

You will need two pieces of hardware: a programmer and a clip to attach to the Atmel chip which is already soldered in place. There are a number of programmers available, including one called USBTinyISP that you can build yourself from a kit. Ironically, it uses an Atmel chip as well which must be programmed before it can be used as a programmer. There are also a number of cheap drivers available on eBay if you search for USBASP. These all look similar with an exposed blue circuit board and cost about $12, usually including a ribbon cable, which you probably won't need.

You will also need a SOIC 8 clip to attach to the pins of the Atmel chip on the flashlight driver. There are cheap ones on eBay that have been problematic, but will generally work. They cost about $12 as well. It is best to get one with a ribbon cable that attaches to pins coming out of the clip. The individual wires of the ribbon cable can be disconnected from pins and then reattached so that the correct pins from the USB programmer are connecting to the correct pins on the Atmel chip via the clip.

Software

You need some kind of software to interface with the USB programmer and read or load programs into the Atmel chip.

You will at least need AVRDUDE to upload and download files to the Atmel chip. It is a command line interface (DOS). AVR Studio is available from Atmel to allow you to write and compile programs and load them. WinAVR is another package that includes the tools you will need if you want to write and compile your own programs. Eclipse is another package that can be used to develop programming.

Driver Files

You can download files created by Tido from a link in the first post on the BLF thread. He keeps writing new versions plus has links to the older version.

Getting Ready

Installing software

Installing software on your PC and setting it up to get the USB programmer working. Put files in the correct locations so you can access them.

AVRDUDE tutorial

Set up your clip

Match the pins of the Atmel chip with the pins of the USB programmer.

Download settings

Use the software and hardware to download the existing program from the Atmel chip on the flashlight driver. You will need this if your programming doesn't work and you want to reset the driver to how it was originally. Get fuse settings too.

Upload new settings

First you will want to upload one of Tido's programs before trying anything on your own.