SNES /OE and /CE - Which is which?

Discussion of hardware and software development for Super NES and Super Famicom.

Moderator: Moderators

Forum rules
  • For making cartridges of your Super NES games, see Reproduction.
Post Reply
Ziggy587
Posts: 138
Joined: Fri Oct 08, 2010 6:08 pm
Location: NY, USA

SNES /OE and /CE - Which is which?

Post by Ziggy587 »

I'm having a hard time confirming which pin on the SNES cart edge is Chip Enabled and which is Output Enabled.

Code: Select all

                   +--------+
     21.477MHz Clock |  1  32 | /WRAM
              EXPAND |  2  33 | REFRESH
                 PA6 |  3  34 | PA7
               /PARD |  4  35 | /PAWR
                     |--------|
                 GND |  5  36 | GND
F                A11 |  6  37 | A12
r                A10 |  7  38 | A13
o                 A9 |  8  39 | A14
n                 A8 |  9  40 | A15
t                 A7 | 10  41 | A16
                  A6 | 11  42 | A17
o                 A5 | 12  43 | A18
f                 A4 | 13  44 | A19
                  A3 | 14  45 | A20
c                 A2 | 15  46 | A21
a                 A1 | 16  47 | A22
r                 A0 | 17  48 | A23
t               /IRQ | 18  49 | /CART
                  D0 | 19  50 | D4
                  D1 | 20  51 | D5
                  D2 | 21  52 | D6
                  D3 | 22  53 | D7
                 /RD | 23  54 | /WR
   CIC out data (p1) | 24  55 | CIC out data (p2)
    CIC in data (p7) | 25  56 | CIC in clock (p6)
              /RESET | 26  57 | CPU_CLOCK
                 Vcc | 27  58 | Vcc
                     |--------|
                 PA0 | 28  59 | PA1
                 PA2 | 29  60 | PA3
                 PA4 | 30  61 | PA5
    Left Audio Input | 31  62 | Right Audio Input
My guess would be that pin 49 is /CE (aka /CS) and pin 23 is /OE. However...

Image

This is the mask ROM pinout that I see everywhere. Using this ROM pinout and my multimeter, it's telling me that...

Cart edge pin 49 (/CART) goes to mask ROM pin 31 (/OE)
Cart edge pin 23 (/RD) goes to mask ROM pin 22 (/CE)

I once read (in this post), in reference to /CE, that ROMlab is messed up. I also recall once reading in another thread on NesDev (although I cannot find it now) that SNES /CE and /OE are often confused.

So my question is, definitively, which is which?
tepples
Posts: 22345
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: SNES /OE and /CE - Which is which?

Post by tepples »

In theory, for a Game Pak without save RAM, /CART goes to the ROM's /CE and /RD goes to /OE. /CE is used to tell the chip whose turn it is. When it's high, the memory enters a low-power state and doesn't respond to /OE or /WE. /OE is used to tell the chip to drive data on the bus. When it's high, the memory leaves D0-D7 in a high impedance state. A memory responds faster to /OE going low than to /CE going low.

But in practice, when using cheap slow ROM, swapping /CE and /OE may improve timing margins at the cost of power consumption. A definitive answer would require logic analyzer traces of /CART and /RD so we can see their expected timing relative to the 21.47 MHz master clock.
lidnariq
Posts: 10677
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: SNES /OE and /CE - Which is which?

Post by lidnariq »

tepples wrote:But in practice, when using cheap slow ROM, swapping /CE and /OE may improve timing margins at the cost of power consumption.
Not in the specific case of the SNES, where /ROMSEL is evaluated continuously as a function of only A23…A17&A15, ignoring any other signal.

Reversing them would actually pessimize response time and would have an unknown net effect on power consumption, because SNES /RD goes true (low) partway through each memory access cycle, while /ROMSEL is more-or-less asserted continuously.
A definitive answer would require logic analyzer traces of /CART and /RD so we can see their expected timing relative to the 21.47 MHz master clock.
We actually have those, thanks to Poot36. (At least, for everything except timing of the extra-slow 12-cycle operations)
qwertymodo
Posts: 775
Joined: Mon Jul 02, 2012 7:46 am

Re: SNES /OE and /CE - Which is which?

Post by qwertymodo »

The cart slot pinout is correct. Nintendo likes to swap the signals on their MaskROMs arbitrarily (i.e. sometimes they will swap which signal gets connected to which pin, the ROM chips themselves are going to stay the same). Sometimes, they'll even do weird things like grounding /CE, and then connecting the /CE signal to the /OE pin. The way to tell the difference is with a logic analyzer or oscilloscope. The one that toggles a lot is /OE. Something like this

download/file.php?id=1028&mode=view

It's important to distinguish between the pinout and the actual signals. The actual signal is what's coming out of the CPU, and they will look like that screenshot, with /CE toggling far less often than /OE or /WE. That's not always the case, sometimes /CE will toggle in tandem with /OE or /WE, but when you have one sitting low and the other toggling regularly, the one staying static is /CE. On the "device" side (e.g. the cart), you can often get away with weird things like Nintendo does. That doesn't actually mean that the /OE and /CE pins are different from one ROM to the next, it just means that because of the way MaskROMs work, they're able to get away with feeding the /CE signal to the /OE pin and vice versa.

So, I guess all of that to say, trust the cart slot pinout. What happens on the cart is up to whoever traced out the PCB.
Ziggy587
Posts: 138
Joined: Fri Oct 08, 2010 6:08 pm
Location: NY, USA

Re: SNES /OE and /CE - Which is which?

Post by Ziggy587 »

Interesting. Thanks for the info, guys!
Post Reply