Infinite NES Lives teases expansion port dongle

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

Moderator: Moderators

User avatar
infiniteneslives
Posts: 2104
Joined: Mon Apr 04, 2011 11:49 am
Location: WhereverIparkIt, USA
Contact:

Re: Infinite NES Lives teases expansion port dongle

Post by infiniteneslives »

Can someone explain what the potential applications (uses) are of the expansion port?
In regards to this thread the use of the expansion port is to simply support expansion audio synthesizers included on cartridges to be mixed in with the APU audio. This adapter effectively provides the same cartridge audio expansion abilities built into the stock famicom.
If you're gonna play the Game Boy, you gotta learn to play it right. -Kenny Rogers
User avatar
B00daW
Posts: 586
Joined: Thu Jan 03, 2008 1:48 pm

Re: Infinite NES Lives teases expansion port dongle

Post by B00daW »

Are there any Famicom>NES cart converters that map the expansion audio pins?
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: Infinite NES Lives teases expansion port dongle

Post by lidnariq »

In practice, the NES expansion port is:
* All the pins on the NES controllers
* All the pins on the Famicom expansion port
* Enough extra signals to control all 8 bits on reads of $4016 or $4017
* Mixer input into the audio path
* Output from both the video and audio paths
* The 10 "expansion" pins on the 72-pin NES cartridge
* A few random other signals from the PPU (/NMI) or CPU (A15, data bus)

So ... what can it be used for?

It could be used for a Sega 32X-style video overlay, but there's no particularly great way to signal when the 2A03 is talking to whatever video overlay device is attached. (Things could be done. They'd work. They're just not great.)

One could connect OUT0...OUT2 via the expansion pins to the cartridge connector, which would only really be useful for making small discrete logic games slightly cheaper.

Otherwise ... almost everything else that comes to mind would just serve to make it more like a Famicom.
User avatar
infiniteneslives
Posts: 2104
Joined: Mon Apr 04, 2011 11:49 am
Location: WhereverIparkIt, USA
Contact:

Re: Infinite NES Lives teases expansion port dongle

Post by infiniteneslives »

B00daW wrote:Are there any Famicom>NES cart converters that map the expansion audio pins?
Yes:
infiniteneslives wrote:
The market for playing japanese games is not exactly the same as the market for playing homebrew. This thing covers both the first and potentially the future of the latter.
Indeed, I've designed up some famicom to NES converter boards as well that properly send cart audio down to the expansion port via EXP6 which most adapters don't provide. They also properly handle mirroring to support 4 screen carts which is a common flaw with adapters on the market. I'll be bundling the famicom to NES adapter and solderless expansion audio board together for a price comparable to other adapters on the market which run for ~$25-30.
Attachments
INL famicom to NES adapter with audio -> EXP6, and proper mirroring.
INL famicom to NES adapter with audio -> EXP6, and proper mirroring.
If you're gonna play the Game Boy, you gotta learn to play it right. -Kenny Rogers
User avatar
Myask
Posts: 965
Joined: Sat Jul 12, 2014 3:04 pm

Re: Infinite NES Lives teases expansion port dongle

Post by Myask »

…echo feedback device.
User avatar
dougeff
Posts: 3079
Joined: Fri May 08, 2015 7:17 pm

Re: Infinite NES Lives teases expansion port dongle

Post by dougeff »

Could it...
-connect to a coprocessor
-connect to an external clock
-connect to an external RAM
nesdoug.com -- blog/tutorial on programming for the NES
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: Infinite NES Lives teases expansion port dongle

Post by lidnariq »

There's no meaningful address bus present. This makes most connectivities difficult.

Basically, if the interface can be two 7-bit read-only ports (because it's shared with the joypads) and one 3-bit write-only port, then it can be an exclusively-expansion port peripheral.

Otherwise, it requires help from the cartridge (such as relaying /RDCE and /WRCE and some of the address bus over the 10 EXP pins). But once you've put something in the cartridge, it's a lot harder to justify not just putting all the relevant hardware in the cartridge.

So...
dougeff wrote:-connect to a coprocessor
Technically yes, but getting data between the 2A03 and coprocessor would be obnoxious.
-connect to an external clock
Basically no way to make it useful. We mayn't drive /NMI from the expansion port (the 2C02 wasn't designed to share) , and we don't have access to /IRQso I guess you could put an RTC with alarms or PIT there...
-connect to an external RAM
If said external memory used an I2C or SPI-like protocol, then ... sure, as above. Generic random-access parallel memory? Not so much.
Last edited by lidnariq on Fri Jul 07, 2017 8:25 pm, edited 2 times in total.
User avatar
Myask
Posts: 965
Joined: Sat Jul 12, 2014 3:04 pm

