As Id like to keep Vdrive driver and ROM images in RAM I need to preserve it's content while power is of.
So I'd like to add a Lithium Battery to keep RAM in standby mode.
First idea as shown below is known as not working, because all of the data, address and control lines will collapse to 0V when power is going down.
This will enable the RAM(/CE is low) and may write(/WR is low) unpredictable data to an unpredictable address(or at least $00 to $0000)
This can be improves by moving the diodes to the GND side as used by Wilf Rigter many years ago
http://www.user.dccnet.com/wrigter/inde ... XRAMIO.htm
In this case all of the data, address and control lines will collapse to VCC, chip is not enabled and not in write mode.
Low level will be shifted up or down(depending on the point of view) for 0.3V but will still stay in green range(0.4V+0.3V=0.7V ok for low; 0.4V-0.3V=0.1V also in accepted range)
I'd like to highlight here, that the forward voltage of diodes is current sensitive. A Schottky diode is not fixed to 0.3V. BAT41 does have 0.4V at 1mA and 0.8V at 40mA. So I propose to use 1A or 2A types not because of maximum current but because of lower forward current at SRAM operating level.
The "diodes to GND" solution is known as working but in rare cases CPU does an unpredictable write cycle when power is going down or brown out.
So I was looking for a more reliable solution.
Battery backup for SRAM
-
- Posts: 43
- Joined: Sun Dec 22, 2019 12:09 pm
- Location: Augsburg, Germany
Battery backup for SRAM
ZX81 issue 1 near to original state
ZX81 issue 1 56k internal ram with battery backup, UDG, CHR$128 and WRX enabled
Minstrel 3 ZX81 clone 64k with battery backup, UDG, CHR$128 and WRX enabled
ZX81 issue 1 56k internal ram with battery backup, UDG, CHR$128 and WRX enabled
Minstrel 3 ZX81 clone 64k with battery backup, UDG, CHR$128 and WRX enabled
-
- Posts: 43
- Joined: Sun Dec 22, 2019 12:09 pm
- Location: Augsburg, Germany
Re: Battery backup for SRAM
Next I found this in the German ZX81 forum:
http://forum.tlienhard.com/phpBB3/viewt ... t=25#p6226
Up to many other interesting things it contain a battery backup solution with under-voltage protection.
This solution need another chip to be on battery power. This chip(74HCT139) keep /CS on high level when power is down.
The Z-diode ensure that the SRAM is disabled when VCC goes below something between 4.5V and 3.8V.
So no accidential writes will occure when power is going down.
This solution propose usage of a 3.6V rechargeable battery or Goldcap capacitor, but I expect it will work with a lithium battery as well, if 270 Ohm resistor is replaced by an Schottky diode.
If you feel that "something between 4.5V and 3.8V" is to inaccurate, you may replace the Z-diode by an MC34064 that would disable SRAM at 4.6V
http://forum.tlienhard.com/phpBB3/viewt ... t=25#p6226
Up to many other interesting things it contain a battery backup solution with under-voltage protection.
This solution need another chip to be on battery power. This chip(74HCT139) keep /CS on high level when power is down.
The Z-diode ensure that the SRAM is disabled when VCC goes below something between 4.5V and 3.8V.
So no accidential writes will occure when power is going down.
This solution propose usage of a 3.6V rechargeable battery or Goldcap capacitor, but I expect it will work with a lithium battery as well, if 270 Ohm resistor is replaced by an Schottky diode.
If you feel that "something between 4.5V and 3.8V" is to inaccurate, you may replace the Z-diode by an MC34064 that would disable SRAM at 4.6V
ZX81 issue 1 near to original state
ZX81 issue 1 56k internal ram with battery backup, UDG, CHR$128 and WRX enabled
Minstrel 3 ZX81 clone 64k with battery backup, UDG, CHR$128 and WRX enabled
ZX81 issue 1 56k internal ram with battery backup, UDG, CHR$128 and WRX enabled
Minstrel 3 ZX81 clone 64k with battery backup, UDG, CHR$128 and WRX enabled
- 1024MAK
- Posts: 5118
- Joined: Mon Sep 26, 2011 10:56 am
- Location: Looking forward to summer in Somerset, UK...
Re: Battery backup for SRAM
Funny that you should mention brown-out protection... Here is a circuit I only started experimenting with earlier this week. It works in a SPICE simulation, but has not yet been tried out for real:
Although the transistors are shown as 2N3904 and 2N3906, any suitable NPN and PNP small signal transistors with a gain of >200 should be suitable.
One improvement would be to replace the 1N4148 used for D1 with a BAT42, BAT43 or BAT46 or similar.
The idea is that until the supply voltage is stable, the CPU is held in reset. Then there is a short time delay, then /RESET goes to high quickly. When the supply voltage starts to drop below approximately 4V, shortly afterward, the circuit will take /RESET low again. When the CPU is in reset, it should not try to write to memory.
Mark
One improvement would be to replace the 1N4148 used for D1 with a BAT42, BAT43 or BAT46 or similar.
The idea is that until the supply voltage is stable, the CPU is held in reset. Then there is a short time delay, then /RESET goes to high quickly. When the supply voltage starts to drop below approximately 4V, shortly afterward, the circuit will take /RESET low again. When the CPU is in reset, it should not try to write to memory.
Mark
ZX81 Variations
ZX81 Chip Pin-outs
ZX81 Video Transistor Buffer Amp
Standby alert
There are four lights!
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb
Looking forward to summer later in the year.
ZX81 Chip Pin-outs
ZX81 Video Transistor Buffer Amp
Standby alert
There are four lights!
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb
Looking forward to summer later in the year.
- 1024MAK
- Posts: 5118
- Joined: Mon Sep 26, 2011 10:56 am
- Location: Looking forward to summer in Somerset, UK...
Re: Battery backup for SRAM
If you are going to use a non-rechargeable Lithium cell or battery, the protection diode used must have a low reverse leakage current. Also a suitable resistor should be fitted in series to limit the unwanted charging current should the diode fail short circuit. Lithium cells don't like being charged...
Mark
A BAT42 diode and a 4.7kΩ resistor are suitable for 3V lithium coil cells. The diode you use in the normal power feed to the chip can be whatever you choose.Panasonic wrote:Reverse current preventing diodes. Since lithium primary batteries are not rechargeable, use of a reverse current preventing diode and a protective resistor in series is required where there is the possibility of charging in the equipment circuit. Use a silicon diode or Schottky diode with a low reverse current as the reverse current preventing diode. To maintain the characteristics of a coin-type lithium battery, the total charging amount of the battery during its total usage period must be kept within 3% of the nominal capacity of the battery.
Mark
ZX81 Variations
ZX81 Chip Pin-outs
ZX81 Video Transistor Buffer Amp
Standby alert
There are four lights!
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb
Looking forward to summer later in the year.
ZX81 Chip Pin-outs
ZX81 Video Transistor Buffer Amp
Standby alert
There are four lights!
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb
Looking forward to summer later in the year.
-
- Posts: 43
- Joined: Sun Dec 22, 2019 12:09 pm
- Location: Augsburg, Germany
Re: Battery backup for SRAM
Thanks a lot Mark for pointing out the reverse current.
I had a look into the datasheets of 1N5817 and BAT48.
With 2V difference voltage and 25°C 1N5817 has 70µA BAT48 has 2µA reverse current. As the Lithium cell I am planning with is about 200mAh, 3% is 66,7mAh.
This will not overload the cell within 85000h(1N5817) or 3000000h(BAT48) powered from 5V.
So the only application that need to worry about this is a 24/7 ZeddyNet web-server after some years.
Currently I am not sure if I will take the risk of a short circuit. If not, 100mW won't overheat the cell so everything between 100Ohm and some k should be ok.
Your brown out prevention look great. Do you think it is worth the additional effort in comparison to an MC34064?
I had a look into the datasheets of 1N5817 and BAT48.
With 2V difference voltage and 25°C 1N5817 has 70µA BAT48 has 2µA reverse current. As the Lithium cell I am planning with is about 200mAh, 3% is 66,7mAh.
This will not overload the cell within 85000h(1N5817) or 3000000h(BAT48) powered from 5V.
So the only application that need to worry about this is a 24/7 ZeddyNet web-server after some years.
Currently I am not sure if I will take the risk of a short circuit. If not, 100mW won't overheat the cell so everything between 100Ohm and some k should be ok.
Your brown out prevention look great. Do you think it is worth the additional effort in comparison to an MC34064?
ZX81 issue 1 near to original state
ZX81 issue 1 56k internal ram with battery backup, UDG, CHR$128 and WRX enabled
Minstrel 3 ZX81 clone 64k with battery backup, UDG, CHR$128 and WRX enabled
ZX81 issue 1 56k internal ram with battery backup, UDG, CHR$128 and WRX enabled
Minstrel 3 ZX81 clone 64k with battery backup, UDG, CHR$128 and WRX enabled
-
- Posts: 43
- Joined: Sun Dec 22, 2019 12:09 pm
- Location: Augsburg, Germany
Re: Battery backup for SRAM
There is a ready made solution for battery backup for SRAM:
Maxim DS1210
https://datasheets.maximintegrated.com/en/ds/DS1210.pdf
Chip is also available from Dallas Semiconductror
This chip support 2 batteries, ensure that SRAM is disabled in case of power down and is able to detect brown out at 4.75V or 4.5V.
So something like that should work: Is anyone able to read the reverse current from datasheet?
None of Input Leakage, Output Leakage, Battery Current or Battery Backup Current seems to describe reverse current.
I will order and test some of these chips
Max
Maxim DS1210
https://datasheets.maximintegrated.com/en/ds/DS1210.pdf
Chip is also available from Dallas Semiconductror
This chip support 2 batteries, ensure that SRAM is disabled in case of power down and is able to detect brown out at 4.75V or 4.5V.
So something like that should work: Is anyone able to read the reverse current from datasheet?
None of Input Leakage, Output Leakage, Battery Current or Battery Backup Current seems to describe reverse current.
I will order and test some of these chips
Max
ZX81 issue 1 near to original state
ZX81 issue 1 56k internal ram with battery backup, UDG, CHR$128 and WRX enabled
Minstrel 3 ZX81 clone 64k with battery backup, UDG, CHR$128 and WRX enabled
ZX81 issue 1 56k internal ram with battery backup, UDG, CHR$128 and WRX enabled
Minstrel 3 ZX81 clone 64k with battery backup, UDG, CHR$128 and WRX enabled
-
- Posts: 43
- Joined: Sun Dec 22, 2019 12:09 pm
- Location: Augsburg, Germany
Re: Battery backup for SRAM
The chips arrived and I implemented the circuit on my Minstrel board.
Works fine, no unexpected writes on shutdown.
Only issue I found is when Battery is low or absent, the second access to RAM is ignored(described in the datasheet), so operating system does not start at power up but after additional reset if battery is missing.
The reverse current is around 0,1µA (my meter flips between 0,0 and 0,1µA) So this isn't an issue with DS1210.
Max
Works fine, no unexpected writes on shutdown.
Only issue I found is when Battery is low or absent, the second access to RAM is ignored(described in the datasheet), so operating system does not start at power up but after additional reset if battery is missing.
The reverse current is around 0,1µA (my meter flips between 0,0 and 0,1µA) So this isn't an issue with DS1210.
Max
ZX81 issue 1 near to original state
ZX81 issue 1 56k internal ram with battery backup, UDG, CHR$128 and WRX enabled
Minstrel 3 ZX81 clone 64k with battery backup, UDG, CHR$128 and WRX enabled
ZX81 issue 1 56k internal ram with battery backup, UDG, CHR$128 and WRX enabled
Minstrel 3 ZX81 clone 64k with battery backup, UDG, CHR$128 and WRX enabled