Guide: how to flash ATtiny13a based drivers (NANJG, QLITE, etc.) with custom firmware

Check the pin assignment in the tkattiny.hex. RMM may have changed which pin controls the 7135 channel and the fet channel. I don’t know for sure but I do know that the TABistro version has different pin assignment than the original bistro. You’ll have to re compile the code to work with the MTN FET+1 circuit.

I wish I knew how to do what you are talking about! haha

Time pay someone to flash a driver for me I think…


I don’t think Richard has changed it as on the item page he links to TK’s website for people wanting to download the source code. You wouldn’t think he would link to it if it couldn’t work?

Sorry I cant help either. I know about as much as you do.

Fuses look OK, and that is a good catch - easy to semi-brick the MCU with the wrong fuses.

But code for a 13 will not run correctly on a 25. There are small differences in the setup registers. Mainly to set up the ADC and WDT IIRC. Time-dependent functions will also run a little faster than intended (8 MHz vs. 6.4 MHz).

There is a large thread on the subject:

So I thought that the issue was because I had left the extended fuse out which I didn’t realise as I was following the guide for a 13 which only has low and high fuses. So I have corrected that and added in the extended fuse however it has made no difference, the light is still doing weird things.

Also, I haven’t compiled anything. All I did was grab TK’s bistro.hex file from her flashlight firmware repository page and flashed that across. It says it’s for a 25 and has the fuses listed in the .c file.

Please see screengrab below. Is there anything I am doing wrong?

Try this instead. avrdude -c usbasp -p t25 -u -Uflash:w:bistro.hex:a -U lfuse:w:0xD2:m -U hfuse:w:0xDE:m -U efuse:w:0xff:m

Ah, missed that the code was for a 25. I do not see anything wrong on your flash log. I normally use E2 DE FF for the fuses, only difference is a more conservative startup time.

If you have a high-current light and/or long wires between the driver and the emitter, part of your problem may be MCU voltage overload due to inadvertent inductive boosting of the MCU’s power supply. The 25/45/85 seems to be more sensitive to this than the 13. Known problem and easy to fix if you are able to add a resistor to the driver (R5 in the linked schematic):

Have you tried bench testing the driver to make sure it’s actually the driver that is acting up and not a bad ground, flaky switch, etc?

OK almost give up. I am using usbtiny since that is what i have around from different project instead of usbasp but i always got connection error with “avrdude -p t13 -c usbtiny -n” I am sure i got wiring correctly. I’ll get a USBASP next maybe the programmer is the problem, i have been using usbtiny without problem for flashing atmel based brushless esc so why this could be a problem? the driver is ak-47

Update: i removed the attiny13 from the board with hot air solder and confirmed that each ISP pins connected properly to each attiny13 pins with multi-meter, not sure why it still doesnt work, still waiting for my usbasp though maybe this is the issue. Reflow the attiny back to the board and it still running with default firmware so the attiny13 is fine.


I don’t have any problems running cmd.exe from the run command after right-clicking on the windows icon on the toolbar. I can also create a desktop shortcut to run cmd.

This is on a Win10 Prof system but I’ve also done it on other Win10 versions. Perhaps I’m not understanding the issue?

The only way I have been able to flash drivers is by opening a command prompt from AVRDude folder. Yes I can open a command prompt as you explained but not from a folder. The folder command promt option was taken away with the latest windows update.

Usually when I flashed a driver I just open a command prompt and then cd to the directory where the files are. It’s also possible to create a bat or vbs file to do the same thing.

What do you do to cd a directory?

Open the command prompt.

Let’s say your command prompt opens up at “C:\Users\MRsDNF>”

And your AVRDude folder is located at “C:\Flashlights\AVRDude”

You would type “cd C:\Flashlights\AVRDude” without the inverted commas.

FmC’s instructions will get you to the right folder. You can also create a desktop shortcut that will automatically start cmd in the folder containing your files and will save you a minute or so by not having to change directories every time you want to flash something. To do so all you need to do is:

1. right-mouse down on an empty spot on the desktop and then click on New and then Shortcut from the menu that appears
2. enter cmd on the bar to the left of the Browse line
3. click Next
4. enter a name for your shortcut or accept the default

You’ll see a new icon on your desktop and then:

  1. right-mouse down on it and click on Properties at the bottom of the menu
  2. in the start-in box enter the name of the folder that you want cmd to start in
  3. click OK

When you double-click on the shortcut confirm that it is starting up in the folder that you want it to.

You guys are good. I owe you both a drink and a big thanks. I can use my main computer again to flash chips. Cheers. :beer:

The command line for flashing is in bin/ The command lines for compiling are in bin/ These might help.

About the driver not working, that’s probably a matter of calibration. RMM uses a .hex file calibrated for his hardware, but the .hex files in the repository are built for a variety of different hardware. A single .hex file can’t work on all different flavors of hardware, so you’ll usually need to calibrate and compile your own.

IIRC, the .hex file in the repository is calibrated for the BLF X6v2 production light, not for RMM’s driver. You’ll need to calibrate the voltage, OTC timings, and moon + ramp PWM values. The tools for this are in ToyKeeper/battcheck/* and bin/

Got the USBASP

Anyone have more ideas? i even confirm each tiny13 pins to corresponding pins at atmega8 chip on USBASP and all has good continuity and still i cant make thing work. I also shorted pin J3 to slow the clock still no go. I am running out of idea.