Re: Infinite NES Lives teases expansion port dongle

Post by Myask »

"what's possible on the expansion port" really should be forked…

https://wiki.nesdev.com/w/index.php/NES ... ort_pinout

for RAM, without further connections I think the best you get is what the CPU has with the PPU, an address port (multi-write) and a data port; and at that, the cartridge has to compute the "is this mapped to an expansion operation" and which and convey those (and R/W) via the EXP pins.

that's 1023/512 possible ports; 511/256 if you're using an EXP pin for cart-generated audio [but you could have the expansion part do it] (Yes, you can abuse the OAM DMA to get a faster burst, but it's slower overall and that's limited to blanking.)

for a coprocessor…sure? The only advantage over on-cart is that it's a single purchase rather than per-cart; you have to contend with the above throughput limit, else.
for an external clock…no, you can't connect it to the NES's CPU that way, so not much point.

argh, ninja'd again.
lidnariq wrote: But once you've put something in the cartridge, it's a lot harder to justify not just putting all the relevant hardware in the cartridge.
Adding [controller] ports like the ENIO did is a decent reason.
User avatar
B00daW
Posts: 586
Joined: Thu Jan 03, 2008 1:48 pm

Re: Infinite NES Lives teases expansion port dongle

Post by B00daW »

Awesome converter.

The expansion audio connector is a great idea for a stand-alone concept.

It would be great to get an all-in-one experience like the ENIO and potentially all the other possible implementations of the EXP connector as a higher-end model. :)
User avatar
infiniteneslives
Posts: 2104
Joined: Mon Apr 04, 2011 11:49 am
Location: WhereverIparkIt, USA
Contact:

Re: Infinite NES Lives teases expansion port dongle

Post by infiniteneslives »

B00daW wrote:It would be great to get an all-in-one experience like the ENIO and potentially all the other possible implementations of the EXP connector as a higher-end model. :)
The ENIO exp board is still being made and available for purchase on eBay for $30. If you'd like full connectivity I'd recommend purchasing that. I have no interest in the large amount of manual machining needed to hack off the shelf components to mate with all exp pins. Using my method here to mate with all/many exp pins is also impractical. I did have a connector company quote the manufacture of proper exp female connectors and it was prohibitively expensive. Starting around $10k for a few connectors, and upwards of $30k for a decent per unit cost.

Those are all things I considered before landing on this idea since my primary goal was providing a means to make the audio resistor mod solderless while also being easily manufactured. This device meets that goal.
If you're gonna play the Game Boy, you gotta learn to play it right. -Kenny Rogers
User avatar
Memblers
Site Admin
Posts: 4044
Joined: Mon Sep 20, 2004 6:04 am
Location: Indianapolis
Contact:

Re: Infinite NES Lives teases expansion port dongle

Post by Memblers »

infiniteneslives wrote:
For what can be synthesized with an MCU, you have the STM8 in mind?
I really only have the stm8 in mind for a minimalist homebrew synth as it could be integrated into the CIC's mcu giving discrete mappers expansion audio on the cheap. I'm somewhat hopeful the stm32f030 running ~48Mhz with dual PWM DAC may be able to decently replicate some original audio expansions like VRC6, sunsoft5b, & FDS. I've yet to even start tinkering with them enough to be confident an stm32f0 will be adequate. Another consideration I've had is the stm32f051 as it includes a built in DAC for close to the price of a standalone DAC.
It looks like a single-cycle multiplier is optional in the M0 parts, that would be nice to have, if possible. 4 audio channels mixed at 48khz will be 192k multiplies per second. I'm sure that CPU could power through it anyways (maybe 20-30 cycles per multiply?). Those chips are mostly wavetable, so it'd be like one 24 or 32-bit addition, indexing sample, multiply, 16 or 24-bit add+accumulate. Number of CPU cycles that all takes * number of channels * sample rate. STM8 w/ multiplier likely could also passably emulate those chips at 48khz (probably best if coded in asm), compared to the M0 w/o multiplier the performance is probably about the same at the same clock rate (which it's not, so M0 comes out ahead :P))

I wonder how much those Cortex M4 with DSP features cost, I haven't checked. I noticed the PIC32MK is a new family that's around $5 with features that would be killer for audio, multiply+accumulate, saturation math, 1-cycle SIMD instructions, even floating point. Unfortunately they totally borked the parallel port slave mode on that one (would allow the NES to interface directly with the MCU). That port does work on the PIC32MZ but those parts are like $1.50 more (w/ more memory of course). I figure with that kind of MCU I should be able to do 32-channel audio with Squeedo 2.0, overkill extreme. :)

