QL Real-time clock protection and Battery backup...

Nagging hardware related question? Post here!
Post Reply
martyn_hill
Aurora
Posts: 909
Joined: Sat Oct 25, 2014 9:53 am

QL Real-time clock protection and Battery backup...

Post by martyn_hill »

Hi everyone

In an unrelated thread, we started to discuss the various solutions to provide Real-time clock protection and Battery backup to a BBQL and whilst its probably old-news for many, I thought I'd break-out the discussion in case there was more to talk about here.

Dave mentioned that he had built Martin Head's Reset Generator cct into a new project, which I too had also tried (but ineffectually - due to my own lack of skills - no reflection on Martin's design!)

Martin's original design can be found archived on Dilwyn's site here:

http://www.dilwyn.me.uk/docs/hardware/index.html

I ended-up replacing the descrete cct with a Reset Generator/Battery backup IC (ADM-692) which more or less does the job of protetcing the clock on the ZX8302 (so-called Peripheral-Chip or 'PC').

Guru Nasta :-) replied:

"The whole point is to pull PCENL to Vcc when power fails and/or reset occurs, as this is how the clock gets corrupt (spurious writes to 8302 registers). It's not the Vbat switchover - this is easy to do using two small schottky diodes. An interestig circuit to look at is the original Qimi PCENL decoder and battery circuit. It is not directly usable with lithium batteries as it incorporates a trickle charger (big no no for lithium!), but it is a clever circuit. It pulls up PCENL as soon as the supply voltage drops below Vbat. Another way to implement (early) power fail detect would be on the 9V input voltage, prior to the power regulator."

As Martin's cct did not attempt to gate PCEN-L, but just provided a clean RESET-L at both power-up and power-down, it suggests that the 8302 might gate PCEN-L itself internally whenever RESET-L goes active.

The chip enable protection would certainly be required for any non-volatile designs built around low-power SRAM (like one of my - almost successful - earlier QL mods), but would be curious to know if it is indeed required for the 8302.

Any further thoughts?


martyn_hill
Aurora
Posts: 909
Joined: Sat Oct 25, 2014 9:53 am

Re: QL Real-time clock protection and Battery backup...

Post by martyn_hill »

By the way, whilst I was researching Martin's original documentation, I revised it slightly as in the attached PDF doc, for what its worth.
Attachments
Battery Backed Clock.pdf
Slightly reformatted from M Head's original documentation
(196.52 KiB) Downloaded 179 times


Nasta
Gold Card
Posts: 443
Joined: Sun Feb 12, 2012 2:02 am
Location: Zapresic, Croatia

Re: QL Real-time clock protection and Battery backup...

Post by Nasta »

Have a look at the MAX691 reset generator and power supervisor IC. This would be a fairly simple solution to the problem, except it's not the cheapest of ICs... it has a power fail detect (which compares the power supply voltage to an internal reference - perhaps the best place would be to look at the voltage coming from the 9V power supply), a reset generator (which also supports a reset button), a battery power switch (which powers a RTC from the regular power supply when present, and battery when absent) - and, last but not least - a chip select in-out circuit which will disable the chip select (in this case PCENL) if the power drops out. There are other functions but these can't be directly used.


martyn_hill
Aurora
Posts: 909
Joined: Sat Oct 25, 2014 9:53 am

Re: QL Real-time clock protection and Battery backup...

Post by martyn_hill »

Thanks Nasta

Yes, the ADM692 I used in the end is of the same family, albeit by a different manufacturer. The 16-pin DIP variants include both the RESET generator _and_ the Chip Enable gating.

To gate PCEN-L, it needs to be isolated between the source (8301 or HAL, depending upon QL Issue) and the 8302 - there are a couple of easier spots to do this at the via's in the motherboards of each issue (Issue 5 being more accessible in this regard.)

I guess my doubt for needing this gating on the 8302 arises from the observations that:

a) Martin's original cct - which includes the RESET generator but not the PCEN-L gating - seems to work well (according to Dave) in keeping the RTC intact
b) Using the ADM692 - again including only the RESET generator - also seems to work in my mod for an Issue 7 QL - most of the time...

@Dave - when you referred to Martin's 'verison 2' of the cct, is that the same as the one documented on Dilwyn's site and I attached earlier?

When using the IC method (ADM692, etc), I also wonder whether the manual Reset switch could cause damage as it effectively shorts the RESET output of the IC. How would one go about validating if this is a real problem, and mitigate it, if so?


User avatar
Dave
SandySuperQDave
Posts: 2765
Joined: Sat Jan 22, 2011 6:52 am
Location: Austin, TX
Contact:

Re: QL Real-time clock protection and Battery backup...

Post by Dave »

martyn_hill wrote:@Dave - when you referred to Martin's 'verison 2' of the cct, is that the same as the one documented on Dilwyn's site and I attached earlier?
It is. Also, it's not being tried on a real QL, but on a breadboard partially implemented Issue 8 board. I don't think it's comparable.

The idea here is to try and preserve the clock on the issue 8 board without the expense of BBRTC components, and put those on the SSQB (Super SuperQBoard). That makes the SSQB more akin to the gold card but with many more I/Fs, where we can simply add the CPU/RAM configuration of our choice.


martyn_hill
Aurora
Posts: 909
Joined: Sat Oct 25, 2014 9:53 am

Re: QL Real-time clock protection and Battery backup...

Post by martyn_hill »

Ahh, I see.

Can't wait to see how that project develops, Dave :-)

(And glad you're still on-line - indicative that HH didn't completely knock you out!)


User avatar
Dave
SandySuperQDave
Posts: 2765
Joined: Sat Jan 22, 2011 6:52 am
Location: Austin, TX
Contact:

Re: QL Real-time clock protection and Battery backup...

Post by Dave »

We had some minor damage but we know people nearby who lost *everything*.


Post Reply