I wrote up a "brief" explainer on SNES cartridges

Discussion of hardware and software development for Super NES and Super Famicom. See the SNESdev wiki for more information.

Moderator: Moderators

Forum rules
  • For making cartridges of your Super NES games, see Reproduction.
poorstudenthobbyist
Posts: 252
Joined: Fri Jun 24, 2016 4:20 pm

I wrote up a "brief" explainer on SNES cartridges

Post by poorstudenthobbyist »

https://thepoorstudenthobbyist.com/2019 ... planation/

This encompasses most functions of a standard SNES PCB (without the MAD-1 decoder). I also included a hopefully somewhat-easy-to-understand explanation of the memory map for those unfamiliar with memory mapping (like I was).

I also included a detailed analysis of the battery circuit and SRAM saving functions for long battery life from a thread I posted a while back.

Any criticisms or corrections are welcome! Thanks :)
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: I wrote up a "brief" explainer on SNES cartridges

Post by lidnariq »

In your all-new-parts PCBs, I don't see the support hardware for a 27C322... is it hidden on the other side?


As far as I know, the DIP PIC10F322 is significantly cheaper than the PIC12F629, so my port might be useful.
poorstudenthobbyist
Posts: 252
Joined: Fri Jun 24, 2016 4:20 pm

Re: I wrote up a "brief" explainer on SNES cartridges

Post by poorstudenthobbyist »

Oh yeah, I didn't add a picture of the back of the board on that page. The multiplexers are surface mount on the back of the board. I'm looking at making a through-hole variant to offer for those not comfortable with SOIC soldering.

I'll check out those PICs. Thanks! The 629s are like a dollar each.
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: I wrote up a "brief" explainer on SNES cartridges

Post by lidnariq »

... ok, now, actually proofreading...
The /CS pin on the EPROM (chip select) is connected to the /RD pin of the cartridge connector (read data).
[...]
The /OE pin on the EPROM (output enable) is usually connected to the /CART pin on the cartridge connector, because we want the EPROM to output data whenever the SNES is requesting cartridge data.
Please don't do that. That's not how those pins work, and it produces pessimal results (consuming more power and responding more slowly).

In a plain RAM-less LoROM board, as well as almost all HiROM boards, 'PROM /CS should be connected to /CART, and 'PROM /OE should be connected to /RD. This is because the ROM will start looking up the value inside itself as soon as its /CS pin is low, and the SNES's address bus is already valid at this time. By having flipped the two signals around, you instead
1- Cause the ROM to draw power on every single cycle when the SNES is reading from any address anywhere
2- Cause the ROM to start looking up the value inside itself 140ns later than is useful for it to do so, to no benefit.

Yes, Nintendo themselves did release some boards with these two pins backwards, but not all of them, and it still has the same problem I've mentioned above.

