Emisar D4V2 Flash Kit Instructions (Official How To)

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 (v3.0.7.0)

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):

http://toykeeper.net/torches/fsm/anduril.2019-09-28.emisar-d4v2.hex

ToyKeeper download link for the Nichia emitter option:

http://toykeeper.net/torches/fsm/anduril.2019-09-28.emisar-d4v2-219.hex

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.”

Miscellaneous

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).

https://www.fasttech.com/product/1002900-atmega-attiny-51

(Update: Fasttech has gone out of business)

If you prefer Aliexpress, I've also tested and confirmed this one works:

https://www.aliexpress.com/item/32582933115

Credits:

(1) BLF member Owen contributed ideas on the formatting of this post.

Problem/solution:

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.

1 Thank

Android phone instructions from user ZozzV6. Unfortunately, I'm not aware of any equivalent for the iPhone.

photo courtesy of Hank:

Some Mac (OSX) instructions have been posted here by user f0xx

https://budgetlightforum.com/t/-/57807/34

Alternate Mac instructions by brewster:

https://budgetlightforum.com/t/-/57807/64

reserved

Great job!
Very easy to follow!

I’ve flashed my Q8’s and D4S using the procedure (minus the pins).

Your digest of downloads is a great help.

I had to uninstall my older copy of AVRDUDE (5.10) to get the updated one (6.0.1) to run with the “AVRDUDE” command.

Lemonade from lemons…I hope this “forced” programming key kit leads to at least a “mini-standard” for flashing chips. At least Emisar should design some of their future lights compatible with this new flash key. After the downloads/instructions…it really is super easy. Before the programming key, it was more of a fiddly-finger mess than technically complicated.

Thanks, I would ask for feedback, but meaningful feedback would require possession of the flash kit, which could be a couple of weeks from now, before they are shipped and received.

Thanks for making this.

For now, I’m just reserving a post for later. :wink:

Terry,

Would heatshrink fit around the top ends of the pogo pins to ensure they don’t connect, as well as remove any issues of conductive across fingers?

(Also if I get time I might throw your instructions into our documentation software at work; see if it can be “neatened” up, if you don’t mind).

heat shrink: Keep in mind, I don't actually have one of Hank's kits (I had built my own, with a different key-pcb from OHS PARK). The kits will work out-of-the box. Those pins are pretty small. Good luck with that.

I also would like to neaten it up. The draft was written in Microsoft Word. Problem is, a lot of the formatting in Word gets lost when you cut and paste to the forum post window. I think I spent a good 30 min trying to fix the formatting in my post here.

I will make the video version and also for the Android phone app. The phone section done.
Terry if you don’t mind I will link your first post to my video when I upload it.

I might grab one at some stage (when I get a D4v2) and see if heatshink works.

And totally get what you mean about formatting and the forum. I’ve almost got it neat in a PDF now, need to fine-tune it a bit.

Sure, this is a collaborative project.

Here is the video of Emisar D4V2 reflashing with OTG capable Android phone. Terry please add a ling to the video or this post in the OP. BTW I found much easier to do flashing on phone app then on PC :slight_smile:

The reflashing kits will be for sale on our site within this week, it will be tested before shipping.

Thank you for this excellent video. Doing the flashing with my phone looks much less intimidating than doing it with Windows. I think I can do it.

Wow, nice to see that flashing suddenly got a whole lot easier! I didn’t know there even was an android app. Thanks for all the effort!

I've added your instructions to the first "reserved" reply to my original post. This is exactly the kind of thing I'm looking for - collaboration. I've also added a note at the beginning of my original post:

Note, as these alternate instructions from other BLF members become available, I will add them to the reserved replies below this post.

I guess there's no iPhone equivalent?

Edit: ZozzV6, you might want to add a link to the Nichia version of ToyKeeper's hex file in the comments under your YouTube video.

http://toykeeper.net/torches/fsm/anduril.2019-07-18.emisar-d4v2-219.hex

I don’t know if there is iPhone version.
I added Nichia link to description.

The reflashing kits are for sale now.
https://intl-outdoor.com/emisar-d4v2-reflashing-kits-p-941.html

I’m not sure if we should offer the OTG adapter, if you already have the OTG adpater, please forget about it.

ok this time i need to learn how to flash :slight_smile:

im still using window 7 does it make much different? :open_mouth: