I would like to know when the RTC battery voltage is getting low so that the board can be serviced within an appropriate timeframe. Is it possible to read the vbat inputs current voltage with code or would it required an extra wire to an input? if the latter, would this cause the battery to be depleted sooner?
Can’t he just use an Analogue Input pin? They are typically high impedance (Gus correct me if i’m wrong) and so won’t drain the battery. Also when not measuring you can just set it to it’s HiZ mode.
it is a G400 so using a SAM9X35…
I cant see anything in the datasheet but don’t really know what I am looking for so unless a better answer comes along I will go with the analogue pin for the moment… (after the rugby of course :D)
@ andre.m - hmmm. Perhaps a rechargeable battery would be the way forwards then… I will have to see if vbat provides a voltage when powered up… I am guessing so since a supercap can also be used…
a supercap can be used, but requires you to charge it externally so that it charges when the circuit is powered and discharges to the VBAT pin when unpowered.
@ Brett - That would just need a diode right? If the super cap is 5V and charging it to 3v3 would be no problem. Just hook up the cap to Vbat and then to VCC 3v3. Put a diode between the cap and VCC to ensure it doesn’t discharge through VCC.
You need to manage inrush current as well, but basically a diode is sufficient. VBAT max is another important thing to verify, if it will tolerate 3v3 or not (check processor datasheet)
@ Brett - Would a diode be sufficient? It’s resistance is enough to keep the inrush current down, or would a 1K resistor also be needed?
I have a resistor on all my own RTC-powering supercaps. I’d prefer to slow the charge rate a little than draw too much current from the power supply and risk instability to the main application (the micro)
@ Brett - What’s the value?
Sorry, that’s a secret.
Not really, but it’s a mystery. I trialled and errored with a hadful that I had until I got a sufficiently acceptable result on my test board… the test was the backlight on the LCD didn’t noticeably flicker on power up. Measured in circuit it looks like its a 220ohm.
That’s true, you would have to balance that value across the entire system to determine what the inrush current will be. In my case I get to startup things one at a time