Famicom Expansion Port Multiplexer

Discuss hardware-related topics, such as development cartridges, CopyNES, PowerPak, EPROMs, or whatever.

Moderators: B00daW, Moderators

Post Reply
emerson
Posts: 34
Joined: Fri Nov 18, 2016 7:29 am

Famicom Expansion Port Multiplexer

Post by emerson » Sat Apr 25, 2020 10:57 am

=====UPDATED V2 schematic and logisim files=====
- /IRQ circuitry removed
- changed circuit to handle positive idle clock lines
- added pull-up resistors to peripheral $4017 data lines

I've been playing with the idea of having multiple peripherals connected to the famicom expansion port and came up with this potential solution. The circuit has only been simulated and hasn't been tested on real hardware. My hope is that people will provide feedback on design considerations and flaws before I move toward hardware testing. Attached are the files I created using Logisim if you care to simulate my circuit. Logisim is a free digital simulation software I discovered just a few days ago and has a very easy learning curve. You can find it here: http://www.cburch.com/logisim/

This circuit functions like a multiplexer for all the digital I/O signals on the expansion port, allowing you to have up to 8 addressable expansion ports. Only one port can be active at a time. Once a port is active, the circuit becomes passive and communication between the console and peripheral can proceed as normal.

When the circuit is in program mode and/or when a port is not active, $4016.OUT2-0 at the peripherals become high impedance. Therefore, pull-up/down resistors are needed to hold peripherals in a standby condition when not in use. This was intentionally designed for peripherals like the gameboy printer that require a specific idle state. On the console side, $4016.D1 and $4017.D4-1 become high impedance and the /IRQ line is held high during program mode.

The desired port is made active by the following sequence:
- Write $07 to $4016 then read $4016 to pulse the clock line. This puts the circuit in program mode.
- Write the desired port # ($00-$07) to $4016 then read $4016. This writes the contents of $4016.2-0 to the circuit's address latches, enabling the desired port. Although the port is now enabled, it cannot yet communicate with the console.
- Write the desired initial condition of the new port to $4016 then read $4016. This makes the new port active and communication with the console is now possible.

The following code would enable the Family Basic Keyboard on port 2. In theory, if we configure the resistors on the port 2 OUT2-0 lines to hold the keyboard in its reset state ($05) while the port is idle, you could immediately begin reading the keyboard once the port is active.

Code: Select all

;-----put circuit in program mode-----
lda shadow_4016
ora #$07
sta shadow_4016
sta $4016          ;write $07 to $4016
lda $4016          ;and pulse the $4016 clock line

;-----enable the new port-----
lda shadow_4016
and #$02
sta shadow_4016
sta $4016          ;write the desired port # to $4016
lda $4016          ;and pulse the $4016 clock line

;-----activate port and begin reading the keyboard-----
lda shadow_4016
and #$f8
ora #$04
sta shadow_4016     ;write the initial condition to $4016
sta $4016           ;and pulse the $4016 clock line

;-----communication between console and peripheral can proceed as normal from here-----

Here are some design considerations I've had thus far (in no particular order):
- This circuit will require a separate power supply (not shown in schematic) and provide the power to all peripherals.
- an analog multiplexer could be used for the sound input if desired.
- The 74hc244 chips used for the $4017 data lines could be replaced with 74hc151 and addressed using the q2-q0 lines from the 74hc173. The potential advantages of this would be that $407 D4-1 would be logic 0 instead of high impedance when the circuit is in program mode, and I imagine it would require less pcb traces to route all the necessary signals.
- The combination 74hc151 + 74hc173 essentially create a 74hc356, so a '356 could be used if you have one on hand. I couldn't find them on the mouser website so I chose the '151 + '173 combination.
- The theory behind the two OR gates that buffer the clock signal input of the 74hc74 is to utilize their propigation delay and keep the '74 Q1 high long enough so that the clock signal through the AND gate will properly load the OUT2-0 data to the address latches before Q1 goes low.
- Because loading $07 on the OUT2-0 lines is required to enter program mode, the active peripheral will see this value before the circuit is put in program mode. This was intentional so that $07 could be used as a peripheral command if desired. If a peripheral would somehow be damaged by receiving $07 on the OUT2-0 lines, additional circuitry will be necessary to protect it.


This is the updated v2 schematic
nes_exp_port_multiplexer.png
Attachments
famicom_exp_port_multiplexer_v2.zip
(96.5 KiB) Downloaded 72 times
Last edited by emerson on Sat Apr 25, 2020 5:12 pm, edited 1 time in total.

lidnariq
Posts: 10667
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: Famicom Expansion Port Multiplexer

Post by lidnariq » Sat Apr 25, 2020 11:10 am

I don't really have any thoughts about the primary purpose you've gone for here, but only two tiny points:

As far as we know, there aren't any expansion port devices that use /IRQ, and
Similarly, the only expansion port devices that we know that use the SOUND pin use it for headphones, not to mix sound in.

emerson
Posts: 34
Joined: Fri Nov 18, 2016 7:29 am

Re: Famicom Expansion Port Multiplexer

Post by emerson » Sat Apr 25, 2020 11:32 am

I didn't have a personal use for the /IRQ line but I figured I'd add it for the sake of completeness. So if I understand correctly, the sound pin is actually an output and not an input?

The idea behind this circuit started when I wanted to have both the family basic keyboard and gameboy printer connected at the same time. I started designing that circuit and figured I should make something more universal that could be expanded to support more devices if needed. This circuit can easily be scaled to support 2, 4, 6,or 8 devices.

lidnariq
Posts: 10667
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: Famicom Expansion Port Multiplexer

Post by lidnariq » Sat Apr 25, 2020 11:46 am

