Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Nintendo Switch I2S To SPDIF: Difference between revisions

From GameBrew
No edit summary
No edit summary
Line 1: Line 1:
{{Infobox Switch Homebrews
{{Infobox Switch Homebrews
|title=Nintendo Switch I2S to S/PDIF
|title=Nintendo Switch I2S to S/PDIF
|image=nintendoswitchi2stospdif.png
|image=Nintendoswitchi2stospdif.png
|description=I2S to S/PDIF conversion on SiPeed Tang Nano (GOWIN GW1N-LV1) which aims to convert Nintendo Switch's internal I2S signal.
|description=I2S to S/PDIF conversion on SiPeed Tang Nano (GOWIN GW1N-LV1) which aims to convert Nintendo Switch's internal I2S signal.
|author=puhitaku
|author=puhitaku
Line 16: Line 16:
|title=Switch Homebrew PC Tools (PC Utilities) - GameBrew
|title=Switch Homebrew PC Tools (PC Utilities) - GameBrew
|title_mode=append
|title_mode=append
|image=nintendoswitchi2stospdif.png
|image=Nintendoswitchi2stospdif.png
|image_alt=Nintendo Switch I2S to S/PDIF
|image_alt=Nintendo Switch I2S to S/PDIF
}}
}}

Revision as of 11:45, 5 April 2023

Nintendo Switch I2S to S/PDIF
File:Nintendoswitchi2stospdif.png
General
Authorpuhitaku
TypePC Utilities
Version2020
LicenseMIT License
Last Updated2020/08/15
Links
Download
Website
Source

The main goal of the SiPeed Tang Nano (GOWIN GW1N-LV1) project is to convert the internal sound signal of the Nintendo Switch from I2S to S/PDIF.

The project was motivated by the fact that while Nintendo claims that the Switch supports USB DACs, it doesn't seem to support UAC 2 and 3, which are high-end. After trying various DACs, it became clear that only cheap DACs worked well with the Switch, while the high-end ones did not. This raises questions about whether Nintendo understands why USB DACs are necessary and how the Switch's headphone output sounds.

While achieving full-digital sound output is easy in TV mode using an S/PDIF splitter from the HDMI signal, it is not as straightforward in non-TV (portable) mode. The Switch's only options for audio output in portable mode are the poor-quality headphone output and incomplete UAC support.

Therefore, the project aims to directly extract the digital sound signal from the Switch to enable better audio output.

nintendoswitchi2stospdif-01.png
(Orange LED on the Chord Mojo indicates that it's receiving 48kHz digital sound.)

Overview

The spec of I2S signal:

  • Sampling rate: 48000 [Hz]
  • Bit depth: 16 [bit]
  • Channels: 2 [ch]
  • Bit clock: 48000 * 16 * 2 * 4 = 6.144 [MHz]

nintendoswitchi2stospdif-02.png

  • There is a Realtek ALC5639 (smart amp with I2C controls) in Switch.
  • The SoC (≒ NVIDIA Tegra X1) transmits the sound signal to it in I2S format.

(Off-topic: NVIDIA Jetson TK1 has ALC5640 (RT5640) in it. It is close to ALC5639 and has identical footprint. Perhaps Nintendo imitated the design of a evaluation board of NVIDIA.)

The spec of the FPGA board:

  • Board: SiPeed Tang Nano
  • FPGA: GOWIN GW1N-LV1 (LittleBee series)

The protocol of TOSLINK (optical) and coaxial cable (metal) is same. The RGB LED on Tang Nano is capable of transmitting S/PDIF signal. Connect a cable to a DAC and press the another side on the LED. Sound should come out. How interesting is it!

Step-by-step

  1. Disassemble your Switch. -> iFixit teardown

  2. Find the chip.

    • Prepare longer wires for convenience and extra length to guide the wires nearby the battery connector.
    nintendoswitchi2stospdif-03.png
  3. Solder wires for BCLK (bit clock), LRCLK (left-right channel clock), SDATA (serialized data), and the ground.

    • Solder them VERY CAREFULLY or Switch will lose its voice parmanently.
    • Microscope is strongly suggested.
    nintendoswitchi2stospdif-04.png
  4. Guide the wires and connect with Tang Nano somehow

    nintendoswitchi2stospdif-05.png

    • There is a tiny free space around the battery connector. Recommend you to guide wires here.
    • Mind your wires not to interfere with other structures.
    • The default pin assign:
    Pin #
    BCLK in 29
    LRCLK in 28
    SDATA in 27
    S/PDIF out 38
    S/PDIF out (LED) 18
  5. Build the circuitry

    nintendoswitchi2stospdif-06.png

    • The schematic is TBA
    • By default, the output signal comes out from the pin 38 (for coaxial) and the red LED (for optical / TOSLINK).
    • You can try the optical transmission with NO EXTERNAL PARTS.
    • Generic TTL-to-SPDIF level converter uses logic ICs for driver but we can build without the IC.
      • Remove DC offset with a capacitor (0.1uF = 100nF is recommended)
      • Lower the voltage with a voltage divider
        • I've adjusted it with volumes to achieve 0.5Vpp.
        • I'm not sure about output impedance; it works anyways!
        • No problem with shorter cable out there but perhaps longer cable causes problem.
  6. Open this repository with GOWIN EDA

  7. Run "Synthesize" in the "Process" tab.

  8. Run "Place & Route".

  9. Program the board with "Program Device". The bitstream should be in "nintendo-switch-i2s-to-spdif/impl/pnr/i2s2spdif.fs".

  10. BOOM!

External links

Advertising: