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 :)
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.
It will work with any NANJG 105C driver, well, as long as it doesn't have the fuses locked (I have yet to experience one that does though). You just need to remove the driver to have access to the MCU for programming.
Could someone go through the procedure, and list all the necessary hardware needed to do this? I tried to plow through the main thread but got lost pretty quickly.
I recommend this programmer and an SOIC clip from ebay with attached leads. You'll need to figure out which leads go where, but that's listed in the wiki page. I followed this guide for installing AVRDUDE for doing the flashing.
The other option is to send a 105C to me or anyone else willing to do it, I just charge the cost of return shipping (or you can include a return envelope with stamps). I have some extra 105C's as well, so we could do it that way too.
EDIT: I actually just submitted a product request to FastTech to see if they can carry the SOIC clips and cables.
For some strange reason i can’t get this thing working!
Let’s go chronologically:
1- yesterday I uploaded Tido’s BLF-VLD code with Fixed Modes and it worked (command to do that from flashlightWiki/AVR)
2- then I uploaded NLITE but nothing changed, driver has same behaviour like with “Fixed Modes”
3- like comfychair suggested, I created new folder with nlite.hex I also made 3 bat files here: run cmd.bat with cmd command to open cmd prompt with desired folder path, check.bat with avrdude -p t13 -c usbasp -n command to be able to check if there is proper connection between programmer and driver just by typing check in cmd and flash.bat with this: avrdude -p t13 -c usbasp -u -Uflash:w:nlite.hex:a -Ulfuse:w:0x79:m -Uhfuse:w:0xed:m
using this bat files I uploaded nlite.hex to drive again and it doesn’t work :quest: not a blink from the LED …
4- I used this command then: +avrdude -p t13 -c usbasp e+ which is supposed to do a chip erase. Just to check, connected batt, doesn’t work> OK, chip is erased
5- Now I went to step 3, following same procedure I uploaded nlite.hex, connected batt -> doesn’t work :exmark:
6- Uploaded again Tido’s Fixed Modes code -> it works (with fixed modes UI of course)…
downloaded nlite.hex again, retyped also changed the fuse setings according to DrJones recommendations to: low: 0x75, high: 0xFF
and it works thanks
Now, to solve “*.elf: No such file” error in AVR studio 4
I have no idea, I just pasted that from DrJones website but I am not sure that this was the problem because if I hit F3 in total commander it displays file in ASCII and everything looks fine!