Hank (from intl-outdoor.com) has requested my help in writing instructions to flash the D4V2, using the so-called “flash kit”.
The flash kit can be ordered here: intl-outdoor.com/emisar-d4v2-reflashing-kits
My instructions are only for Windows 10, using a command line, which is the only method I have experience with. Windows 7 and 8 should also work with these instructions.
This is a collaborative project, others BLF members can contribute instructions for using other flashing software (GUI versions, etc) or other operating systems (Mac, Android app, etc). Note, as these alternate instructions become available from other BLF members, I will add them to my reserved replies directly below this post.
This is the flash kit you will get from Hank. Link to full size photo of PCB board HERE.
Important Note, it’s advisable to use a grounding strap when handling the exposed USBasp board from Hank. If you don’t have a grounding strap (and know how to use it), then only hold the USBasp board by the edges, or only touch the plastic housing of the 10-pin connector. Avoid touching any of the components on the board. Many of the components are not particularly static sensitive (resistors, caps), but some may be, including the 32-pin Atmel microcontroller. Also, do not lay the USBasp board on anything conductive while using.
..Installing The Software..
The good news; building/assembling the hardware has already been done by Hank - we only have to install two software programs to successfully update firmware on the D4V2.
The two software programs are:
(1) Zadig (used to install Windows USB driver), which allows communication between your computer and Hank’s USBasp board.
(2) AVRDUDE, the program that actually flashes the firmware update to the D4V2 driver board. The AVRDUDE version we're using is a command-line interface. If you aren’t familiar with a command line interface (like Windows DOS), it doesn’t matter. For the few commands that are required, you can cut/paste them into the command line window – and you don’t have to understand them.
The first program - Zadig (USB driver)
Plug the USBasp board into one of your computer’s USB ports. The red LED on the board should light up.
We will install the Windows USB software driver next. To do this, we will use a program called Zadig. Download the executable file (Zadig 2.4) from the link below, then execute it. Note, newer versions may work, but haven't been tested by me. Also note this is a stand-alone executable file, it’s not actually installed into Windows as a program. It only runs when executed.
Download site: https://zadig.akeo.ie/
After executing Zadig, go to the top menus, click on options, then list all devices. You should see USBasp as one of the devices it found (which is the USBasp board you just plugged in). Select that.
Now, to the right of the green arrow, scroll through available drivers and select libusbK (v184.108.40.206)
Then click on the large icon Install Driver. If by chance Windows automatically installed its own driver when you plugged in the board, then replace that driver with the libusbK driver.
This is what you should see if the driver installed correctly:
FINISHED, you can close Zadig, that takes care of the first software program, on to the last.
Installing AVRDUDE (The second program)
For the last software program, you will install AVRDUDE 6.0.1. This is the program that will take the actual firmware files from ToyKeeper and flash them into the driver board inside the head of the Emisar D4V2.
The AVRDUDE installation file from Hank is located at my Mediafire account (it’s like Dropbox):
Download link: http://www.mediafire.com/folder/ikdiocyfn20zg/Hank-Files
Note, before installing, I would recommend removing any older version of AVRDUDE. Un-install any old versions, then reboot computer. People have reported that old versions can interfere with the new version working properly.
Also, before installation, I would recommend making an installation folder in one of your root drives. Don’t let Windows 10 pick the destination folder. If you do, it will still work, but later you will have to navigate the command line interface to a lengthy file path. If you keep the installation folder in the root drive, it also makes it easier to add ToyKeeper’s firmware files later.
In my case, I created a folder AVRDUDE in the C drive, and did NOT choose the Windows default path.
Install the program and accept the default prompts during installation. Once installed, the actual program name is MHV AVR Tools. When installation is complete, you should see something like this in your installation folder.
Downloading Flash Files
Now that the program is installed, we need to place ToyKeeper’s latest flash file (.hex) in the same folder. Most of you will download the first file below (non Nichia file). If your D4V2 was ordered with the Nichia emitter (like mine), you will use the Nichia hex file.
ToyKeeper download link for the non Nichia option (what most will use):
ToyKeeper download link for the Nichia emitter option:
Note: a list of Toykeeper's latest files can be found here (which may be newer): http://toykeeper.net/torches/fsm/
After downloading the single appropriate file for your light, place that file in the folder where you installed AVRDUDE. In this example, I renamed my flash files to something simple.
Opening A Command Line Window
Now, we are going to open a command line window. You can right click on the Windows icon in the lower left bottom of your desktop, then choose run. Then type cmd and then OK.
Note, if for any reason your computer requires admin rights for the command line window, then enter:
runas /user:Administrator cmd
This will bring up the command line window. You might see a default path like this: C:\Users\yourname>
We will need to change the command line path to the AVRDUDE installation folder. First, you can type CD \ which will change the command line to the root drive, in this case the C drive.
Next, using my computer as an example, I typed cd avrdude which puts the command line in my installation folder. “cd” means change directory.
Testing The AVRDUDE Installation
Next, you will type avrdude then enter, and you should get the following response:
This response above tells us that AVRDUDE installed correctly, and can be executed.
Note, it’s possible (not required) to create a command line shortcut to your installation folder. This will keep you from having to navigate to the correct folder eveytime you open up the command line interface. Instructions for that are at the end of this post.
Testing Communication To The D4V2
Next we are going to test everything (hardware/software) to see if we can initialize the D4V2 driver board. If we can, it means that everything has been successful so far. Cut and paste this string into the command line, but DO NOT ENTER THIS COMMAND YET.
avrdude -p t1634 -c usbasp -n
Carefully place the six pogo pins on the D4V2's six flash pads and hold them there. Make sure all six pins are aligned properly to the pads.
NOW you can enter the command. If everything is working, you should get this response (ignore any sck period errors):
If above is what you got, then both hardware and software are working properly, and communication has been established between your computer and the D4V2 driver board. The final step should now be problem free.
Flashing The New Firmware (the final step)
You’re almost finished. Now we are going to flash the actual firmware file to the D4V2. In the command below, replace FILENAME with the actual file name. It may be ToyKeeper’s default file name emisar-d4v2.hex or something else if you renamed it. Remember, there are two files to choose from (a separate file for the Nichia option). Again, the single firmware file should already be in the AVRDUDE installation folder.
Cut/paste the following command, BUT DON’T ENTER IT YET.
avrdude -c usbasp -p t1634 -u -Uflash:w:FILENAME.hex
You are once again going to hold the six pogo pins against the flash pads on the D4V2. Get your hand comfortable enough to keep the pins securely against the pads for about 15 seconds. THEN, enter the command above. The flash process should take about 10-15 seconds.
You should see the following if you’re successful (ignore sck period errors). Note, Hank has reported that he intentionally broke the connection during the reflashing process, to see what would happen. Even though the flashlight no longer worked, he could still reflash again, and everything was OK. In other words, you shouldn't be able to brick the light.
Note, if you receive a verification error, then try again. This may be due to the pogo pins moving during the flash process. Happened once to me.
Congratulations you just flashed your D4V2.
Note that all previous custom configurations are lost when reflashing (including thermal settings).
Per the advice from ToyKeeper, it's a good idea to perform a factory reset:
“after doing the reflash, it’s a good idea to do a factory reset. Let the light settle to room temperature, then hold the button while tightening the tailcap to connect power. Then keep holding for ~3 seconds until it does a bright flash. After that, the temperature sensor should be calibrated and the light is ready to use.”
You can create a command-line shortcut on your desktop that will take you directly to the avrdude installation folder. Right click on a blank spot on your Windows desktop, the select new/shortcut. Enter the following into the “location of the item” box. Change the end of the string below to your installation folder.
%windir%\system32\cmd.exe /k cd C:\arvdude
If by chance you damage your USBasp board, you can order one from Amazon – this is the one I used, so it’s confirmed to work. It also looks identical to the one used by Hank. It also has a nice pin-out diagram. https://www.amazon.com/gp/product/B00AX4WQ00/
Or, as an alternative, this one was recommended by ToyKeeper (from Fasttech).
If you prefer Aliexpress, I've also tested and confirmed this one works:
(1) BLF member Owen contributed ideas on the formatting of this post.
One person on reddit could not get AVRDUDE to recognize the t1634 chip until he accessed the command line via the MHV AVR Shell. This is accessed through the list of Windows programs (click on Windows icon on bottom lower left of desktop). This is an alternate way to open up the command line window.