The correct way to think of these two signals is the /CE pin specifies "who" and the /OE (and PGM or /WE pin) specifies "doing what". In fact, you later explain it this way when you talk about RAM (because RAM can't work the other way, as opposed to just being pessimal)
tied
"Tied" is EE idiom for "permanent". Idiomatically you want "driven", or "pulled", and in a few places you might want "connected".

Separately, in the (two year old) NES reproduction guide:
mask ROM
It's "mask" ROM because the data was encoded using a lithographic mask, not because there's no window.
(In fact, you can get windowless EPROMs. No window means they can't be erased by UV ... but they can be erased by X-rays!)
poorstudenthobbyist
Posts: 252
Joined: Fri Jun 24, 2016 4:20 pm

Re: I wrote up a "brief" explainer on SNES cartridges

Post by poorstudenthobbyist »

/CE and /OE
I've seen your correction about these pins before, so I've been meaning to getting around to updating some of the language about it, but since it works I put it as a lower priority. I actually forgot about it until you mentioned it again... lol. I got most of the pinouts from an original SNES board a while back, I have no idea which one, but it must have been wired this way. I didn't think twice about the /RD pin being READ DATA, it makes more sense to be connected to /OE in hindsight. I mean, in theory and in practice it still works, and the power draw and delay is pretty negligible. But I'll definitely update it to be more accurate to reflect the correct pin functions.
Tied
That's a good point, I use those terms all interchangeably (not just on this post, but IRL) and I probably shouldn't!
NES guide
Oh man, thanks for looking at that haha. I'm sure there are way more errors in that post than just the one you pointed out. I actually wrote that 5 years ago, only migrated it to Wordpress without editing 2 years ago. I was very green to the whole thing at the time. It's been on my list of to-dos for a while now, it's in dire need of an upgrade.

But as far as the mask part... I genuinely didn't know that anyway.

Thanks for checking it out!
poorstudenthobbyist
Posts: 252
Joined: Fri Jun 24, 2016 4:20 pm

Re: I wrote up a "brief" explainer on SNES cartridges

Post by poorstudenthobbyist »

Hey, lidnariq, I updated the page since I last posted about it to fix the /CE and /OE differences, and also fixed some terminology. I added a section detailing the 256K SRAM battery circuit and also a part about Mode 25 - if you get a chance, mind checking it out, specifically ExHiROM? I got the information for Mode 25 from the manual so I think it should be pretty accurate.

Thanks :)
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: I wrote up a "brief" explainer on SNES cartridges

Post by lidnariq »

In general, probably should use "ROM" instead of EPROM. OEM carts almost never contain parts that can be Erased or Programmed.
so that varying voltages supplied from the SNES don’t interrupt the operation of the game
Pedantically, it's so that varying currents drawn by the SNES and cartridge don't cause varying voltages.
The only instance where the /OE pin is connected elsewhere is when you have a LoROM board with SRAM. In this instance, we connect the /OE pin to a specific output of an on-board ‘139 decoder.
As far as I know, boards "should" use /CE instead of /OE for this, but it's less important. On the SNES, the address bus and /CART become valid at the same time (shortly after /CART rises), so it makes sense to put all that logic together.
(VBAT, 3.3 V)
Pedantically, lithium coin cells, like those used in the SNES, aren't that high of a voltage. 2.9-3V is a typical open-circuit voltage.

For the initial schematic for +CE, you probably want RB÷RE to be smaller than 100. A bunch of random BJTs just barely don't have that much gain (hFE / β) at Ic=5mA. I'd probably "just" increase RE to 2k or 5k, only requiring a transistor with hFE=50 or 20 respectively


Mode 25 documentation looks reasonable.
poorstudenthobbyist
Posts: 252
Joined: Fri Jun 24, 2016 4:20 pm

Re: I wrote up a "brief" explainer on SNES cartridges

Post by poorstudenthobbyist »

lidnariq wrote: Thu Feb 13, 2020 7:27 pm
Pedantically, it's so that varying currents drawn by the SNES and cartridge don't cause varying voltages.
More pedantically, it's actually probably both :P
Pedantically, lithium coin cells, like those used in the SNES, aren't that high of a voltage. 2.9-3V is a typical open-circuit voltage.
I'm so used to writing 3.3V that I never actually thought about that very much. You're right.
For the initial schematic for +CE, you probably want RB÷RE to be smaller than 100. A bunch of random BJTs just barely don't have that much gain (hFE / β) at Ic=5mA. I'd probably "just" increase RE to 2k or 5k, only requiring a transistor with hFE=50 or 20 respectively
Good to know! I'll adjust that.

Thanks again for reviewing it.
Ice Man
Posts: 547
Joined: Fri Jul 04, 2014 2:34 pm

Re: I wrote up a "brief" explainer on SNES cartridges

Post by Ice Man »

It's funny how most, if not all, schematics of the 74'139 for LoROM are actually partly wrong.

74'139 Pin 7 (1Y3) is actually an /OE output but it's not connected to the EPROM at all. Instead it is connected to either the /OE inputs of the 74'257 or 74'245, depending what one uses to connect a 27C322 EPROM. /CE and /OE of the EPROM itself are GNDed.

If you connected 74'257 or 74'245 /OE input to /CART (Pin 49) and connect 74'139 Pin 7 (1Y3) to the EPROM I'm sure you will get conflicts and crashes, cause I had that issue long time ago with certain games using SRAM, e.g. Zelda. ;)
nocash
Posts: 1405
Joined: Fri Feb 24, 2012 12:09 pm
Contact:

Re: I wrote up a "brief" explainer on SNES cartridges

Post by nocash »

poorstudenthobbyist wrote: Thu Feb 13, 2020 9:59 pm
lidnariq wrote: Thu Feb 13, 2020 7:27 pm Pedantically, it's so that varying currents drawn by the SNES and cartridge don't cause varying voltages.
More pedantically, it's actually probably both
No, that's nonsense the SNES does draw (consume) power, it does not supply (generate) power.
Also, the capacitor that you are talking about is there to prevent varying voltages because that would be problem.
On the opposite, your sentence makes it sound as if voltages could freely vary without any problems.

Voltage and current are related, but different things. Drawing too much current can cause the voltage to drop.
Anyways, correct would be to say that the SNES is "drawing current", it isn't "drawing voltage", and it isn't "supplying voltage".
homepage - patreon - you can think of a bit as a bottle that is either half full or half empty
poorstudenthobbyist
Posts: 252
Joined: Fri Jun 24, 2016 4:20 pm

Re: I wrote up a "brief" explainer on SNES cartridges

Post by poorstudenthobbyist »

nocash wrote: Fri Feb 14, 2020 10:07 am
poorstudenthobbyist wrote: Thu Feb 13, 2020 9:59 pm
lidnariq wrote: Thu Feb 13, 2020 7:27 pm Pedantically, it's so that varying currents drawn by the SNES and cartridge don't cause varying voltages.
More pedantically, it's actually probably both
No, that's nonsense the SNES does draw (consume) power, it does not supply (generate) power.
Also, the capacitor that you are talking about is there to prevent varying voltages because that would be problem.
On the opposite, your sentence makes it sound as if voltages could freely vary without any problems.

Voltage and current are related, but different things. Drawing too much current can cause the voltage to drop.
Anyways, correct would be to say that the SNES is "drawing current", it isn't "drawing voltage", and it isn't "supplying voltage".
I think I'm missing the point, or maybe I'm not conveying it correctly (in the post or the website).

The way I understand electronics, the bulk cap is to smooth out the voltage supply on the cartridge and keep it steady through voltage transients, either caused by errant current spikes or voltage spikes, be it from a varying line or load or whatever the case may be.

Voltage in a capacitor cannot change instantaneously - it must charge - and therefore a large capacitor slows down this voltage change. If the transients are fast enough and/or the cap big enough, then no errant voltage transients make it onto whatever chip it is protecting.
Last edited by poorstudenthobbyist on Fri Feb 14, 2020 11:40 am, edited 1 time in total.
poorstudenthobbyist
Posts: 252
Joined: Fri Jun 24, 2016 4:20 pm

Re: I wrote up a "brief" explainer on SNES cartridges

Post by poorstudenthobbyist »

Ice Man wrote: Fri Feb 14, 2020 8:15 am It's funny how most, if not all, schematics of the 74'139 for LoROM are actually partly wrong.

74'139 Pin 7 (1Y3) is actually an /OE output but it's not connected to the EPROM at all. Instead it is connected to either the /OE inputs of the 74'257 or 74'245, depending what one uses to connect a 27C322 EPROM. /CE and /OE of the EPROM itself are GNDed.

If you connected 74'257 or 74'245 /OE input to /CART (Pin 49) and connect 74'139 Pin 7 (1Y3) to the EPROM I'm sure you will get conflicts and crashes, cause I had that issue long time ago with certain games using SRAM, e.g. Zelda. ;)
Did I get something wrong on this? If I am, I'm not sure if I see it. Maybe I have a typo in there somewhere.

I have the decoder 1Y3 for /CE on the EPROM and the /RD for /OE on the EPROM. Though, in all honestly, the boards I currently have switch the two signals since it still works, but at the advice of lidnariq, I switched them. Theoretically and functionally it shouldn't make a difference.
Ice Man
Posts: 547
Joined: Fri Jul 04, 2014 2:34 pm

Re: I wrote up a "brief" explainer on SNES cartridges

Post by Ice Man »

That's exactly the issue.
74'139 1Y3 (pin 7) is not connected to the 27C322/CE nor /OE line at all as it will cause conflicts between ROM and RAM (at least it did for me with some SRAM games).

27C322 /CE and /OE are both to be connected to GND since the Multiplexers (74'257) /OE inputs (pin 15) are controlled by 74'139 1Y3 (pin 7) output.

I once did the same and quite a few games were crashing or not saving at all. Of course this only applies to LoROM games.
The 74'257 /OE inputs are directly connected to SNES /OE (cart 49) on HiROM games.

Here's a schematic cutout of one of my boards that work without problems to help you visualize the problem.
Attachments
27c322-snes.png
poorstudenthobbyist
Posts: 252
Joined: Fri Jun 24, 2016 4:20 pm

Re: I wrote up a "brief" explainer on SNES cartridges

Post by poorstudenthobbyist »

Ice Man wrote: Fri Feb 14, 2020 11:54 am That's exactly the issue.
74'139 1Y3 (pin 7) is not connected to the 27C322/CE nor /OE line at all as it will cause conflicts between ROM and RAM (at least it did for me with some SRAM games).

27C322 /CE and /OE are both to be connected to GND since the Multiplexers (74'257) /OE inputs (pin 15) are controlled by 74'139 1Y3 (pin 7) output.

I once did the same and quite a few games were crashing or not saving at all. Of course this only applies to LoROM games.
The 74'257 /OE inputs are directly connected to SNES /OE (cart 49) on HiROM games.

Here's a schematic cutout of one of my boards that work without problems to help you visualize the problem.
I don't see why there'd be an issue, the logic checks out either way. The decoder should guarantee the ROM and RAM are never activated at the same time.
Ice Man
Posts: 547
Joined: Fri Jul 04, 2014 2:34 pm

Re: I wrote up a "brief" explainer on SNES cartridges

Post by Ice Man »

That's what I thought to since I accidentally had 74'257 /OE connected to SNES /OE at the very first while EPROM /OE was connected to 74'139 1Y3 and /CE GNDed. Maybe that was my mistake but either way. Using the schematic above has worked for me for years, too. :P
If it works for you as well, no reason to overcomplicate things. ;)
Post Reply