emerson wrote:
Sat Apr 25, 2020 11:32 am
I didn't have a personal use for the /IRQ line but I figured I'd add it for the sake of completeness.
I mean, I don't think anyone else did either.

... although now that I'm thinking on this a little more carefully, I think you need pullups all over the place before your '244s inputs.
So if I understand correctly, the sound pin is actually an output and not an input?
I mean, it's probably actually bidirectional, but all the existing hardware that we know of only uses it as an output.
The idea behind this circuit started when I wanted to have both the family basic keyboard and gameboy printer connected at the same time.
The lack of a printer interface does seem to be a conspicuous shortcoming relative to other "real" computers of the early 1980s.

emerson
Posts: 34
Joined: Fri Nov 18, 2016 7:29 am

Re: Famicom Expansion Port Multiplexer

Post by emerson » Sat Apr 25, 2020 12:20 pm

... although now that I'm thinking on this a little more carefully, I think you need pullups all over the place before your '244s inputs.
For what it's worth, after reading a few websites, it seems like as long as the CMOS input is driven by another gate i should be okay. Unless this is specific to the 74hc244? It seemed like I saw more mention of pull-down resistors at CMOS inputs than pull-up, around 10k ohms per power supply volt. I'll have to pull out my textbooks and see if they have any info on the matter.

lidnariq
Posts: 10667
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: Famicom Expansion Port Multiplexer

Post by lidnariq » Sat Apr 25, 2020 12:32 pm

No, this is for logic values, not avoiding invalid inputs. Your multiplexer drives all the inputs all the time, but the original peripherals didn't (and instead had pull-up resistors inside the Famicom that you're overriding with the '244s)
Last edited by lidnariq on Sat Apr 25, 2020 1:50 pm, edited 2 times in total.

emerson
Posts: 34
Joined: Fri Nov 18, 2016 7:29 am

Re: Famicom Expansion Port Multiplexer

Post by emerson » Sat Apr 25, 2020 1:08 pm

Ahh okay, that makes sense now. Looking at the schematics on the Console5 website and Enri's page on the keyboard, the OUT2-0 lines do not have pull-up resistors in either the console or name brand peripherals. Some third party controllers do though.

Based on what I've learned over the past few hours, some 100k resistor networks on the four $4017.D4-D1 '244 inputs should do the trick. I think I should buffer the OUT2-0 lines as well to negate excess current draw from the CPU. I'll post an updated schematic later.

lidnariq
Posts: 10667
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: Famicom Expansion Port Multiplexer

Post by lidnariq » Sat Apr 25, 2020 1:47 pm

If you're using 74HC, HCT, AC, or ACT parts, you don't need extra buffers - they already have very low input current by design, and thus very high fan-out. But do be careful if you're using ALS or any other TTL technology.

Oh, and you want '137s, not '237s. The clock lines are idle high.

emerson
Posts: 34
Joined: Fri Nov 18, 2016 7:29 am

Re: Famicom Expansion Port Multiplexer

Post by emerson » Sat Apr 25, 2020 5:15 pm

Thank you lidnariq for the help. Schematic and logisim files have been updated.

User avatar
Ben Boldt
Posts: 860
Joined: Tue Mar 22, 2016 8:27 pm
Location: Minnesota, USA

Re: Famicom Expansion Port Multiplexer

Post by Ben Boldt » Sun Apr 26, 2020 7:08 am

Just a quick comment when it comes time to build this -- note that the Famicom's expansion connector is too deep and pins too thick to use a normal D-Sub DA-15 connector. Correct connectors can be harvested from Famicom or Neo Geo controller extension cables, modern ones available on AliExpress.

For example:
https://www.aliexpress.com/item/4000743628492.html

Pokun
Posts: 1918
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: Famicom Expansion Port Multiplexer

Post by Pokun » Sun Apr 26, 2020 9:32 am

Tototek also carries them. That's where I usually get them from, but it seems they have problems with shipping now.

krzysiobal
Posts: 886
Joined: Sun Jun 12, 2011 12:06 pm
Location: Poland

Re: Famicom Expansion Port Multiplexer

Post by krzysiobal » Sun Apr 26, 2020 10:26 am

You can use the regular DB15 female socket, just remove the metal shielding, outer plastic part and remove the six notches.
Now you can solder it to PCB (like shown in the 9-to-15 pin adapter picture) or solder wires and safe them using hot glue.
Image

Using existing cables with plug you need to pay attention if they have all wires you need (I doubt those expansion cables have all 15 wires).

---

Here is how I did 4 player adapter to Famicom expansion port (you can connect either 9/15/7 pin joypad).
Pins used for 7 pin joypad port are harvested from.. male DB pins :D

Image Image Image

emerson
Posts: 34
Joined: Fri Nov 18, 2016 7:29 am

Re: Famicom Expansion Port Multiplexer

Post by emerson » Sun Apr 26, 2020 2:01 pm

Yes I am aware of the deeper sockets, thanks anyhow for the head's up. I plan on modding standard db15 connectors for testing.

I found these neo geo controller replacement cables which show all 15 wires are present. They also have cable strain relief is a nice addition.

https://www.ebay.com/itm/Controller-cab ... SwaJFeeMz3
https://www.aliexpress.com/wholesale?ca ... t=Neo-003a

User avatar
Ben Boldt
Posts: 860
Joined: Tue Mar 22, 2016 8:27 pm
Location: Minnesota, USA

Re: Famicom Expansion Port Multiplexer

Post by Ben Boldt » Sun Apr 26, 2020 5:14 pm

I had initially bought some normal female DB15 connectors myself and modified them to go deeper as well, but I found that the contacts inside were too tight. I could feel that I was only engaging just the tips of the pins. Maybe mine are different or I just needed to push harder.

Post Reply