marqs85 / snes_dejitter

NES/SNES 240p de-jitter mod
MIT License
44 stars 10 forks source link

NES/SNES 240p de-jitter mod

snes_dejitter is a mod board which eliminates sync jitter of NES/SNES 240p modes. Technical description and discussion is found on this thread.

Requirements for building the board and CPLD firmware

Requirements for flashing CPLD firmware

CPLD image build procedure

NOTE: Only needed when building a custom firmware. Pre-built images can be found under output_files/ on master and nes-fix (recommended for NES/FC) branches.

  1. Open the project file in Quartus, and run compilation

  2. Convert MAX7000 targeted POF object file into JEDEC file suitable for 1502AS via winpof2jed.exe:

  3. Select .pof file from previous step as input file

  4. Select 1502AS as device

  5. Change the following options:

    • Reduce MC power -> On
    • Open Collector -> Off
    • JTAG mode -> On
    • Slew rate -> Slow
  6. Click "Run"

    
    ![pof2jed](/pics/pof2jed.png)
  7. Convert JED to SVF via ATMISP:

  8. Create a new device chain via File->New

  9. Set number of devices to 1

  10. Set device to ATF1502AS

  11. Set JTAG instruction to "Program/Verify"

  12. Select .jed file from previous step as JEDEC file

  13. Click "OK"

  14. Tick "Write SVF file" and click "Run"

    
    ![atmisp1](/pics/atmisp_chain.png)
    ![atmisp1](/pics/atmisp_setup.png)

Board flashing

The board can be flashed using any OpenOCD supported JTAG programmer that supports 3.3V-5V IO signal level (TCK, TMS and TDI are TTL inputs with 10k pull-downs). If 3.3V IO is used, JP4 (on v1.3 PCB) should be closed which clamps TDO output to 3.3V. A standalone snes_jitter board is flashed by hooking all of its 6 JTAG header pins to respective pins of the programmer/cable, and by running flash procedure specified below. After the board has been installed to NES/SNES, firmware can be subsequently updated, but in this method 5V pin of the JTAG connector MUST be left disconnected, and programming needs to be done while NES/SNES is powered on (without a game is ok). The update procedure is similar in both cases:

  1. Create openocd.conf that matches your JTAG programmer. A configuration file for FT2232-based programmers is found in installation/openocd-ft2232.conf, and it uses following standard pinout for data signals:
Board pin Programmer pin
TCK ADBUS0
TMS ADBUS3
TDI ADBUS1
TDO ADBUS2
  1. After hooking up JTAG cable, initiate JTAG connection:
    openocd -f openocd.conf
  2. OpenOCD auto-probing should report a TAP controller with id 0x0150203f - if not, check connections and configuration. When successful, open another terminal to interact with openocd and program the chip:
    telnet localhost 4444
    > svf <full_path_to_svf_file>
  3. The programming procedure should finish with no error, after which you can finish installation by powering off hardware and disconnecting the programmer.

Installation

General descriptions on board pins are in table below. Model-specific installation instructions are added to separate subdirectories.

Board pin Description
CSYNC_i TTL C-sync signal from the console
MCLK_EXT_i External clock input. Used only in PAL mode, not needed in pure NTSC installations.
CLK_SEL_i Master clock source selection (0=internal/NTSC, 1=external/PAL). In PAL mode, MCLK and CSYNC are bypassed to output. Pin is pulled low internally, so it can be left disconnected in pure NTSC installations. Connected to PALMODE in multiregion installations. Can be forced high by bridging JP1 (pre-1.2 boards only), but must never be done if the pin is wired to console.
MCLK_o Clock output. An optional voltage divider (R13,R14 / JP2) can be used to reduce output level from ~4Vpp to ~3Vpp, see model-specific instructions for more details.
CSYNC_o C-sync output (~2.5Vpp unterminated, ~1.1Vpp into 75ohm termination) to an isolated multi-AV pin. Driver circuit is identical to SHVC-CPU-01. JP3 connects optional 330pF output capacitor that may not be present on console mainboard (not strictly needed, reduces potential noise at the price of less sharp transition time), see model-specific instructions for more details.
Jumper Description
JP1 Forces CLK_SEL_i high. Removed on v1.2 since it was mostly for debugging purposes.
JP2 Enables MCLK_o voltage divider. Recommended for NES installations to ensure signal level is safe for NESRGB.
JP3 Connects optional 330pF output capacitor on CSYNC_o.
JP4 Enable TDO voltage clamp. Recommended if board is flashed with a 3.3V programmer.

PCB revision history

v1.3

v1.2

v1.1

v1.0

FAQ

Can I buy the board pre-assembled / pre-installed

Can I flash the board with USB Blaster?

Which other programmers can I use?

Does the mod change game speed in any way?

Is it possible to disable de-jitter functionality after installation?