uXe wrote:

The 'resistors' (actually just lumps of 'resistive material') in a NES GamePad are actually 38K, not 10K. Here's an old Ben Heck article with some more detail:

http://www.extremetech.com/extreme/7468 … ent-system

and here's an example of 10K resistors not working in a project:

http://forums.modretro.com/viewtopic.ph … mp;t=10742

Yes thanks, it's been a while since I measured them but now that you pointed it out I remember a high value.

Did not know that they had to be so high to work properly. Wonder if that is due to a current limit on the 5v line to the Pad? Or a current limit with the 4021's pins? A smaller pull up would have faster switching between Low to High or High to Low but wouldn't think that would be an issue. Perhaps lower values sag the Vdd to the chip too much?

Will have to look into this, had planned to power my interface from the controller port but may have to self power it.
yogi

m00dawg wrote:

Wow thanks so much for all that awesome info, yogi!

Hmm so timing wise, if I'm at a BPM other than 150, I should generally be ok although going above 150 I might have issues? I actually don't know how much of the timing has been looked at in FamiSlayer or how much that would be an issue.

I'm also a bit confused on having to set the pin to INPUT or OUTPUT mode - is this is due to the CD4021? Bypassing it won't necessarily fix the issue directly will it and just hitting the serial interface directly?

Good call on Midi Thru. I new it was a simple mod, though I've never actually had to do it yet smile

With a midi clock higher or lower, you change the Tempo of the playback from what it sounded like in FamiTracker. What I was trying to say was: the standard playback rate is equal to 150 BPM regardless of the NSF's internal tempo. The recommended FamiTracker setting is to set for 150 BPM and adjust the Speed for the desired Tempo. This way the NSF matches with the NMI calling frequency. Now FamiSlayer is not tied to the NMI so even if the NSF was written for a Tempo of 80 BPM, it will only sound like that internal Tempo with a sync pulse stream equal to a clock BPM of 150.
How this will effect you is if you are syncing to a PC or LSDJ they should be close to that 150 BPM and the NES will sound normal. But if the master is running at a much slower tempo, like 75 BPM, the NSF would play back slower (not Pitch shifted. just much slower). So a 1/4 note will be as long as a 1/2 note and Bars will be longer. The same would happen in reverse for like 300 BPM.
So when composing you will have to preview on the HW to get the sound you want at the much slower or faster Clock BPM you'r using. May be able to adjust the Speed setting in FamiTracker to raise the effective tempo within the NSF, for when it's played slower.

With the CD4021. The GamePad circuit: a open button has the pin pulled to 5v, pressing the button = GND. If you use a bare 4021 you could drive it's pins with TTL signals, but active low logic. If you mod a GamePad you need to disable the Pull-Up Rs or use Open Drain. Most uCs don't have Open Drain outputs so we can simulate with the Port direction trick. Also by using the Open Drain, you can still use the GamePad for manual input.
The NES reads the GamePad with a SPI like interface. To directly connect from the Nes to the uC you need to set it as a SPI slave. I think this should be doable but the extra expense of a 50 cent chip to buffer things seems OK also. smile
Code wise there really isn't much difference between Set/Clr the Port.Pin direction bit or the Port.Pin data bit.
Yogi

m00dawg wrote:

Adding in the NES to the MIDI chain won't be really a big deal. As it's just clock sync I'll probably mod my current StageBoy to see if I can use MIDI Thru and then hook up whatever interface I end up with on the NES to that. The primary blocker was an NSF player that could respond to a clock, preferably with some transport controls (so it starts playing when it sees the first clock pulse).

If you want to go this route I would tap the TTL midi in from the opto and freed a 74hc00 for a midi thru, ala MB LTC. No code needed!
yogi

m00dawg wrote:

Yeah I'm trying to compile all this somewhat disparate data together. It looks like most solutions are just sending pulses? So all I would need is to add in the NES output section to the routine that handles LSDJ slave output to the GameBoy, maybe plus start/stop - I think smile

