Knucklehead Buck Driver Discussion Thread

On the one hand it’s been said that the 2 sides of this board are completely separate, one doesn’t affect the other for all practical purposes and the MCU can be treated as usual. On the other hand, it’s been said that the PWM is the culprit, which means the MCU directly affects the regulator on the other side of the board.

So, someone will need to figure out what software to flash to the MCU in order to make them play nicely. All the code is beyond me as to if it fries, then quit!

I DO have patience, a necessary function with the physical medical issues I endure. I can fry a hundred of these, patiently doing the same thing (wrong) over and over and over. Yes, it will get frustrating, and I’ll assume I’ve done something wrong and try again and do the same set of parameters that I believe to be correct and fry another and another.

Yeah, I figured you’d been careful about all of that. If you want, you could just build a single-mode light. Leave out all the MCU-side components and only build the buck section. Assemble a light, such as the SF M3 head w/ 2x18650 body. Play around and use it, run batteries down, etc. It wouldn’t have any low voltage protection, so you’d have to be careful about that - the buck driver can keep an XM-L2 LED fully lit way past what’s safe for 2 cells so you’d have to time it. Once some more study has been done on the PWM you could go back and assemble the MCU side. Alternatively if you actually want a single-mode 4A light someone can whip up a single-mode firmware with no PWM and no low voltage warning, just low voltage protection (MCU goes to sleep and cuts off the LED2001 chip).

Once I receive my parts I’ll likely start with an extended test of the buck circuit alone to test the over-current and over-temp protection of the LED2001.

If we think PWM is the culprit for these fried LED2001’s I hope someone comes up with a good strategy for picking the correct PWM stuff. If nobody gets a better idea I suppose I could make an Arduino sketch to generate software PWM at a constant duty cycle (50% or something) but change the PWM freq according to an input such as buttons or a knob and display it on a little screen. I can hook that up to the PWM input on the LED2001 and… start really low then turn it up until it fries? That sounds like a sucky plan. I can also drag the oscilloscope out and hook it up across the outputs at the same time. Maybe something will change right before it fries. I don’t know what I’m doing there, I really hope someone with better insight will chime in before we get to the point where we are just trying settings and zapping chips.

Again, good work so far and I don’t see where you’ve done anything wrong.

The bicycle and the race car are EXACTLY the same!

Neither one gets far on flat tires.
Remove them both from terra firma for as little as 3 seconds and the re-introduction to Mother Earth can be quite catastrophic!
Both are susceptible to Black Rhino charges.
Neither handle well in the presence of beautiful women.
Doing stunts with either one to impress said beautiful women can turn expensive exquisitely tuned machinery into piles of rubble and simultaneously cause great grief to the operator.

Your points are all correct. I was simply trying to show Dale that we really cannot compare the LED2001 and AMC7135 chips, and should certainly not expect them to behave in the same manner with the same input.

More confusion stemmed from my comments sorry. When I say they are separate, it's from a hardware perspective. They are all clearly interconnected otherwise what's the point in having them lol. Each section serves another. What I was trying to show was how to trouble shoot the board to confirm there are no hardware faults. That worked, and we showed that the problems (at the time) were not hardware related.

I have a built Knucklehead. I just have not had time to find a firmware module for it yet. That being said I will try and find time (tonight after training hopefully) to get some firmware together. I don't have AVR studio installed, and believe it or not I've never actually compiled my own AVR firmware before so I may require a little bit of help.

Can someone who is a bit more proficient with code than me take DrJones' MiniDrv firmware and do the following:

1) Set PWM frequency to 200Hz (anything less than 500Hz really).

2) Add basic 2-cell low voltage protection; just shut off the device if the detected voltage falls below 6V.

3) Leave the modes as a simple low, medium, high. No memory.

4) Compile for ATtiny13A.

5) Provide the .hex and .eep files in this thread.

It's simple, it's slow and if we have problems with this then we need to look elsewhere for the issues.

The carbon fibre crash cell in an R18 Quattro will probably survive a harsh return to terra firma, and I reckon a Rhino would have a hard time getting through too ;)

Sorry Mattaus, I didn’t want to sound like I was disagreeing with you. Any questions I asked were not rhetorical, they were because I want to know! I’m mystified by the failures. Am I correct in saying that the buck driver should not be damaged by an open circuit condition?

1) I think we can use the prescaler to easily set PWM to 150Hz or 300Hz.
2) MiniDRV does not have LVP, would you consider JonnyC’s firmware ?
3) OK
4) OK
5) OK, don’t need EEP file though
x) do you want an e-switch firmware or a clicky one?

Don't worry, I know what you meant :) You are correct; with the built in features this IC has it should not be popping so easily. I'll try and read through the datasheet again today and see what's going on. Very frustrating!

