Static RAM in the SNES carts

Strictly for discussing ZSNES development and for submitting code. You can also join us on IRC at irc.libera.chat in #zsnes.
Please, no requests here.

Moderator: ZSNES Mods

Post Reply
FistOfFury
Hazed
Posts: 84
Joined: Wed Aug 25, 2004 1:25 pm

Static RAM in the SNES carts

Post by FistOfFury »

Static RAM, that is what it's called right? What kind of battery does it use to keep the data from erasing? (wattage?) Like the ones that wristwatches and BIOS's use? I don't know how they work, Is it continually powered up through battery power, or is it periodically powered, and does the SNES power supply take over once the cart is plugged into the SNES, or would the switching of the two power sources erase the data? And why do the SNES carts not have that message on the back sticker like some Nintendo carts do on theirs that says to hold reset while turning off power. If the SNES carts have that then I don't think I've ever seen it.
whicker
Trooper
Posts: 479
Joined: Sat Nov 27, 2004 4:33 am

Post by whicker »

FistOfFury wrote:
Static RAM, that is what it's called right?

Yes.

What kind of battery does it use to keep the data from erasing? (wattage?) Like the ones that wristwatches and BIOS's use?

Exactly that. I'm looking at a Robotrek cartridge right now and it has a CR3032 button cell battery.

I don't know how they work, Is it continually powered up through battery power, or is it periodically powered, and does the SNES power supply take over once the cart is plugged into the SNES, or would the switching of the two power sources erase the data?

The battery powers the SRAM chip only when the main system power coming into the connector drops below a certain threshold voltage (I don't have an exact number, but something less than 5V and greater than 3V). It cannot get recharged, it slowly drains over the course of years.

In that regard, there is indeed a "switchover" point. But it happens without any sort of voltage spike. (see below).

And why do the SNES carts not have that message on the back sticker like some Nintendo carts do on theirs that says to hold reset while turning off power. If the SNES carts have that then I don't think I've ever seen it.

It's because of better technology and better programming.

The "better technology" aspect comes from the fact that the snes's CPU won't go as spastic as the NES's when it looses power (it still does, a little, but there's another piece of technology too, as explained still further below).

The worst thing that can happen to a normally functioning microprocessor is a dropping supply voltage. Because below a certain point, internal circuits won't switch and others will when they're not supposed to-- This is just reality.

To put it another way, in human terms, when you turn off a switch, the "power" seems to turn off instantly. But when you look at things from a nanosecond standpoint as a microprocessor would see things, a graph of the incoming voltage over time would be a gentle downward slope.

At a certain point on the voltage slope, say at 3.92 volts (just an example), the designers of the microprocessor say that they can't guarantee that it will work properly anymore. Most TTL and HCT technology devices are designed to be powered from between 4.5 and 5.5 volts, but there is some safety margin up or down.

So, say the supply power, steadily dropping, has just gone below our arbitrary 3.92V point. Now the microprocessor is going to start acting "spastic", because that's the only word to describe it-- it's going to try to read from and write to random memory locations.

If one of those random memory locations happens to be pointing to your save file SRAM, it's going to cause a corruption. Remember that everything else in the system is losing power, too. If it's not the CPU that screws up, some other chip is going to act "wrong".


Enter the "battery controller" chip. Most battery powered Super Nintendo cartridges have a MAD-1 chip. (Memory Address Decoder 1) chip. Besides doing address decoding, the chip has some pins dedicated to a battery controller.

The circuitry in the battery controller does this: It compares the incoming Supply voltage to fixed voltage reference. If it sees that for any reason the incoming supply voltage is less than the reference, it:

1) Switches on its battery-side MOSFET that allows current from the battery to flow to the SRAM's power pins.

2) Switches off a chip select signal on the SRAM (usually CS2). Without chip select being asserted, the SRAM chip will ignore any reads from and writes to it. This also tells the chip to go into "low-power" mode, too.

So that takes care of the two issues, one-- the SRAM chip gets the power it needs to keep its memory intact, and two-- the chip ignores any spurious reads and writes that the cpu might make while the voltage is dropping.


So why do you need to hold reset while turning off the NES? You don't have to, but your data may get corrupted as the NES's CPU goes spastic over a dropping supply voltage. You see, that cartridge doesn't have a sophisticated battery controller.

By holding RESET, the CPU is in the one state you can count on to not have the CPU act randomly, therefore bypassing the whole "spastic" thing. That's the point of RESET on any system, to put the system into a known state. Your CPU in your own computer gets reset when the power first turns on (a "reset" controller, yes these names are obvious) and also gets held in reset when the power starts to turn off.

