Programming and flashing nanjg. I just don't get it.

First off I am really thankful to all of you who help me started with creating my own perfect modes. (especially the people here in this thread )

but since recently I’ve reformatted my computer, I reinstall everything and reflash my hex files into the same test nanjg board, I am getting different results.

I am getting a brighter moonlight than I should
My strobe speeds are somewhat ridiculously slow blink beacon.
The binary values? I used to put it at around 7 for moonlight but now i had to put it below 4

I don’t know if I’m explaining well enough as I am not sure what to check.
One thing for sure is that things are way off and I couldn’t set my moonlight as it is either too bright when I put 4 or too dim when I put 3

I’m basing my firmware from toykeeper uv
my edited firmware
my low fuse is 0x75 and high fuse is 0xfd

Hi Power,

I am not the best person to offer suggestions, but I will mention one thing that caused a slow strobe for me. I had a board with dirty or bad traces on it that caused the strobe to go from very fast down to very slow.

I know you said the board your using was good before, but maybe try the firmware with a second driver and see if that changes anything.

Good lux.

don’t think that’s the cause of dirty contacts as they are basically digital data.

I manage to dig out clean new ones and they are giving me different strobe speeds but just a small change (like say 3Hz vs 4Hz difference)

Strobe isn’t my main concern here as it can be adjusted but the brightness couldn’t as they are bound by binary numbers and the steps between them is questioning my beginner knowledge.

I think it has something to do with fuses? I am not sure. I know setting correct phase PWM and fast PWM changes what the values does but that didn’t really help

Really appreciated that you tried helping me :slight_smile:
I hope cleaning it would help but sadly nothing changed

Did you have multiple revisions of the hex file and maybe lost the target file during the reinstall? Are you driving the same LED, with the same battery, in the same light? If there are changes in these 3 variables, your expected levels may be off. I use one common code train for most of my lights, but I do find that I have to make changes from build to build. Most of the changes revolve around moon light mode. I really like a nearly true ML mode and I find it to be the most challenge, every light I build has a ML mode, no questions asked.

Matt

How do you flash the firmware?
Just avrdude and simple text command? If test please post which command you use.
Toykeepers firmware can be changed in every point because he has published the sourcecode too. You need just to install avrstudio, make the changes needed and compile it to a new customized .hex file….


I personally use a graphic user interface for avrdude which is called avrburnomat:
http://burn-o-mat.net/AVR8_Burn-O-Mat_2_1_2_setup.exe
There is a window wher you can read out fuses or write them that made things a lot easier for me.

I can say I lost the edited hex file in my computer but I did back up the c file in my google drive (and used that)
It is in the same light, same battery and same LED/Driver
however I don’t remember the changes I did in this in cmd

avrdude -p t13 -c usbasp -u -Uflash:w:nlite.hex:a -Ulfuse:w:0x75:m -Uhfuse:w:0xFF:m

I remember I did change the -Uhfuse:w:0xFF:m to something like 0xfd but I am not getting any changes

I’m using atmel studio 7.0 to edit but avrdude and simple text command to flash nanjg

no idea how to use burn-o-mat though.
Maybe I can try

I am not sure where to go now… It sounds like something in the code definitely changed. I would adjust it to bring it back to your satisfaction and back it up. I may be wrong, but I do not think fuses would change the output on ML mode at all. But, fuses are something I really do not understand. I generally go with the coders suggested fuses and never look back. I do know that there is a fuse that locks the CPU, write protects it and it sounds like it can be recovered but is not a basic thing to do.

BTW, I never include blinkies, but having them in a second mode group might be fun… basic stuff like fan stopping and such. How does one change mode groups in that firmward? I have not tried that one.

Matt

What I meant when I said a dirty trace is that the PCB itself was damaged. An underlying electrical trace was too close to something and it was bleeding off to something else. I was thinking maybe some physical damage may have occurred to your test board so trying a second board that had not been touched might shed some light.

No problem with using the simple command line. Make sure you use the correct filename so you don’t flash the simple nlitefirmware instead of your file.
The fusesettings are okay, the change to FD does enable brown out detection which atmel recommends but isn’t necessary in most for firmwares,your particular linked firmware makes use of the brown out detection so you should flash the fuses FD and 75.
I never seen or used the UV code, so I can’t say anything about it. Does it really have a offtime memory without capacitor?


what can cause moonlight to be different…
1.The PWM value used in the sourcecode.
2.The total maximum current of the driver, because PWM only slices the maximum current in parts.
3.The used led can make a difference.

*she

The firmware is a fantastic no-memory that “used to” forget the current modes immediately. So I basically never reach the blinky unless I tap the switch my way there.
(memory reset speeds as good as tap to change mode, turn off and turn on would immediately reset to first mode)

Couldn’t do anything with that :frowning:

FD and 75? you mean the FD for high and 75 for low?

It does have offtime memory without additional capacitor. I would say more like a no-memory code.
similar to this code by alexvh