The BOD uses the 1.1V reference to know when the voltage drops too low. Much like we do LVP, except in hardware. So if the reference is wrong (anywhere from 1.0V to 1.2V is still within spec), the BOD is wrong too.
And to your second post, yes, that’s exactly what I think it means.
Ok, that makes sense. So I wonder is that really dominated by error in the internal reference or error in the hardware comparator? If it's mostly the reference itself, that factors into all the voltage measurements, but I'm not sure the comparator isn't a bigger factor.
I’m all about freeing up pins and just found something out… Maybe everyone except me knew already, but I didn’t so maybe others don’t either, and might find this useful. I’m still experimenting with it myself…
I just recently figured out that the reset pin can be used as an ADC input without needing to set it as IO with fuses (disabling reset function). This allows using the pin as ADC input while still being able to flash the MCU. The only requirement is that the voltage on that pin can’t go below the reset pin threshold voltage (Vrst), which looks like 0.9V according to the datasheet. If the voltage does go below that threshold the MCU will reset, that’s what this pin is designed to do.
I’ve been playing around with having the E-switch on it, by having it short bat+ with RST pin, and it works well enough. Of coarse there are limitations, like the pin shouldn’t be left floating when E-switch isn’t pressed as ADC results can be very unpredictable, but it will detect voltage differences as long as the voltage never goes below that reset threshold voltage.
No, wasn't aware of that - interesting... But I don't understand - when the switch is pressed, batt+ is connected to the RST pin - no problem there being above 0.9V. But when it's not depressed, what's on the RST pin if it has to be above 0.9V?
Are you sure 0.9V is the the threshold for reset rather than the spec for a valid reset signal? It's not the same. 0.9V sounds exactly like the normal logic low spec. But what that means for digital logic is any signal 0.9V or will ABSOLUTELY be interpretted as low, reset in this case. For normal logic though 1.0V will also probably be interpretted as low, and that's OK. It's allowed to be, it just isn't guaranteed to be. The actual threshold for normal logic is somewhere between 0.9V and 1.8V. If this is just a standard logic hi/low, you would need to be over 1.8V to guarantee you're in a logic high, ie in definitely-not-resetting voltage rather than just in no-man's land. But maybe reset doesn't follow normal logic-level specs? That would seem a little surprising actually.
You could make it pull back and forth to whatever you want with a simple 2 or 3 resistor network of course, but while it does save a pin, that wouldn't seem to save space.
If the pin is left floating (like when the E-switch is not pressed) anything can happen, ADC results are erratic. I did a test where I have the reset pin connected to VCC (after a diode) and an E-switch that connects BAT+ (before diode) to the pin. This works fine, as voltage on pin is VCC when not pressed, and BAT+ when E-switch is pressed. I’m using the difference of the voltage drop over the diode as E-switch detection. However, a design like this won’t work because you can’t flash an MCU with reset and VCC shorted. I’ve got wires which I have disconnected between flashing. Not practical, but I did this just to test that it works.
If it’s with the design without OTC and VCC goes to the reset pin, maybe measurable voltage will be there long enough with a 100uF cap? Perhaps put a resistor in series? I don’t know, haven’t tried anything like that yet.
Edit: OTC less code would have to be different. If Voltage goes below reset threshold the MCU will reset, but we should be able to see the voltage drop before reaching the threshold, at least with a large enough cap. Thinking out loud again… maybe won’t work.
Absolutely not sure at all. I was an assumption based on skimming through the datasheet and thinking I know what I’m reading. I’m usually not very accurate with these assumptions.
"• External Reset. The MCU is reset when a low level is present on the RESET pin for longer than the minimum pulse length."
That sounds like a logic low to me. Guaranteed to register as low if below 0.3Vcc, but threshold anywhere between 0.3Vcc and 0.6Vcc according to logic level specs in the same document.
The diode offsets the whole divider above 1.0V so the pin never sees less voltage than that. The divider sends something between say 1.5 and 2.5 related to battery voltage (but with an offset now, little software tweak).
< 1.5 is read as shutdown signal.
> 2.5 or better yet equal to Vcc as read using Vcc ref, is read as eswitch press.
Yes it's a bit crazy. But if someone just really wanted to do it, it could probably work. Given that it adds a component, it's hard to see it being worth that to save a pin in most cases. You could probably maybe get by with it without the diode too though.
Without the diode I'd worry that voltage drops to fast and reset hits before you get a chance to detect shutdown.
I could see a way with just resistors. I'd want to slow down the shutdown to make sure you detect it before reset hits. That means bigger C1. But of course that balances against saving power on C2, and it just starts to seem way more complicated and fine tuned than it's worth.
The real fact is, even with the diode, the voltage will still eventually drop below 1V. I just figured that would slow it down enough getting there.
EDIT: Shoot, no, it's got to hold it long enough to get the light back on, not just long enough to read shutdown. Yeah, definitely need the diode AND might have to balance C1. Maybe not impossible, but getting more complicated the more I think about it.
Mike - I suspect a similar problem in unrelated thread (Simon's clear C8 driver problems, post #673). Can't seem to flash the MCU with pin #5 grounded, but not 100% sure this is the problem. Would you know?
The flashing process uses the reset pin and it’s reset feature. As far as I know it’s a timed sequence in order to get the MCU to accept upload. I think shorting it with any other pin that the clip uses will result in not being able to flash. Maybe it’s OK with sorting with one of the IO pins, but GND and VCC are means the programmer can’t pulse anything on the reset pin, and therefor it won’t be able to flash.
Edit: Oh, wait… pin #5 is PBO. Well, in any case I’m assuming that all pins that the programmer uses all need to pulse in certain sequences. Shorting any to VCC or GND would eliminate the possibility for it to send anything on that pin… and that PBO is used by the programmer. So I’d say it’s the same reason.