I haven't looked, but I'm pretty sure that in Zelda (NES), the coin cell battery powers the SRAM through a diode. The diode prevents the +5V from flowing into the battery (it's not rechargable) when the main system power is on, and when the main supply voltage drops to where the diode can conduct forward, the battery starts powering the chip. There's nothing to keep the chip from accepting errant writes.
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Re: Static RAM in the SNES carts

Post by Nach »

FistOfFury wrote:Static RAM, that is what it's called right? What kind of battery does it use to keep the data from erasing?
That question is invalid.

You should perhaps ask, games that use Static RAM that does not erase when you turn it off, what kind of battery does it use.

Because not all games with Static RAM have a battery.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
PHoNyMiKe
Retrosexual
Posts: 1011
Joined: Wed Jul 28, 2004 2:09 am
Location: Rapture

Post by PHoNyMiKe »

there goes nach again trying to act like he's cool, meanwhile contributing absolutely nothing to the thread.

as for cart batteries, nintendo says not to turn the power on and off rapidly, but a ahort while ago my fucking metroid cart would only start up with a blank screen, so I turned it off, waited a second, turned it on, nothing, turned it off, a second later yadda yadda and when it did work the fucking sram was erased damnit! so don't go doing shit like that.
[url=http://www.alexchiu.com/affiliates/clickthru.cgi?id=phonymike]ultimate immortality[/url]
[url=http://www.sloganizer.net/en/][img]http://www.sloganizer.net/en/image,zsnes,white,purple.png[/img][/url]
whicker
Trooper
Posts: 479
Joined: Sat Nov 27, 2004 4:33 am

Post by whicker »

It may not have an sram (haven't checked), but a warioware GBA cartridge I bought from a resale shop didn't keep its saves.

I spent a couple hours playing that evening, and when I came back to it in the morning, the game was as it was when I purchased it.

Hmm, testing time. I beat one level and changed the player name, shut it off, powered it back up. Yep, it didn't keep its save. Everything back to when I bought it.

The edge contacts didn't look that dirty, "blowing" didn't help, but I decided to clean them anyway with my "Official Cleaning Kit"

(Because remember kids, using unofficial cleaning products could ruin your system like that one kid in Nintendo Power said) /sarcasm

I haven't seen an official cleaning kit around here since the Super Nintendo days, and that's all I've got. But the wand tips do actually work for gba and n64 games. Anyways.


Well, it turns out that yes it was a dirty contact. It saves fine now. I can only imagine that stupid kid selling the newer game for $8 in-store credit thinking he "bested" the resale shop for selling them a broken game.
Ichinisan
Veteran
Posts: 603
Joined: Wed Jul 28, 2004 8:54 am

Post by Ichinisan »

An overwhelming number of pirated GBA carts make it into shops that would easily recognize pirate carts for any other system. You should look at it more closely or take it apart and compare it to a legit cart to be absolutely sure.

I'm willing to bet that it's pirated. I've already run into 3 pirated GBA games with save problems.
Tighe
New Member
Posts: 1
Joined: Wed Oct 24, 2012 3:19 pm

Re:

Post by Tighe »

whicker wrote:
FistOfFury wrote:
Static RAM, that is what it's called right?

Yes.

What kind of battery does it use to keep the data from erasing? (wattage?) Like the ones that wristwatches and BIOS's use?

Exactly that. I'm looking at a Robotrek cartridge right now and it has a CR3032 button cell battery.

I don't know how they work, Is it continually powered up through battery power, or is it periodically powered, and does the SNES power supply take over once the cart is plugged into the SNES, or would the switching of the two power sources erase the data?

The battery powers the SRAM chip only when the main system power coming into the connector drops below a certain threshold voltage (I don't have an exact number, but something less than 5V and greater than 3V). It cannot get recharged, it slowly drains over the course of years.

In that regard, there is indeed a "switchover" point. But it happens without any sort of voltage spike. (see below).

And why do the SNES carts not have that message on the back sticker like some Nintendo carts do on theirs that says to hold reset while turning off power. If the SNES carts have that then I don't think I've ever seen it.

It's because of better technology and better programming.

The "better technology" aspect comes from the fact that the snes's CPU won't go as spastic as the NES's when it looses power (it still does, a little, but there's another piece of technology too, as explained still further below).

The worst thing that can happen to a normally functioning microprocessor is a dropping supply voltage. Because below a certain point, internal circuits won't switch and others will when they're not supposed to-- This is just reality.

To put it another way, in human terms, when you turn off a switch, the "power" seems to turn off instantly. But when you look at things from a nanosecond standpoint as a microprocessor would see things, a graph of the incoming voltage over time would be a gentle downward slope.

At a certain point on the voltage slope, say at 3.92 volts (just an example), the designers of the microprocessor say that they can't guarantee that it will work properly anymore. Most TTL and HCT technology devices are designed to be powered from between 4.5 and 5.5 volts, but there is some safety margin up or down.

So, say the supply power, steadily dropping, has just gone below our arbitrary 3.92V point. Now the microprocessor is going to start acting "spastic", because that's the only word to describe it-- it's going to try to read from and write to random memory locations.

If one of those random memory locations happens to be pointing to your save file SRAM, it's going to cause a corruption. Remember that everything else in the system is losing power, too. If it's not the CPU that screws up, some other chip is going to act "wrong".


Enter the "battery controller" chip. Most battery powered Super Nintendo cartridges have a MAD-1 chip. (Memory Address Decoder 1) chip. Besides doing address decoding, the chip has some pins dedicated to a battery controller.

The circuitry in the battery controller does this: It compares the incoming Supply voltage to fixed voltage reference. If it sees that for any reason the incoming supply voltage is less than the reference, it:

1) Switches on its battery-side MOSFET that allows current from the battery to flow to the SRAM's power pins.

2) Switches off a chip select signal on the SRAM (usually CS2). Without chip select being asserted, the SRAM chip will ignore any reads from and writes to it. This also tells the chip to go into "low-power" mode, too.

So that takes care of the two issues, one-- the SRAM chip gets the power it needs to keep its memory intact, and two-- the chip ignores any spurious reads and writes that the cpu might make while the voltage is dropping.


So why do you need to hold reset while turning off the NES? You don't have to, but your data may get corrupted as the NES's CPU goes spastic over a dropping supply voltage. You see, that cartridge doesn't have a sophisticated battery controller.

By holding RESET, the CPU is in the one state you can count on to not have the CPU act randomly, therefore bypassing the whole "spastic" thing. That's the point of RESET on any system, to put the system into a known state. Your CPU in your own computer gets reset when the power first turns on (a "reset" controller, yes these names are obvious) and also gets held in reset when the power starts to turn off.

I haven't looked, but I'm pretty sure that in Zelda (NES), the coin cell battery powers the SRAM through a diode. The diode prevents the +5V from flowing into the battery (it's not rechargable) when the main system power is on, and when the main supply voltage drops to where the diode can conduct forward, the battery starts powering the chip. There's nothing to keep the chip from accepting errant writes.
Sorry to bump an old thread, but I was wondering if Kirby for the NES had a similar circuit in it. There is no note to hold the reset button when powering the cart off, and it doesn't loose its saves if you just power it off.

The reason I ask is because Kirby seems to be one of the only NES games that does not work in the NES to Playchoice 10 adapter 2600 has made.

http://forums.arcade-museum.com/showthread.php?t=233807

http://forums.arcade-museum.com/showthr ... ?p=2249509
Gil_Hamilton
Buzzkill Gil
Posts: 4294
Joined: Wed Jan 12, 2005 7:14 pm

Re: Re:

Post by Gil_Hamilton »

Tighe wrote:Sorry to bump an old thread, but I was wondering if Kirby for the NES had a similar circuit in it. There is no note to hold the reset button when powering the cart off, and it doesn't loose its saves if you just power it off.

The reason I ask is because Kirby seems to be one of the only NES games that does not work in the NES to Playchoice 10 adapter 2600 has made.

http://forums.arcade-museum.com/showthread.php?t=233807

http://forums.arcade-museum.com/showthr ... ?p=2249509
It's not alone in that regard. Crystalis, StarTropics, and Zoda's Revenge behave similarly.
The MMC3(or 6 in the case of the ST games) is between SRAM and the NES, and has write-protect bits that can be set, so it protects SRAM from spurious writes.

But Nintendo'd already standardized on "hold reset while turning the power off", and it seemed better to make it a global rule than only for SOME battery-backed cartridges.


I SUSPECT that later runs of some of the earlier games may also have been redesigned to handle the issue more gracefully. But I can't rightly prove it, and may've just gotten lucky.

Reading suggests that part of the problem is early games didn't have a capacitor to prevent sudden large voltage changes to the SRAM chip, which aggravated an already-dangerous situation.
Squall_Leonhart wrote:
You have your 2s, 4s, 8s, 16s, 32s, 64s, and 128s(crash course in binary counting!). But no 1s.
DirectInput represents all bits, not just powers of 2 in an axis.
KHDownloads
Post Reply