September 26, 2024

Biscotti firmware -- trouble, part 3

Another day, another episode of "trouble".

I am reflecting on what works and what doesn't work, as follows:

Last night I was contemplating that with light 1, moonlight does not work, but when I bump to other modes it all does work. I was trying to figure out some theory based on improper initialization for mode 1, but after bumping to mode 2, things were properly initialized.

And I thought about the DIP on the breadboard. The pulses all look fine, but there is no "load" on the PWM pin. A real flashlight has eight 7135 devices hung on that pin. I tried my first experiment. I found a 260 ohm resistor and put it on pin 6 to ground. With 5 volts this should pull 19 mA. The pins on the ATtiny13 are supposed to source or sink 20 mA. I still see a decent 5 volt pulse with this load on the pin.

Maybe it isn't about some initialization issue with the first mode like I was thinking last night. An experiment would be to replace the usual PWM sequence of 1,7,15, ... with 1, 1, 2, 4, 7, ... as follows:

PROGMEM const uint8_t pwm_values[]  = { 0, 1, 1, 2, 4, 7, 15, 32 };

I know that the PWM value of "7" works. Maybe "1" is just too fast for this light. Will "1" work as the second level after a bump? Will levels 2 or 4 work? I do this experiment. What I see now is that I have to go all the way to 15 to get the light to work. I'll swear that it used to work at 7. I solder a tiny wire onto pin 6 and look at things with the scope:

level 1 (1/255) 440 ns pulse, 1.0 volts
level 2 (2/255) 660 ns pulse, 1.0 volts
level 4 (4/255) 1100 ns pulse, 2.0 volts
level 7 (7/255) 1700 ns pulse, 4.0 volts -- LED not on
level 15 (15/255) 3400 ns pulse, 5.0 volts -- LED on
The 1700 ns pulse only climbs to 4.0 volts at the end of a ramp from 1.0 volts.

The 3400 ns pulse is only at 5.0 volts for the last 1100 ns. The first 1300 are spent ramping up to 5.0 volts.

There is no ramp-down. The pulse ends abruptly.

Try another flashlight

For no real reason, I select an S3 light I have. This is built differently than the S2+. I have notes on this elsewhere, but it has the same driver board, so that is of no relevance to this discussion. Suffice it to say that I burn the new firmware into this and it works first time with no problems.

Spare driver boards

I ordered three of these.
17mm AMC7135 x 12 x 10 x 8 x 3 Driver 2 Group 8 mode 3 / 5 modes
7135 chips Flashlight Drive Board Mode Memory Anti-reverse
I chose the second option with eight 7135. The first option had three 7135, but only one brightness, so they are giving you no ATtiny, just three 7135 wired on all the time. Cost for three boards was $3.10 each and $3.42 shipping.

Other ideas

I decided to use my hot air station to pull some of the 7135 devices off of this driver board. I pulled all 4 devices from the side of the board with the ATtiny, leaving just the 4 on the "spring" side of the board. While I was at it, I replaced the ATtiny with a freshly burned device.

Nothing worked. I pulled the ATtiny off and verified it -- I thought perhaps the heat of soldering might have damaged it. It seems OK, at least it responds properly to the usbASP.

Back on the board it goes again. This time I don't solder the LED wires yet. I just power it up and look at pin 6 with the oscilloscope. Nothing. Vcc on the chip looks good, as does the nominal 1 volt signal on pin 7.

Measuring pin 6 to ground gets 1.0 ohm. That is not good. I see it. A solder bridge to ground from when I removed one of the 7135. I measure 96K to ground after clearing this. Now the scope shows the runt 1 volt pulses on pin 6.

What next? Why not start pulling the remaining 7135 from the "spring side" of the board? I can pull first 2, then see if that removes a bad chip or not -- in a divide and conquer strategy.

Once I reduce the light to 2 chips, I see nice 5 volt pulses. I try adding first one, then another 7135 from the first batch of 4 I removed. Each time I add one, the pulses drop to the 1 volt runt level. And now, after trying 3 chips, I go back to the two that once gave me 5 volt pulses and I am now seeing runts.

Now with 0 chips (no 7135 on the board) I am seeing nice 5 volt pulses. I put one more back and again, runt pulses. I should have stopped and called it good when I had 2 working 7135 in place! Note that I am trying different 7135 each time. Did they all get damaged?

As a final test, with that one 7135 soldered on the board, I take a wire, touch one end to Vcc, the other to pin 6 and the LED comes on (with a constant 350 mA drive). So the 7135 is basically functional.

What next?

It is just light #2 that is giving me all this trouble. Light 1 and 3 both just worked immediately as they should have. I suspect that I abused light 2 back in 2019 when I first fiddled with it. I have replacement driver boards on order. I should stop wasting time, reflash some other lights I have waiting for that, and swap in a whole new driver board when they arrive.
Feedback? Questions? Drop me a line!

Tom's Light Info / [email protected]