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

The best advice I can give you is to make absolutely sure your pins are connected in the right place,
The easiest for me was to use both devices pin out and match each wire to the appropriate location.
First find the pin out for the programmer, google has plenty of info like here. How use the ICSP port with the USBasp programmer under linux to burn the bootloader | Details | Hackaday.io

Then find the pinout for the attiny85, usually found in the datasheet or do a google search for “attiny85 pinout”. https://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-2586-AVR-8-bit-Microcontroller-ATtiny25-ATtiny45-ATtiny85_Datasheet.pdf

Find pin 1 on the programmer (MOSI marked with a triangle) and match that to the attiny85 MOSI pin (using the notch or dot as the reference to pin locations). Do this for the other 5 connections. Run the avrdude connection test if you get a error, check your wiring again very carefully using both device pinouts. It’s almost always in the wiring.

13a 25 and 85 all have the same pins

What command are you using to flash?

You were right. It was the wiring. Two of the pins were shorting where I connected them to my clip. All sorted and Anduril flashed! Now to wait for my D4S to arrive!

I’m running into a problem I haven’t seen before. In the past I have successfully flashed FW to attiny13 and attiny25 using a different computer (windows 8 I think). Now I’m using a windows 10 computer with the same flashing hardware as before. I’m trying to flash crescendo on a attiny25, but first I’m flashing battcheck-25 to get the voltage readings correct.

It seems to be connected properly.

Then when I go to flash the battcheck hex I get a verification at the end, “verification error, first mismatch at byte 0x0000
0xdf != 0xff”

The hex did not seem to be properly flashed, and this error seems to have bricked the chip. I can’t connect to the chip anymore. I tried the process again on another attiny25 not connected to a driver and the same thing happened. Does anyone know how to fix it? Thanks for any help.

EasyB: I haven’t run into this error, but I’d double check what fuses you’re trying to flash.

In TK’s T25 fuses flash script, she uses L:0xD2, H:0xDF, E:0xFF

Using this Fuses Calculator, going from 0xDF to 0xFF for the High fuse would disable SPI (serial programming and data downloading). I really don’t think you want to do that!

Edit: the fuse settings you have are appropriate for the T13A. Careful there, cowboy! I’m sure you know this, but fuse settings can’t be used outside of the same chip family. T13A is a different family than T25. Now T25, T45, and T85 - those are all the same family, so the fuses are the same.

Thanks, I used those fuses and it seemed to flash successfully. I don’t remember using different fuses for 13 and 25 when I did it years ago so I didn’t think to look very carefully at them. Lesson learned. :person_facepalming:

I got round to flash Anduril onto my D4S and I think I bricked it.
I just simply copied the command from the first post without reading more about it and now I wish I did…
That’s what I did. Now after pressing the button only aux LEDs blink in low mode.

Can I still resque it or do I have to replace ATTiny on the driver?

Forgive me if that’s something obvious but I’m really not too educated on this stuff…

It may need to have the attiny replaced. The fuse values shown were for a different chip, and it may have put the attiny85 into a locked or otherwise unflashable state. :frowning:

Is one of the required softwares Amtel studio 7? Guessing that is the latest version.

If you’re using Windows and want to use a graphical interface, then yes… AS7

Good, just trying to get my ducks in a row. I have the equipment in my cart at fasttech a/w the 20% discount sitewide which starts tomorrow. Looks like it may be quite the task but I’m going to give the Anduril flash a try.

So i set everything up. USB drivers, AS7 and AVR Tools. Programmer is connected with the SOIC clip. And now i am searching for the right files to update my FW3A with toykeepers new version.
I read somewhere that the temp controll was written almost completly new. This is the part that interests me most.
Can someone give me a hint which one it is?

So read a bit and looked into toykeepers files that can be found on launchpad.
Please correct me if i am wrong. There is the Anduril.c file (a “universal version”). With the .cfg file i change/turn on funktions for the specific driver. But where do i define the driver hardware?
In the config file i find a hint to a hwdef-xxx.h file. But can not find it. Can someone help me out a bit. Or if this was asked in the past and there is a post for it i would be thankfull for a link.
In the past i used ready hex files for flashing (and it is a long time ago). I can not code (only SPS and a bit of basic from 25years ago) but i can see that TK invested a lot of time to give us a very modular system.

You have to load the entire FSM project into AS7, not just the anduril.c file. Unfortunately you have to setup the project yourself as TK developes in Linux, so a AS project doesn’t exist. I believe you can get a now outdated AS project file from zeroflow but there’s so many changes you’ll have to reset it all up anyway so may as well start from scratch on your own machine.

The hw config files (as well as the rest of the necessary includes) are in the FSM branch (back one from the anduril branch)

I am using as7 and I did it like this:

Go to ToyKeeper folder and download all hwdef-.h and tk-.h

Then go to spaghetti-monster folder and download all fsm-.h, all fsm-.c and spaghetti-monster.h

Then go to anduril folder and download all cfg-*.h files

Then create new project for attiny85.
ctrl+c all text from anduril.c and ctrl+v into main.c in your new created project (you must, of course, delete what is there).

In as7: file>open>file> tk-attiny.h and add this:
#define ATTINY 85

In main.c chose your cfg-*.h file which you need. Its on the begginig.

And remember about this:

It’s works. For me.

Thanks guys! I totally missed the page with the hwdef and tk files. Now it is making a bit more sense. Tomorrow i will have a look into the files and try to make a bit more sense of it.
And if i fail to understand how its working i simply follow your stepps Chatika vas Paus.

Very true.

It’s not usually a good idea to download individual files. Get the whole repository instead, to make sure all the files are the same version. Mismatched versions can cause all sorts of problems.

If you have bzr, it should only require running “bzr branch lp:flashlight-firmware” or “bzr branch lp:~toykeeper/flashlight-firmware/fsm” to get everything.

But if you don’t have bzr (it has issues on Windows), there’s still a reasonably easy way to do it:

  1. Go to Flashlight Firmware Repository in Launchpad
  2. Click “Code”
  3. Click the branch you want
  4. Click the first number under “Recent revisions”
  5. Click “download tarball”
  6. Unzip the tarball file

This should get you everything in the repository, with the directory structures still intact.

On a suitable command-line-based interface, the code can then be built by going into the anduril directory and running “make”. This compiles one .hex file for each cfg-*.h file it finds. So, you should be able to edit a cfg file or make a new one, and it’ll then be included in the full set of builds.

That doesn’t work in Atmel Studio though… in that, it’ll probably be easier to just uncomment the line at the top of anduril.c which specifies which config file to use.

I downloaded the tarball file. But when i go into the directory and run make i get this response

It probably only works on unix-like systems with a bourne shell and the compilers installed in the executable path. This can be done inside of Windows though, by using an Ubuntu container.

I also downloaded the tarball file. I didn’t even try to do it your way. If it’s not working for TheOnlyDocc, it will not work for me too. I don’t have much to do with linux, so I will stay with AS and I will compile everything by hand. And so I always delete BLINK_AT_RAMP_MIDDLE and change a few other things.
Btw. it seems to me that it doesn’t have to be included by default, but that’s just my preference.
In addition, the copied files also work on AS and you don’t have to download everything separately.