Well I was thinking that by watching the bytes sent out (if midi Thru is part of Arduinoboy code) a sync function would work with both the Arduinoboy in Master or Slave mode. Otherwise you will only output sync when the GB is slave, which may be fine also (?).

The basics of the timing:
Most NSFs are played within the NMI at a refresh of 60Hz. which works out to 3600 calls to the play frame address per Min.
This is the same as a Midi clock running at 150 BPM. The midi Clock messages occur at 24 ppqn, so at 150 BPM: 150 x 24 (ppqn) = 3600 tick bytes per Min. What I'm driving at is with a Clock running at 150 BPM your NSF should sound 'normal'. So there is no heavy math in the firmware, just detect the Midi Tick byte and pulse the trigger button.

The other issue is the connection to the CD4021 in the GamePad. The Buttons are active low logic; I.E. when 'Open' a 10K R pulls the pin high, Closed to GND. So to drive the 4021 pin we need to setup our uC for Open Drain: a 1 = Pin as Input, 0 = active GND. To press a button we Output a 0 and to release, idle the Pin as a Input (neither sourcing or sinking);
1. During Init, set output Pin latch data to 0 for each GamePad button we want.
2. Then switch Pin between Input and Output for triggering a button (output to trigger, input for release). Beware: with the PIC, there are issues with the Read-Modify-Write structure of the ports, but I don't think the AVRs suffer from this.

For Start/Continue/Stop just need to switch the 2nd Pin direction according to the received message; Start/Continue = button pressed, Stop = Button released. FamiSync handles this manually but its a easy change.

The Tick pulse width is still up in the air, but I am starting with 2-3mS. It really depends on the NES code; how responsive the code is reading the controller. Once I get all the hardware running together I'll have a better idea.

m00dawg wrote:

While I've made some updates to the ArduinoBoy code to better fit my needs for my custom one, I haven't dug super deep. But it looks like there is room to spare as far as RAM and processing power to add in the NES functions.

The ASM  for my 'F628 is like 400 words and uses about 5 ram bytes ATM. So I would guess the Arduino code would be similar.
Yogi

m00dawg wrote:

Hi Yogi!

Yep I've reached a similar conclusion after Mrwinner provided some links. I think FamiSync + PowerPak + FamiDI would work well! I wonder if I can sort of combine efforts and use 1 Arduino for both ArduinoBoy and the pulse output to the NES. It's too soon to say though. I use a stage-hardened custom ArduinoBoy with a noise rejection circuit for the GB called StageBoy and being able to add in NES support in a revision 2 would be awesome, and also keep things less cluttered on stage.

Not being familiar with the Arduinoboy code it's hard for me to judge, but for Sync only you would only need a single pin, if you add Start/Stop control another pin.
If Adrinoboy does a Thru function, could maybe have a function that watches the bytes being sent to the Tx buffer and trigger on 0xF8 (midi clock Tick) or 0xFA, 0xFB or 0xFC (midi Start, Continue or Stop).
On the hardware side I'm working on a 16F628 interface for a game pad similar to uXe's but lower cost. As well as a re-written Vega/Sync Play package for a SNROM, 7-32K NSFs per 256K PRG; it's still in a testing phase. so more to come!! Here is a preview test post @ NESDEV
http://forums.nesdev.com/viewtopic.php?f=6&t=11322
https://www.dropbox.com/sh/g6osy6uozook … -yjh_7WJUa
Yogi

Hi mOOdawg
Don't know if you are aware of FamiSync by HeavyW8bit. it's a mod to VegaPlay by No-Carrier. Both versions allow you to load a NSF file into a NES prg rom that can be flashed to a cart (or used with a EMU or PowerPak).
http://www.heavyw8bit.com/famislayer.php
FamiSync adds control of the NSF frame playback as well as transport. The sync is triggered by input to a controller button. So by adjusting the rate of the pulse stream to the GamePad you can change the Tempo of the NSF.

