It is currently Fri Dec 15, 2017 7:14 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 25 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Tue Nov 23, 2004 10:13 pm 
Offline

Joined: Tue Nov 23, 2004 9:35 pm
Posts: 634
I always thought the Famicom's audio path was rather odd, at least how it related to special chips. But today, after looking at the Famicom's schematics I finally figured it out. After the 2A03's internal five channel audio is outputted and mixed (any input from the second controller's built-in microphone is added at this point), it goes to the cartridge connector pin #45. If there is extra sound hardware in the cartridge the sound will be mixed with the NES's internal sound, then be outputted from pin #46 to the audio output and thence to the speakers. If there is no sound hardware on the cartridge, then the cartridge will connect pins #45 and #46 together, making a loop that goes straight to the audio output without further ado.

On the NES, the addition of the unused expansion port complicates matters somewhat. The NES's audio is routed straight to an RCA jack and the RF circuitry. Pin #3 is audio input. This allows sound produced on a cartridge to be mixed with the NES's sound. In contrast to the Famicom, which mixed expansion sounds in the cartridge, the NES must mix the sounds inside the console itself. All you have to do is get pin the Famicom cartridge's pin #46 to pin #3 of the expansion connector.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 24, 2004 9:14 am 
Offline

Joined: Sun Nov 14, 2004 11:24 am
Posts: 330
I solved this problem a different way.
Inside the NES there is junction point where audio from the input of the 2A03 is mixed with the input of the bottom connect, its easy to spot because there are 3 22K resistors lined up.
I used an unused pin (typically) of the NES edge connector (pin 18), passed it from pin 46 of the famicom (audio out), through a 4.7uF non-polar cap and a 100K resistor to raise the impedance, into one of the 22k resistors (audio junction).
It works great, Akumajo Densetsu sounds great, as does the FDS (another story).

I'll tryand get pictures.


Top
 Profile  
 
PostPosted: Mon Oct 02, 2017 12:59 am 
Offline
User avatar

Joined: Sun Nov 25, 2012 5:28 am
Posts: 23
Location: Adelaide, Australia
Apologies for resurrecting an old thread, but it seemed the most appropriate place to ask my question...

What signal / voltage level is expected at that 22K resistor, coming in from the NES expansion port?

I would like to directly attach a 0-5V PWM signal from a microcontroller, but my feeling is that is going to overload or distort the input, and will probably need some extra circuitry in place?


Top
 Profile  
 
PostPosted: Mon Oct 02, 2017 3:03 pm 
Offline
User avatar

Joined: Sun Nov 25, 2012 5:28 am
Posts: 23
Location: Adelaide, Australia
OK, some more digging, there aren't 3 x 22K resistors - actually 2 x 20K and 1 x 12K.

Looking at schematics, 'Audio In' (pin 3 on the Expansion Port) feeds into R9 (20K resistor) before the 'amplifier' circuit... so definitely seems like putting 5V into a circuit that expects something much smaller, needing amplification, is a bad idea.

Would adding in a 47K resistor for a total of 67K resistance (as seems to be the standard for audio coming from a PowerPak) be enough to safely input the 5V signal?

Attachment:
dscn0510.jpg
dscn0510.jpg [ 103.05 KiB | Viewed 825 times ]

Attachment:
NESAudio.gif
NESAudio.gif [ 4.15 KiB | Viewed 825 times ]

Attachment:
schem4.jpg
schem4.jpg [ 122.22 KiB | Viewed 825 times ]


Top
 Profile  
 
PostPosted: Mon Oct 02, 2017 3:24 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 6526
Location: Seattle
It's hard to give you a straight answer without directly measuring the voltages on CPU pins 1/2.

You can be confident, however, that if you choose the same voltage range as CPU pin 1, due to the 20kΩ resistor from the expansion port, it'll be the same voltage (loudness) after all three signals are mixed together.

If you want to use a 5Vpp source, and CPU pin 1 is less than 5 Vpp, then you should be able to effectively match the volume by setting the currents to match—e.g. if Vpp(one pulse wave at maximum volume) is 1V, and you want your output to be the same volume, then adding 80k in series should make the volumes match. (80k+20k=100k ; 100k/20k = 5 = 5V/1V)


Top
 Profile  
 
PostPosted: Tue Oct 03, 2017 8:18 pm 
Offline
User avatar

Joined: Sun Nov 25, 2012 5:28 am
Posts: 23
Location: Adelaide, Australia
lidnariq wrote:
It's hard to give you a straight answer without directly measuring the voltages on CPU pins 1/2.


Absolutely. Your reply was very helpful though, thanks!

Dug out my PropScope and the NES today and took some measurements from those CPU pins. Showed a voltage range of around 0.3V (ranging from around -0.226V to +68.9mV).

So I should be aiming to attenuate that 5V signal down to around 0.3V then?

Attachment:
0.png
0.png [ 233.69 KiB | Viewed 757 times ]


PS. Testing was done using the 'test2-mmc3.nes' ROM from https://ahefner.livejournal.com/12368.html - pulse set to full volume:

