AVR Drivers: Difference between revisions

1,399 bytes added ,  4 April 2011
more stuff
(create new page)
 
(more stuff)
Line 8: Line 8:


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.
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.
The Atmel ATTiny13 has flash memory that can be written several thousand times. There are also settings called "fuses" which can be set or cleared.


===Hardware===
===Hardware===
Line 19: Line 21:
You need some kind of software to interface with the USB programmer and read or load programs into the Atmel chip.
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.
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. [http://winavr.sourceforge.net/ 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 and is what Tido uses.
 
===BLF-VLD===
 
Budget Light Forum user Tido created the original files that can be used, called the BLF Versatile LED Driver. If you go to the first entry of the thread [http://budgetlightforum.cz.cc/node/799 How To Build a Flashlight With Perfect Modes], you will find a link to the latest zip archive of the files you need. This zip archive includes a helpful readme file.
 
Without doing any programming, you can choose from three setups that Tido has written:


===Driver Files===
'''Simple''' is a 3-mode setup with Low, Medium, and High. It includes mode memory (if light is on for 2 second or more, the mode is memorized when the light is turned off) and a low battery warning.


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.
'''Extended''' has hidden modes that can be accessed by running through all of the modes quickly. By default you run 3 modes, but can reach other modes if you want.
 
'''Programmable''' allows you to assign any of the extended modes to your 3 simple modes.


==Getting Ready==
==Getting Ready==
Line 30: Line 40:
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.
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.


[http://www.ladyada.net/learn/avr/avrdude.html AVRDUDE tutorial]
Follow instructions [http://interactive-matter.eu/how-to/developing-software-for-the-atmel-avr-with-avr-eclipse-avr-gcc-avrdude/ here] for installing WinAVR and Eclipse. Then configure Eclipse for AVR. There is also a [http://avr-eclipse.sourceforge.net/wiki/index.php/The_AVR_Eclipse_Plugin Wiki] about Eclipse AVR.


===Set up your clip===
===Set up your clip===
Line 39: Line 49:


==Upload new settings==
==Upload new settings==
First you will want to upload one of Tido's programs before trying anything on your own.
Open a command window in one of the BLF-VLD subdirectories: "Fixed Modes", "Programmable", or "Simple". With everything hooked up, enter this command:
 
<CODE>
avrdude -pt13 -c usbasp -P com2 -u -Uflash:w:BLF-VLD.hex:a -Ueeprom:w:BLF-VLD.eep:a -Ulfuse:w:0x79:m -Uhfuse:w:0xef:m </CODE>
confirmed, developer
1,668

edits