LED drivers and Accessories you want, but don’t exist

You need 5 wires to flash. (power, ground, miso, mosi, sck) You're soldering them all by hand? Wow.

At some point it would probably be worth drawing a flashing board, that just connects via headers to the chip. It's got to be faster to just reflow it. Of course that requires work too.

Well, shoot only $85:

https://www.amazon.com/QFN-16BT-0-65-01-Programming-Adapter-Socket-Enplas/dp/B00KG7T8PU

So this is a buck driver?

If this works it would be nice to try to get one with Narsil

Also thought about a driver with a slave board to get more useful space

To solder and unsolder 5 wires for programming takes a minute, nothing wrong for a small to medium number of drivers

I don’t need the reset pin to flash?

It’s a 1S boost board.

oh, yeah, forgot reset. Yes you need that too. 6 pins.

So for testing it's actually possible to flash with debug wire, using only 3 pins. Two of those are power and ground. One is reset. So you could solder a wire to just reset on the board if you leave a small pad.

BUT, that uses debugwire, you'll have to flash fuses for that first anyway, and those fuses disable power-down sleep, which means OTSM won't work, so, so much for testing really. Could be useful for rapid e-switch testing, but not a very viable all around replacement.

Hey you still never told me what Vcc is powered by or I didn't understand. I need that to figure out LVP.

Just look at the PM, I sent you a picture. If it’s too small, open in new tab. LVP should be 3V or 2.9V.

Just simpler to ask. Ok. So that's a bit of trouble.

No time to explain right now, probably it will require LVP set at 3.1V, or high enough for tolerance to stay above the LDO. I'll explain later. OTSM has constraints on LVP and this doesn't fit the usual solutions very ideally.

So a little more detail. The issue is that to use the divider for LVP, the divider voltage must be kept above about 1.8V, (brushing over the details) to prevent off-click detection. To do that you need a high voltage reference to compare the voltage pin to. A 5.0V LDO on Vcc works well for that. 3.0V doesn't work as , more on that in a bit.

So for 1S builds, instead HD reads voltage from Vcc. But in that mode it's actually reading the battery voltage from Vcc, not some regulated LDO voltage. There are only two pins where the battery voltage can be read as a higher value than the internal reference used, those are Vcc and PB0 (only Vcc presently implemented in software). So that works for 1S with no LDO.

Now back to your thing. You can use the first method, but the problem is the voltage reading stops working once the battery hits the LDO level, or possibly slightly higher (some dropout in the LDO, not sure how much). Once the battery starts dropping below the LDO the sense voltage on pin7 and the reference voltage on Vcc start to drop at the same speed and the ratio doesn't change, so you peg the bottom of the scale there.

a) So this could work, but you'll lose sensitivity somewhere above the LDO voltage and must set LVP above that. You will also probably need different resistor values for the divider.

b) One suggestion would be to instead provide battery voltage to Vcc. You only need the LDO for the voltage filter not for Vcc. However, I'm guessing the reason you aren't doing that is that you don't want to use a separate protection diode. Speaking of which, you better use an LDO with low reverse leakage. I think the ones used on the small TA boards have worked.

c) Another possibility is to find an LDO that will work at 2.5V, but there's another problem you're running up against. OTSM doesn't have as much extra headroom at low Vcc. 2.5V may not work well at all, and/or may require more attention to good hardware selection as far as the cap and the leakage of the LDO. It could work though. My specs are a bit overstated, and exactly so that things like that might just work.

d) Yet another possibility is to make a hybrid voltage readout. So that it uses both Vcc read and Vcc referenced divider read. Vcc read will remain constant until hitting the LDO voltage, then it will drop and you can get extra range from that. From a software perspective though that could be tricky, because the way bistro polls the ADC, changing references requires delays, and there's already a switch back and forth from voltage to temperature and some difficulty orchestrating the timing for that. That's not my favorite solution.

e) Yet another option is to use a separate pin with a separate voltage divider, but I'm pretty sure you have no space for that.

Thanks a ton Schoki!
Lexel, I know it’s too early for a definitive answer, but what do you think about making a run? :slight_smile:

Ooh, just had another option come to mind.

f) Send battery voltage direct to PB0. I don't think anyone has ever used this trick, but the "internal" or "inverted" read method can be used on PB0. This does cost an extra trace but doesn't cost a diode. Why? Because it's a high impedance pin, unlike Vcc. It shouldn't need reverse voltage protection. Still not a free solution solution though. We were already out of room for a second PWM trace as it was.

No, this is great! That should work. There’s enough space for that. It’s just around the MP3431, where’s nearly no room for anything more. But how does this work then?
Use the PB0 as voltage reference for the voltage divider? Is that possible, even if the PB0 voltage is higher than the Vcc voltage?

Ok, I better really double check my facts then. I'll post back. 90% sure right now.

Well shoot, kind of remembered I can't see how any pin can take more than Vcc, and... it can't. You can use a reference there, but it can't be higher than Vcc.

Ok, so what about sending, OTSM pin over to PB0, so divider voltage connects to both the OTSM pin and PB0? Or maybe it only needs to use PB0? Oh.. yes, I think that's true. Can do OTSM on PB0 and inverted reads at the same time on it! These little chips have so many tricks up their sleeves.

It’s just a few changes for me, so if you can do it, that would be awesome. But how does this work? How can it distinguish a low battery from a turn-off?

And how can I cancel an Oshpark order I already paid for?

Now that I can use 4 layers, maybe I can move some traces to the inner layers and have a little more space for other stuff. I won’t move that much though, vias need a lot of space as well, maybe even more than some 6mil traces.

Probably can't cancel. But you can build the board as-is and just set LVP kind of high for first testing. It will still work.

So I use LVP and OTSM on same pin normally for LDO lights, but that's 5.0V LDO with 2S batteries. The LDO never drops out then. Still the LDO is just the reference. The LVP is still on the OTSM pin. That's ok, so long as you can keep the voltage on the pin above 0.6*Vcc. Normally to run the ADC in the range from 0.6V Vcc to Vcc you need the reference to be high and constant, so a 5.0V LDO on Vcc works.

This plan is different. This is the one case where we can use a lower internal reference. The inverted read trick actually "reads" the reference voltage with the pin voltage (Vcc or Pb0) as the "reference". Then you divide the result. So that's another way the batt voltage can be left high on the OTSM pin and still be able to read it. The difference doing it on Vcc vs PB0 is on Vcc you can't use the OTSM reduced batt voltage for a couple of reasons (breaks the whole voltage separation and pin detection of OTSM) but on PB0 in this case you must use the OTSM voltage, and it's perfect.

Yes, all these voltage read restrictions and possibilities in general and especially for OTSM are dizzying.

So what you want to do with your voltage divider is aim for about 4Kohm total, and for a full battery, 4.2V to come down to exactly the LDO voltage.

By the way, I did notice a statement in the manual that says if the PB0 reference voltage is above Vcc-1.0, the ADC will get less accurate. So... not sure how bad that is. Might require more research. However it is specced up to Vcc. We don't need 10 bit precision.

GRR… drat drat drat. Still one more caveat I missed on that

:person_facepalming:

The external reference must be above 2.0V. Sigh. That still only gets you a dynamic range from 4.2V to 2.7V if your resistors are pretty perfect, assuming 3.0V max read (Vcc). I wonder what exactly happens at 1.9V?