Hi everyone,
I'm new to BLF, but have been a lurker over at CPF for many years. I recently signed up here after purchasing an FW3A, and then subsequently a D4V2 too - needless to say I've rediscovered the flashlight bug!
Whilst my FW3A was in transit, I noticed posts about the muggle mode bug in the FW3A firmware and set about finding out how the firmware is flashed on the FW3A. I couldn't find one single source of information, so I decided to pull together a post in a similar fashion to Terry Oregon's post on how to upgrade the firmware on a D4V2.
All comments, feedback & constructive criticism welcome :)
Tools Required
- Windows 7, 8.1 or 10 PC/Laptop with a spare USB-A port
- MHV AVR Tools which includes the application we will be using the flash the firmware, AVRDUDE (Get it from here: https://infernoembedded.com/products/avr-tools/release)
- Zadig, a tool used to automate the driver installation for the USBASP Programmer (Get it from here: https://zadig.akeo.ie/)
- Anduril FW3A Firmware (Get it from here: http://toykeeper.net/torches/fsm/, at the time of writing the latest version is anduril.2019-08-05.fw3a.hex for all FW3A/FW3C flashlights except those with a Nichia 219C emitter (e.g. XP-L, SST-20) and anduril.2019-08-05.fw3a-219.hex for those with a Nichia 219C emitter only.
- USBASP Programmer (This is the one I used: https://www.amazon.co.uk/dp/B071698194)
- SOIC Adapter (This is the one I used: https://www.amazon.co.uk/dp/B0713V5GGL)
- Dupont Wires (These are the ones I used: https://www.amazon.co.uk/dp/B01EV70C78/)
- Optional: A multi meter with a continuity test function
This guide assumes you know how the various parts of the FW3A (or FW3C) flashlight, know how to solder, and have already de-soldered the positive and negative wires from the MCPCB and removed the driver board. If there is enough interest in a how-to for this, I may well add this into the guide.
On the side of the driver board without the spring, you will find an ATtiny85 AVR Microcontroller, located here on the board with the corresponding pin locations:
(Credit to fritz15 for the image)
The pins on the ATTiny85 are assigned as follows:
- RESET
- INP
- INP
- GROUND
- MOSI
- MISO
- SCK
- VCC (+)
Next, look at your USBASP Programmer. It will have a 10-pin connector, typically found on the top-right hand side of the board or mounted horizontally on the right-hand end of the board. The pin locations are typically as follows, however if in doubt check the markings on the top or bottom of the board, or the manual that came with your USBASP Programmer:
The pins on the USBASP Programmer are assigned as follows:
- MOSI
- VCC (+)
- GROUND
- NC
- RESET
- GROUND
- SCK
- GROUND
- MISO
- GROUND
Next, look at your SOIC Adapter. Depending on your model, you will either have bare pins at the top of the clip, cables going from the male pins to an 8-pin connector, or cables going from the male pins and male or female Dupont connectors on the end. On my adapter, these pins are labelled 1 through 8, with the cable connecting to 1 on both ends designated with a red colour.
You may need to use a multi meter to find out which pin is which if there are no markings. If you have one of the SOIC Adapters with bare pins on the top of the clip, these are mapped straight down to the bottom of the connector.
For flashing the FW3A (or FW3C) firmware, we are interested in the pins for MOSI, VCC (+), RESET, SCK, MISO and GROUND.
In order to make things simpler for myself, I’ve always stuck with the same pin/wire colour combination:
MOSI: Blue
VCC (+): Orange
RESET: Purple
SCK: Yellow
MISO: Green
GROUND: Grey
Next, using your Dupont wires, wire up the USBASP Programmer, SOIC Adapter and ATTiny85 microcontroller as follows:
This is all the wiring complete. Do not connect the SOIC connector to the ATtiny85 just yet.
Note: There is another fantastic guide to installing the USBASP Programmer driver and AVRDUDE written by Terry Oregon which covers many of the same steps I cover below but more in-depth, if you get stuck with my instructions you can find Terry’s guide here: https://budgetlightforum.com/t/-/57807
On your Windows machine, plug in the USBASP Programmer to a spare USB-A port, and then run Zadig from the folder you downloaded it to.
In the top menu, click Options and then select List All Devices. In the drop-down list, you should see USBasp. Select it.
You will see a window like this; however, you should see ‘None’ in the Driver field, and the ‘Reinstall Driver’ button should say ‘Install Driver’:
From the Driver field on the right, scroll down using the buttons until libusbK is selected, then click Install Driver.
The installation will take around a minute, after this has completed you can close Zadig.
Next, create the directory C:\AVRDUDE on your Windows machine, then launch the MHV AVR Tools installer from the folder you downloaded it to.
On the first screen of the Setup Wizard, click Next, and then click I Agree on the License Agreement page.
On the Choose Install Location page, click Browse…
Back on the Choose Install Location screen, click Next
On the Choose Components page, leave the defaults and click Next
The installer will now install MHV AVR Tools in C:\AVRDUDE. Once the installer completes, click Finish to close the installer.
Next, copy the FW3A firmware file from the folder you downloaded it to, to the C:\AVRDUDE\MHV AVR Tools\bin directory.
Open a Command Prompt as an Administrator (right-click on the Command Prompt icon, then select Run as administrator)
Change directory to C:\AVRDUDE\MHV AVR Tools\bin by using the command "cd 'C:\AVRDUDE\MHV AVR Tools\bin'" (without double quotes) and then hitting enter.
Now, connect the SOIC Adapter to the ATtiny85 microcontroller, ensuring that the adapter is in the correct orientation so that the pins are in the correct order.
Back in the Command Prompt Window, run the command "avrdude -p t85 -c usbasp -n" (without double quotes). If your wiring is correct and the SOIC adapter is connected correctly, you will see an output like the following:
C:\AVRDUDE\MHV AVR Tools\bin>avrdude -p t85 -c usbasp -n
avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.01s
avrdude: Device signature = 0x1e930b
avrdude: safemode: Fuses OK (H:FF, E:DE, L:E2)
avrdude done. Thank you.
If the above test passes, you are ready to flash your FW3A (or FW3C) with the latest firmware.
At the same Command Prompt you ran the previous test in, run the command "avrdude -p t85 -c usbasp -Uflash:w:anduril.2019-08-05.fw3a.hex" (without double quotes), replacing anduril.2019-08-05.fw3a.hex with the name of your firmware file.
You will then see an output like the following:
C:\AVRDUDE\MHV AVR Tools\bin>avrdude -p t85 -c usbasp -Uflash:w:anduril.2019-08-05.fw3a.hex
avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.01s
avrdude: Device signature = 0x1e930b
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: reading input file "anduril.2019-08-05.fw3a.hex"
avrdude: input file anduril.2019-08-05.fw3a.hex auto detected as Intel Hex
avrdude: writing flash (7760 bytes):
Writing | ################################################## | 100% 5.11s
avrdude: 7760 bytes of flash written
avrdude: verifying flash memory against anduril.2019-08-05.fw3a.hex:
avrdude: load data flash data from input file anduril.2019-08-05.fw3a.hex:
avrdude: input file anduril.2019-08-05.fw3a.hex auto detected as Intel Hex
avrdude: input file anduril.2019-08-05.fw3a.hex contains 7760 bytes
avrdude: reading on-chip flash data:
Reading | ################################################## | 100% 4.18s
avrdude: verifying ...
avrdude: 7760 bytes of flash verified
avrdude: safemode: Fuses OK (H:FF, E:DE, L:E2)
avrdude done. Thank you.
You have now successfully flashed your FW3A (or FW3C)! You can now disconnect the SOIC Adapter from the ATtiny85 microcontroller and re-assemble your flashlight.
It is highly recommended to perform a factory reset on the flashlight following an update. You can do this by letting the flashlight settle to room temperature, then hold in the tail button whilst tightening the tail cap to connect power, whilst holding the tail button for around 3 seconds until the flashlight emits a bright flash. You can also perform a factory reset by doing 13 clicks from off.
I hope this has helped someone. If you run into any issues feel free to reply and I'll do my best to troubleshoot with you.
Thanks,
crgbt