The MCTRL is configurable so it should be able to do the Midi Clock to Trigger conversion (it may already be an option, I don't know).
Also uXe has a Arduino shield, FamiDi, that allows midi messages to trigger GamePad buttons much like the MCTRL. This also could be used.
http://chipmusic.org/forums/topic/12998 … interface/

If you are looking to use a NFS directly on the PowerPak you would have to mod the NSF mapper code to allow sync input I believe. And Pulsar may use a different technique, don't know the specifics they worked out (Pulsar has a refresh rate of 180Hz where as most NSFs are 60Hz)
yogi

At a hardware level Yes with a Sync24 signal. The issue is the Midi beat clock message is one byte (8bit) message transmitted at a rate of 24 Per Quarter Note. This is similar to the older Sync24 system that was sent as a pulse stream at 24 Pulses Per Quarter Note (ppqn). So to drive FamiSlayer by a Midi Clock we basically need a Midi Clock-to-Sync24 converter wired to the Game Pad's button.
The converter would read the Midi messages and only respond to Clock messages by outputting a pulse to the Game Pad; and ignore other messages on the Midi cable. A midi clock running at a BPM of 150 (150 quarter notes per Min) works out to 3600 pulses per Min.
Which works well with a NSF file set for 150 BPM that is being called at the VBI's 60 Hz rate! Because we find that we call the NSF play code: (60 times per Sec) x (60 Sec per Min)=3600 times Per Min or the same as the Midi Clock rate for a BPM of 150.
uXe's FamiDi shield can be programmed to handle this, and I have been working on this also. But the big 'IF' is the needed software for a SNES. Perhaps when Ctrix and Farris release their package, their player routine can accommodate, or be modded to, sync similar to the NES. But again the APU is very different compared to the sound hardware on the NES.
Yogi

From Farris in this thread http://chipmusic.org/forums/topic/12762 … rt/page/6/

ferris wrote:

The tool is a pc tracker like famitracker for snes.. superfamitracker I guess smile . There's a replayer that's a native rom, but it's in a VERY early state atm. We'll plan to be able to mute channels and stuff on the fly; it'll be mainly for playing back tracks live.

yogi

nintendro boy wrote:
yogi wrote:

...but there is a SNES tracker in the works (search the forum).

So is that what cTrix and ferris have been up to? Ive seen there little cryptic messages and couldnt help but wonder what they were up to. Anyway, thank you so much for the help Mr. Bear and hopefully someday the snes and nes will be able to work together.

Yes, I do believe they are building a native tracker, but needed to build the PC tools also. So it may be a combined PC/SNES music system due to the sample based nature of the APU (which is how they have previewed songs ATM, I think).
  Part of the problem is the APU doesn't have it's own 'sound'; it's a CPU driving a DSP and plays sample based .SPC song data. To have a native tracker you would need to supply the sample data along with the tracker code on a SNES cart or download them to the console's RAM
So there needs to be a tool to create/add samples to the ROM image before it's flashed to a cart or downloaded to the console. Think of Famitracker and the NES' DPCM channel; you can create the Instrument wave form and then use it in your song. When you'r done, you export the NSF or .NES for playback on hardware.
  Looking forward to see what they come up with, seems like the first chiptune related homebrew for the SNES. smile)
yogi

nintendro boy wrote:

....
I agree that an external beat clock would
definitley be the ideal setup. Do you know of any midi interfaces for the SNES. Iknow I've read that the development kits came with a midi in, but other that I'M don't think I've seen a snes midi input.

  As with all systems, a hardware interface will require software to run it smile  Haven't seen any SNES softs for Midi/Sync, but there is a SNES tracker in the works (search the forum).
  The APU could be tricky for frame by frame playback. It's a sub processor that gets programmed by the main processor, then plays the song till a new song is loaded. To allow control over playback, the main CPU would have to interact with APU on a more intensive basis.
  Not saying that it can't be done, just that this is not how games handle it and there hasn't been much interest in the SNES for chiptunes sad Too many roadblocks, which is a shame. The good news is it seems like more people are looking closer at the SNES and tools are getting better.