Anyways, a lot of the stuff I'm saying here is probably already known, I'm just kinda thinking out loud.
I imagine you would want an external clock too, if using an RC oscillator the audio will be out of tune.
Yes that's a good point, another potential solution would be to use a NES clock source multiplied by a PLL if the mcu provides one. But most internal RC oscillators are tuneable, perhaps the mcu could finely tune itself with a calibration routine at boot/post warmup.
One problem that shows up is that when the composer uses the NES and detuned expansion audio together, normally when you play a slightly detuned note in 2 channels you will get a phasing or "beating" effect (this is often used as an effect), if it's the same note+octave there are also cancellation effects (absolute worst case is summing 2 square waves perfectly aligned on opposite phases, the result would be a constant zero). The downside could be minimized by telling composers avoid using the same note on both soundchips, but to some degree it will still sound different on everyone's system. If the effect is noticable on different octaves too, then this becomes pretty darn hard to avoid. :| I don't know if people would consider it endearing or janky, could go either way but I'm sure that some chiptuners won't like that aspect of it.
User avatar
rainwarrior
Posts: 8732
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Infinite NES Lives teases expansion port dongle

Post by rainwarrior »

infiniteneslives wrote:
rainwarrior wrote:I thought it was a disconnect switch. I find one necessary because some of my NES carts seem to leak a buzzing noise through it otherwise.
Well it could be if the 47k fixed resistor is simply omitted. I haven't experienced any such buzzing with my fixed 47k over the years so I hadn't imagined a disconnect as necessary/useful. I'm curious what the buzzing culprits are doing with EXP6.
It happens with a few of my NES cartridges. The one I remember doing it for sure is TMNT.

I can't really explain the buzzing. I don't think the cartridges in question connectted anything to the expansion pins when I checked the board, but I get a loudish 60hz buzz (or something similar) if I don't disconnect the audio mod when using them.

(Could be another explanasion though... maybe some crosstalk within my NES having to do with where specifically I routed the wires for the mod or something? Maybe it only comes up for particular cartridges because of some unusual power draw or PPU usage or something in them? Not sure.)
User avatar
FrankenGraphics
Formerly WheelInventor
Posts: 2064
Joined: Thu Apr 14, 2016 2:55 am
Location: Gothenburg, Sweden
Contact:

Re: Infinite NES Lives teases expansion port dongle

Post by FrankenGraphics »

That does indeed sound like electromagnetic interference/cross talk. Your ext audio line basically acts as an antenna loop, but this alone isn't an explanation. In general terms, a reason you might experience it in certain configurations but not others is if a line carrying the 60hz buzz suddenly increases in peak to peak voltage relative to audio peak to peak; becoming strong enough to influence your audio line. Or conversely; if your audio signal is too weak/cold (for example due to some opamp getting unexpected input) and then amplified/buffered up to standard volume again, thus also amplifying any crosstalk picked up along the way.

Avoid letting audio lines (victim) run in parallel to any line that might carry 60hz AC (source). You can often help isolate your audio signal with embedding or twisting it with a GND line (though here, much of the line is on the PCB). Ferrite beads on power line wires can also help. If not helping or applicable, a more thorough source/victim analysis should be conducted.

As last resort, you could implement a sharp high- or bandpass or comb filter at 60hz (+ harmonics), but a circuit breaker is probably much better anyway at this point.

EDIT: what are the typical pvp voltages of the ext. audio line, anyway? And what are they when you hear the noise? I was thinking an alternative (and very circumstantial) solution would be using reverse-direction germanium diodes, which typically have a breakdown voltage of 0.3v, sometimes less. You can get very fine tuned new-old-stock germanium diodes from anywhere in the former east bloc with even lower breakdown voltages. They could effectively act as a passive circuit breaker when the signal is low enough. The smaller the breakdown voltage, the more inaudible the difference would be when it is actually supposed to be sound on the line. They were used for this very purpose (signal detection) in radar systems, among other things. I could send a couple in a month if you want to experiment.

You can get even better results by gate:ing only the lower end of the spectrum this way, but that makes for a bit larger (still passive) circuit. Plus, filters affect phase (normally not audible).
User avatar
infiniteneslives
Posts: 2104
Joined: Mon Apr 04, 2011 11:49 am
Location: WhereverIparkIt, USA
Contact:

Re: Infinite NES Lives teases expansion port dongle

