NLITE, a free firmware for NANJG drivers

This is an awesome help for a LOT of people out there Dr. TY :-)

Nice selection.
I had the kaidomain clone from KD which had a star to disable memory and thought why is that not the standard?

Could you please add a description which star is #1, 2….,?

awesome work DrJones, this is a very handy resource!

Oh man, I can't find enough free time to play with this :(

DrJones,

thank you very much for your effort and for sharing it with us.

This driver was the reason for me to just buy an isp programmer and a soic clamp, finally.
I read the perfect modes thread more than once and even downloaded some files… but it’s all way above my head.

But now there’s a chance for usable results and then, who knows where curiosity might yet lead me.

Again, thank you.

BTW, the latest QLITE Rev A drivers that I got in from I-O don’t seem to have any lock bits set. I have not tried reading/re-writing the firmware on them, but it should be doable.

great drJones!!! thank you very much!!! :slight_smile:

How do you know that it doesn’t have lock bits set if you didn’t tried reding it :slight_smile:

I read the lock bits and the fuse bits. I didn’t try reading and re-loading the firmware (didn’t want to muck it up if it didn’t work).

If I only know how to do that I would backup genuine SW immediately (also if I had new Qlite) :smiley:
so, in the name of BLF progress please do download that SW :stuck_out_tongue:
Thank you and God bless you :bigsmile:

+1

Thanks Dr. Jones!

BTW, is there any danger in flashing the driver in the assembled flashlight (with the LED connected to driver)?

I do it all the time. Note that if the star connected to pin 5 of the processor is connected you cannot flash the firmware.

Noted, thanks!

I just wanted to take a second to thank you for this! Even though I program my own drivers, this is actually a great option for some hunting lights that I will be building for friends. This will give me the ability to provide them with 4 brightness options with no memory (when out in the woods on a dark morning, moonlight is a great mode to always start on). If later they want to add memory and get rid of moonlight, I won't need to remove the driver and reflash it.

Does this still retain the low-voltage detection?

I've had a hard time setting a moonlight mode on my drivers, especially with that high of PWM frequency. It does vary per LED type, so it was always trial and error until I got the PWM level right. We'll see how this works with an XM-L2.

I'm glad it proves useful :)

Yes, it has low-battery stepdown at 3V under load, like most of my drivers.

Thanks DrJones!

This setup is really great - much better than standard Nanjg. Bit selection is much better instead of 3 predetermined groups prepared by programmer.

By no memory, you mean it will reset back to mode 1 after use, right? What criteria do you use for the memory reset?

Yes, returns to mode 1 after a mode was used for >1s (on-time memory).

Hey DrJones,

About to program this firmware, and I noticed you said PWM is 18kHz. I assume that's using Fast PWM then considering a low fuse of 75 would be running at 4.8MHz, so 4.8MHz/256 = 18,750? Is that correct?

When writing programs before I never paid attention to the PWM mode and used code for the PWM setup from luxdrv and previously from Tido's program. Those both use Phase Correct PWM (TCCR0A=0b00100001). That would be 9.4kHz (4.8/510), which is what I program my lights at. I like this frequency because it's plenty fast, but you can still set PWM levels that somewhat correspond to their output (128 is ~1/2 output, and a value of 4 is usually where it first causes the LED to emit light).

When I tried a ~19kHz frequency by bumping the clock to 9.6MHz (wasn't aware of Fast PWM) I really had to push those PWM values up to the point of having to guess. Does Fast PWM change this, or are you still having to bump up your moonlight value quite a bit?

Also, the prescale factor (N in the frequency equations), I assume that's used just to tweak the PWM frequency? I wouldn't mind something like a ~4.7kHz PWM with the clock at 9.6MHz and a prescale of 8 (or just done by dividing the clock by 8 via the low fuse).

Thanks for reading my ramblings if you made it this far :)

- Jon

Yes, I use fastPWM at 4.8MHz, and it needs pushed up PWM values, too; the value 8 works in all my lights I tested it with, sometimes 7 is fine, too. Timer prescaler is always 1 in my firmwares.

9.6MHz with /8 timer prescaler is what the standard NANJG firmware uses, if I remember correctly.