yogi

On the NES there are some BPM that are 'difficult'  due to the use of the VBI for playback timing in most cases. A BPM of 150 is spot on the 60 Hz of the VBI/ Video refresh rate. With BPMs above and below 150, file playback has to be adjusted and some values aren't handled well. The timing of the VBI needs to be very solid for a stable video output, so music playback would inherit this timing.
Not sure there is a similar issue on the SNES, due to the SNES' APU; which is independent to the main processor. I would think that the APU would be able to handle any BPM you throw at it.
I'm guessing that both system should be able to stay reasonably  synced, if both files are the same BPM. The ideal setup, as pointed out, is an external beat clock to both systems.
yogi

284

(31 replies, posted in Nintendo Handhelds)

I agree that it's unlikely that all your optos are bad.
For the 6n138 circuit, I refer to the MidiBox.org's reference design. Your Resistor values may very, but should be simular to these.
On the Midi side:
PIN 4 of the midi socket goes thru a 220R (Red, Red, Bro) to PIN 2 of the 6n138
PIN 5 of the Midi socket goes to PIN 3 of the 6n138
A 1n4148 is connected between PIN 2 & 3 of the 6n138; Cathode (bar) to PIN 2

On the TTL side of the 6n138:
PIN 5 to GND
PIN 6 to Rx in; with a 1.2K pull-up (Bro,Red, Red; don't confuse with 220R Red, Red, Bro)
PIN 7 thru a 5.6K to GND (Grn,Blu, Red)
PIN 8 to Vcc

You should not have a GND from the Midi cable connected to anything. The Arduino/6n138 and GB should have a common Vcc & GND.

When sending Midi notes, should see lower then +5 V on midi socket PIN 5 or 6n138 PIN 3; most DMMs aren't fast enough to detect the serial bit transitions; just a lower average voltage. Should be lower with higher Midi traffic. A logic probe or a scope should detect the clocking of bits. If no changes are detected, suspect your cables/socket/KB
IF you see incoming Midi bits and you don't see output transitions at 6n138 PIN 6: problem with opto. If you have the transitions on the TTL side @ PIN 6 but no response from the Arduino, suspect wrong wiring, Arduino pin or firmware.

This is all pretty basic, in most cases it 'just works' so in your case it's prob something simple that's been overlooked ( had this bite me a few times)
yogi

Jazzmarazz wrote:

Yeah, once a software exists I think we could propose a solution/replacement. I feel like the port itself could be pulled and replaced by a DB9, as illustradted here:
http://www.smspower.org/Development/Gea … lerAdaptor

I mean, the GG has four programmable sound channels, copious amounts of internal space for mods and already has a mod for video output. Plus, its in freaking color with a pre-existing backlight!

Do believe that cable is not too rare, got one a little while ago off EBay for like $10, an after market repo.
The worst thing with GGs are the caps on the system board. If you haven't replaced them you will at some point. It's not too bad of a job but it does require some skills.
Yogi

286

(5 replies, posted in Sega)

smile Yea it's always the little things
yogi

287

(5 replies, posted in Sega)

Well i can't me much help, I don't have a Master Sys. But have modded Nes and Atari consoles, and if a working system won't work after I mod it then is't something I've done.
I can't tell much from your photos, what you need to check is the circuit/mod you put into the case and where you are tapping the video signals from. It really sounds like you have a wrong connection to the mother board, just a guess.
yogi

288

(5 replies, posted in Sega)

My guess would be the 'mod' isn't working and/or not installed correct. If the RF still works then the video generator is working. If you're unsure of your TV, try a different TV.
Good luck, yogi