Any firmware is fine. I just remembered the MiniDRV because it was so simple. Use whatever is easiest to setup. I'd use a clicky firmware because it's easier to operate on my 'test bench'. That and because the Knucklehead has no dedicated pad for an e-switch (I'll add one in any future revisions) I think soldering to an MCU pin, while usually trouble free, is not a good thing to be trying when we are problem solving. Doing it even slightly wrong could throw out any information we obtain in testing.

- Matt

Haven’t tested this yet. Use the regular low fuse (0x75). I will test it in a minute on a nangj 105c.

I set these things in addition to commenting out the turbo mode:

This should result in 3 modes, no turbo timeout, no memory, and 150Hz phase correct PWM.

http://photo.jesusthepirate.com/blf/Knucklhead/Knucklhead_Testing_Firmware_v001.c
http://photo.jesusthepirate.com/blf/Knucklhead/Knucklhead_Testing_Firmware_v001.hex

OK, cool. So will this implement low voltage shutdown and if so at what battery voltage?

EDIT: I don't have 2 of any protected cells. I just realised that pretty much every pair of batteries I have are IMR. I only have ONE protected battery lol. It doesn't really matter though. I'll check my battery voltages with my DMM after every test, and keep them all charged up as I go.

EDIT EDIT: Probably best to remove LVP all together actually. I'll leave the voltage divider empty on my circuit for these tests. So probably no need to change what you have done.

I also heard Dixie is really hard on them too

Good point. Does letting the ADC pin float make it read high / low / what? I’d just pull it to VCC to be sure, won’t hurt the pin and I know from the datasheet it will read the maximum value. FWIW I left the LVC settings stock in that firmware.

Still working on getting a 105c soldered up to flash, I’ve soldered something wrong on the harness.

I changed the values when I flashed the Qlite after burning up my last Knucklehead, and they almost exactly match the settings in that test UI. Save for any changes to the PWM that I am not educated to make.

The wiring harness/clip for the AVR Dude is a fun one. My very first, and I made it much more complicated than it needed to be, which is why of course that it got so frustrating. By the time I realized what I was doing to complicate it, I’d rewired it 3 times. Works well now, although a few times during the Knucklehead excursion the mcu was giving a code that wasn’t recognized. I had to pull the usb and plug it back in, reset it I guess, in order for it to go through.

I just don’t see how, with the light actually in working order, the regulator would blow after the fact. Twice. Because it WAS working and going through the modes just fine. Must’ve been stressing something awful, could have given it a sedative if it would have whined or complained…

I can help with the sedative. I cant help unfortunately with anything else. Chin up Dale. We are all rooting for you.

I just can’t get my stuff together over here. Can’t get avrdude and usbasp to play nicely. I don’t have a clip, but I have two harnesses. One is hooked up to a tiny13 on another project and works fine (12in harness). The other one, the one I’m trying to flash with the test firmware, just won’t work, gives this message:

That’s despite me resoldering the harness to two different ATtiny13’s (more than once) and shortening the harness down to 8in. I’ve reseated the USB connector for the USBASP many times, tried the command over and over, and it just won’t do right.

Your problem seems familiar but I can't quite remember in what way. Make damn absolutely sure you have the right chip, you are connected to the right pins, and that the programmer you are using is working, if at all possible. Help may be found easier in one of the threads dedicated to programming.

Make sure you compiled the .hex file for an ATiny13 instead of an ATiny13A, or vice versa.

I disconnected the clip, unplugged the usb device. Connected the chip again and gave it a bit of a squeeze to ensure it was seated (I always double/triple check when connecting it to the MCU to ensure all the pins are firmly against the tiny wires) and then I plugged in the usb again. Worked.

I usually flash the bare ATiny13A before putting it on the board, never have any trouble doing it that way.

Thanks DBCstm, removing the ATtiny13A from the circuit did the trick. I’d already stripped everything else off of the PCB except the ATtiny13A and the AMC7135’s.

Now to flash, put it back on a populated 105c, and see what happens… past my bedtime though, we’ll see how far I get.

What is this harness you speak of?

I use a clip…mine busted so I modded it a bit…I have to manually hold it on the chips and have my kid hit enter on the keyboard to start the flash process…uggh

I too am having a difficult time flashing the ATtiny’s soldered to the board…might start removing them to see if I can flash them THEN solder them down…uggh…and ALL of mine are on the boards now…bleh

WarHawk, don’t you have a small o-ring somewhere? Put it around the clip to act as the spring, it’ll hold the clip on the ATiny13A while you leisurely hit the keys yourself.

They should work when on the pcb, even while connected to an LED. The LED will flash multiple times when it’s done writing if you have it hooked up. :wink:

The harness is a 10 pin connector with a ribbon cable coming out of it… the ends are bare and I solder them to the legs on the chip. So it’s even more trouble than what you do now.

I have flashed the chip and put it on a 105c to test. It works. PWM seems slow, as expected/desired. 3 modes, as expected.