NLITE, a free firmware for NANJG drivers

103 posts / 0 new
Last post

Pages

DrJones
DrJones's picture
Offline
Last seen: 4 years 8 months ago
Joined: 01/05/2011 - 13:30
Posts: 1044
Location: Frankfurt, Germany
NLITE, a free firmware for NANJG drivers

Since you can't backup the original NANJG firmware (it's protected, you only get garbage if you try), you can't restore it's functionality if you flashed a new firmware to it (or messed up...). Here's a firmware that is somewhat similar (i.e. the mode group is selected by solder bridges between stars and the outer ring), but with more and different groups that seem to be needed more often (no blink modes).

2nd star chooses between 3-mode and 4-mode (i.e. if there's a moon mode or not),
3rd star chooses between low-to-high and high-to-low mode order,
4th star chooses between classic memory and no memory.
(and the 1st star of the NANJG is a dummy and not connected anyway.

Those options can be combined; that gives 8 mode groups (e.g. choose 2nd and 4th star for moon/low/med/high, no memory)

The levels are 5%-33%-100% and optionally a moon mode (a few milliamperes, depending on hardware variations like LED voltage).

It also has a PWM frequency of 18kHz, which is not visible and not audible (no whining noises), and it reduces brightness when the battery is low.

It is available for download as a hex file here (also there are more details).

 

Edited by: DrJones on 09/12/2014 - 03:34
_the_
_the_'s picture
Offline
Last seen: 1 day 11 hours ago
Joined: 07/08/2011 - 06:22
Posts: 3643
Location: Finland

Thanks!

I guess this would be a good option if my Qlites from IO happen to be normal NANJGs by accident..

=the=

 

zeremefico
zeremefico's picture
Offline
Last seen: 11 hours 2 min ago
Joined: 03/27/2012 - 02:44
Posts: 1367
Location: Greece

Thanks Dr!
Now I have to find win8 drivers for the soic flasher.

₪₪₪₪ ΟΥΔΕΝ ΚΡΥΠΤΟΝ ΥΠΟ ΤΟΝ ΗΛΙΟ ₪₪₪₪

My YouTube channel

Flashlights & edc gear

K40M F16

ryansoh3
ryansoh3's picture
Offline
Last seen: 4 months 3 weeks ago
Joined: 08/04/2012 - 08:21
Posts: 3890
Location: US

Thanks Dr. Jones. I can’t thank you enough for your support for this community. Smile

BLF ≠ B-grade Flashlight Forum

 

gords1001
gords1001's picture
Offline
Last seen: 2 years 7 months ago
Joined: 05/07/2012 - 14:02
Posts: 5276
Location: wigan england

I really need to get set up for driver programing, this set up would cover about 95% of my driver requirements.

Sirius9
Sirius9's picture
Offline
Last seen: 3 weeks 6 days ago
Joined: 03/04/2012 - 19:23
Posts: 4627
Location: South Europe

Thanks DrJones,

is it possible to set up just 1 (100%) mode?

 

MosesM
MosesM's picture
Offline
Last seen: 6 months 1 week ago
Joined: 06/28/2012 - 07:32
Posts: 160
Location: Singapore

Awesome, thanks so much Doc!

DrJones
DrJones's picture
Offline
Last seen: 4 years 8 months ago
Joined: 01/05/2011 - 13:30
Posts: 1044
Location: Frankfurt, Germany

Sirius9: Try luxdrv and set it to 1 mode only in the MODES line:
#define MODES 255

Ledsmoke
Ledsmoke's picture
Offline
Last seen: 6 months 2 weeks ago
Joined: 08/08/2011 - 16:05
Posts: 1995
Location: Denmark

This is an awesome help for a LOT of people out there Dr. TY Smile

~ Ledsmoke ~

Dutch humor:

[quote=djozz]

 I do not think that the BLF-community ben

Werner
Werner's picture
Offline
Last seen: 1 year 3 months ago
Joined: 10/19/2012 - 15:00
Posts: 3679
Location: Germany

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….,?

mattthemuppet
Offline
Last seen: 4 months 3 weeks ago
Joined: 01/04/2012 - 16:20
Posts: 1273
Location: WA

awesome work DrJones, this is a very handy resource!

Sirius9
Sirius9's picture
Offline
Last seen: 3 weeks 6 days ago
Joined: 03/04/2012 - 19:23
Posts: 4627
Location: South Europe

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

 

HarleyQuin
HarleyQuin's picture
Offline
Last seen: 1 month 3 weeks ago
Joined: 03/29/2013 - 04:47
Posts: 588

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.

Oshpark Boards:
HQ ProgKey: Universal Driver Programming Key . Boost: HQ 15mm/17mm programmable boost driver with ATtiny13A
46mm Triple-Channel: BLF SRK FET v3 . 17mm Linear: HQ10D / HQ4D / HQ4S . Contact Boards: 22/24/26mm

texaspyro
Offline
Last seen: 1 year 6 months ago
Joined: 04/29/2011 - 12:43
Posts: 4593

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.

georgek
Offline
Last seen: 6 years 11 months ago
Joined: 02/23/2013 - 08:36
Posts: 58
Location: Cyprus

great drJones!!!!! thank you very much!!!!! Smile

Sirius9
Sirius9's picture
Offline
Last seen: 3 weeks 6 days ago
Joined: 03/04/2012 - 19:23
Posts: 4627
Location: South Europe

texaspyro wrote:
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.

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

 

texaspyro
Offline
Last seen: 1 year 6 months ago
Joined: 04/29/2011 - 12:43
Posts: 4593
Sirius9 wrote:
How do you know that it doesn’t have lock bits set if you didn’t tried reding it 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).

Sirius9
Sirius9's picture
Offline
Last seen: 3 weeks 6 days ago
Joined: 03/04/2012 - 19:23
Posts: 4627
Location: South Europe

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

 

ImA4Wheelr
Offline
Last seen: 6 months 4 days ago
Joined: 02/03/2013 - 14:51
Posts: 7932
Location: SC

+1

AlexTG
Offline
Last seen: 4 years 6 days ago
Joined: 10/29/2012 - 08:40
Posts: 202
Location: Kiev, Ukraine

Thanks Dr. Jones!

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

texaspyro
Offline
Last seen: 1 year 6 months ago
Joined: 04/29/2011 - 12:43
Posts: 4593
AlexTG wrote:
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.

AlexTG
Offline
Last seen: 4 years 6 days ago
Joined: 10/29/2012 - 08:40
Posts: 202
Location: Kiev, Ukraine

texaspyro wrote:

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!
JonnyC
JonnyC's picture
Offline
Last seen: 5 months 4 days ago
Joined: 01/14/2011 - 19:12
Posts: 1147
Location: Green Bay, WI - USA

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.

DrJones
DrJones's picture
Offline
Last seen: 4 years 8 months ago
Joined: 01/05/2011 - 13:30
Posts: 1044
Location: Frankfurt, Germany

I'm glad it proves useful Smile

 

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

Pulsar13
Pulsar13's picture
Offline
Last seen: 1 month 3 weeks ago
Joined: 02/05/2012 - 10:23
Posts: 1909
Location: Malaysia

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?

DrJones
DrJones's picture
Offline
Last seen: 4 years 8 months ago
Joined: 01/05/2011 - 13:30
Posts: 1044
Location: Frankfurt, Germany

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

JonnyC
JonnyC's picture
Offline
Last seen: 5 months 4 days ago
Joined: 01/14/2011 - 19:12
Posts: 1147
Location: Green Bay, WI - USA

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 Smile

- Jon

DrJones
DrJones's picture
Offline
Last seen: 4 years 8 months ago
Joined: 01/05/2011 - 13:30
Posts: 1044
Location: Frankfurt, Germany

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.

 

 

JonnyC
JonnyC's picture
Offline
Last seen: 5 months 4 days ago
Joined: 01/14/2011 - 19:12
Posts: 1147
Location: Green Bay, WI - USA

Thanks for the response!

Sirius9
Sirius9's picture
Offline
Last seen: 3 weeks 6 days ago
Joined: 03/04/2012 - 19:23
Posts: 4627
Location: South Europe

OK, I started to play with this. It’s harder than it looks like :bigsmile:

 

JonnyC
JonnyC's picture
Offline
Last seen: 5 months 4 days ago
Joined: 01/14/2011 - 19:12
Posts: 1147
Location: Green Bay, WI - USA

Got this installed in a light last night with number 2 and 4 stars bridged for 4 modes with no memory.  Works awesome!  Thanks DrJones!

Pages