Attachment:
test2-mmc3-0.png
test2-mmc3-0.png [ 2.24 KiB | Viewed 757 times ]


Top
 Profile  
 
PostPosted: Tue Oct 03, 2017 8:59 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 6526
Location: Seattle
uXe wrote:
So I should be aiming to attenuate that 5V signal down to around 0.3V then?
Depends on how many different audio signals your microcontroller is generating.

If you're just generating a single pulse wave, and you want that pulse wave to be the same volume at maximum as the NES's pulse waves, which are 0.3V, then yes; this attenuation could be achieved by putting an extra ≈313kΩ in series with R9. On the other hand, if you're mixing 4 waves, and you want all of them to be the same volume, you'd want to add ≈63kΩ.

But ... I have to admit I'm a little surprised it's only 0.3V. I'm also really surprised the voltage went negative: that's supposed to be a unipolar pull-up DAC inside the CPU (with an external 100Ω pulldown resistor)—nothing should be creating negative voltages here.


Top
 Profile  
 
PostPosted: Tue Oct 03, 2017 9:45 pm 
Offline
User avatar

Joined: Sun Nov 25, 2012 5:28 am
Posts: 23
Location: Adelaide, Australia
lidnariq wrote:
But ... I have to admit I'm a little surprised it's only 0.3V. I'm also really surprised the voltage went negative: that's supposed to be a unipolar pull-up DAC inside the CPU (with an external 100Ω pulldown resistor)—nothing should be creating negative voltages here.


I read something about negative current here:

http://nesdev.com/2A03%20technical%20reference.txt

+-----------+
| 4-bit DAC |
+-----------+
"This is just a standard 4-bit DAC with 16 steps of output voltage
resolution, and is used by all 4 sound channels. On the 2A03, rectangle wave
1 & 2 are mixed together, and are available via pin 1. Triangle & noise are
available on pin 2.

These analog outputs require a negative current source, to attain linear
symmetry on the various output voltage levels generated by the channel(s)
(moreover, to get the sound to be audible). Instead of current sources, the
NES uses external 100 ohm pull-down resistors."

Was reading another thread earlier that may help indirectly explain too, that this negative DC offset out of the CPU pins is corrected in the mixing / amplification circuit:

viewtopic.php?f=3&t=11432#p131160

Would be great if somebody else could confirm my readings on their own NES though.


Top
 Profile  
 
PostPosted: Tue Oct 03, 2017 10:05 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 6526
Location: Seattle
I have an oscilloscope, but unfortunately nothing resembling a useful test cart. (I still just have the ridiculous m218 cart I made)

Taking a random game and looking at pin 1, I see voltages approximately around 0.3V(max) and 0V(min)... so I guess the range is accurate.

(Did you set your 'scope to AC coupled? Or failed to connect ground? Not important, tho.)


Top
 Profile  
 
PostPosted: Tue Oct 03, 2017 10:34 pm 
Offline
User avatar

Joined: Sun Nov 25, 2012 5:28 am
Posts: 23
Location: Adelaide, Australia
Had to look up Mapper 218 - love it! :D

Good to at least have confirmation of the 0.3V - thanks again for all of your input on this!


Top
 Profile  
 
PostPosted: Wed Oct 04, 2017 5:30 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19346
Location: NE Indiana, USA (NTSC)
lidnariq wrote:
I have an oscilloscope, but unfortunately nothing resembling a useful test cart. (I still just have the ridiculous m218 cart I made)

I have an assembler. What would you like to see in a mixing test cart designed for mapper 218?


Top
 Profile  
 
PostPosted: Wed Oct 04, 2017 10:34 am 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 6526
Location: Seattle
If you're offering your time...

There's two separate measurements to be made. Pin 1, for the pulse waves, is simpler. There doesn't seem to be any realistic bandwidth constraints, so just picking the maximum frequency, a 3/4 duty cycle, and letting me adjust the volume for each of the two channels independently, would be good enough.

Pin 2 is a little hairier because the triangle wave can't be set to a fixed value — at least not without trying tying CPU pin 30 to CPU A3. It doesn't seem wrong to just ignore it and just set the pulse wave volume and DPCM DAC. Although maybe some cleverness can ease measurements of the triangle wave as well?

... huh, to describe the actual problem is to put it in scope.


Top
 Profile  
 
PostPosted: Wed Oct 04, 2017 1:28 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5898
Location: Canada
lidnariq wrote:
the triangle wave can't be set to a fixed value

You can advance its position by a fixed amount, though. If you're willing to take 32 measurements you could put it into every phase? (Or with live/interactive measurement you really could just set the phase how you want this way.)


Top
 Profile  
 
PostPosted: Wed Oct 04, 2017 1:37 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19346
Location: NE Indiana, USA (NTSC)
I forget: Does the Reset button do anything to triangle phase? Or should this be included in the test ROM?


Top
 Profile  
 
PostPosted: Wed Oct 04, 2017 1:53 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 6526
Location: Seattle
The triangle phase, tri_c0 through tri_c4, is cleared on reset. For example, check visual2a03 t13993.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 25 posts ]  Go to page 1, 2  Next

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group