Post by infiniteneslives »

Memblers wrote:It looks like a single-cycle multiplier is optional in the M0 parts, that would be nice to have, if possible.
Yeah all the stm32 parts include the M0 hardware multiplier. Even the STM8 includes an 8bit hardware multiplier with 16bit result @ 4 cycles.
Memblers wrote: STM8 w/ multiplier likely could also passably emulate those chips at 48khz (probably best if coded in asm), compared to the M0 w/o multiplier the performance is probably about the same at the same clock rate (which it's not, so M0 comes out ahead :P))
The STM8 only runs up to 16Mhz compared to stm32 @ 48Mhz. I've tried SDCC as a C compiler for the STM8 and wasn't very impressed, there are other commercial compilers which are supposedly a little better, but I agree assembly is the only real option here. I was surprised how similar the STM8 is to the 6502, kinda like the 6502 on steroids. They both only have 3 registers A/X/Y, and similar addressing schemes including zero page so it was surprisingly familiar when I was writing my CIC implemenation.
Memblers wrote:I wonder how much those Cortex M4 with DSP features cost, I haven't checked.
The baseline stm32 with M4 is the stm32f401 but prob want to go with the stm32f410 which includes a DAC which goes for $2.60 in modest volumes (1k) on digkey. Crazy the beasts of mcu's you can get now for so little money... When you consider that a legit independent 12bit DAC runs ~$1, the M4 core is only costing ~$1.60...
rainwarrior wrote:I routed the wires for the mod or something
Thanks for the details on what you've seen with your setup rainwarrior. I'm curious how you did your mod. I'm used to people simply soldering a resistor between EXP6 and audio in directly on the back side of the EXP connector. If you've got some more elaborate setup with actual wires and such that would be my first guess as to the source of the problem. I've been recommending people solder the resistor directly to the EXP connector, and also been using an ENIO myself for a few years now and never heard of such issues. So honestly I'm not too worried about it. Good news is it's solderless, so worst case it's easy to remove rendering your console completely stock. This design has pretty minimal tracing comparable to soldering the resistor directly to the EXP connector. The EXP connector socket itself even has some shielding around it which might help.
If you're gonna play the Game Boy, you gotta learn to play it right. -Kenny Rogers
User avatar
rainwarrior
Posts: 8732
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Infinite NES Lives teases expansion port dongle

Post by rainwarrior »

infiniteneslives wrote:
rainwarrior wrote:I routed the wires for the mod or something
Thanks for the details on what you've seen with your setup rainwarrior. I'm curious how you did your mod. I'm used to people simply soldering a resistor between EXP6 and audio in directly on the back side of the EXP connector. If you've got some more elaborate setup with actual wires and such that would be my first guess as to the source of the problem. I've been recommending people solder the resistor directly to the EXP connector, and also been using an ENIO myself for a few years now and never heard of such issues.
It's two wires from the two pins on the opposite side of the expansion port (EXP / Audio) connected to a 100k pot mounted on the back of the NES. (The pot also has a disconnect.) I'd have to take my NES apart to check, but I think they just run in a straight line to the left hand side of the NES and then along the border of the case to the rear-left of the NES where the pot is. The two wires are probably twisted together.

This noise only happens with a few specific NES cartridges. On most (including PowerPak, or Famicom carts with expansion audio through an adapter) there is no audible difference between disconnected or not.

Though, I would also say that it's pretty normal for there to be similar noise on the NES' audio to begin with, unrelated to the mod. The only reason I can distinguish this noise from that noise is that I do have a volume knob and disconnect switch that I can use to turn it on and off and hear the difference. If I had just soldered a 47k resistor directly to the board I'd have no way of knowing the difference between buzzing coming through that or from other normal sources, since I wouldn't be able to turn it off by itself. (So... "never heard of such issues" isn't really good evidence that the problem doesn't exist, in my view? You'd have to have a way to compare to be able to notice. I'm not electrical engineer though, so I can't speculate whether this is a plausible problem for the adapter, just it's something that seems to be one for my mod.)

Also, having an easily accessible pot is very useful, even if you only want to use it with a PowerPak-- the PowerPak's expansion audio implementations are not very well balanced, IMO.
FrankenGraphics wrote:(various suggestions) but a circuit breaker is probably much better anyway at this point.
Yes, the disconnect switch already solves the problem completely. I really would not want to build some sort of filter or gate in there, the whole point is to receive the expansion audio!
Last edited by rainwarrior on Tue Jul 11, 2017 2:15 pm, edited 1 time in total.
Post Reply