i.MX8M Plus - SPDIF Protocol Implementation Example

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

i.MX8M Plus - SPDIF Protocol Implementation Example

80 Views
ramkrish
Contributor I

Hi Team,

Could someone pls suggest how to implement and validate SPDIF Protocol in i.MX8M plus?

0 Kudos
Reply
3 Replies

65 Views
yipingwang
NXP TechSupport
NXP TechSupport

Use the existing Linux ALSA Audio XCVR / S/PDIF driver on i.MX8M Plus; you normally do not implement the S/PDIF protocol from scratch. The i.MX8M Plus Audio XCVR supports eARC, ARC, and S/PDIF modes, and the Linux S/PDIF support exposes one playback device for Tx and one capture device for Rx through ALSA. 

Suggested implementation path:

Enable the kernel driver Enable:

CONFIG_SND_IMX_SPDIF

Menu path:

Copy

Device Drivers

  -> Sound card support

    -> Advanced Linux Sound Architecture

      -> ALSA for SoC audio support

        -> SoC Audio for Freescale i.MX CPUs

          -> SoC Audio support for i.MX boards with S/PDIF

The documented DT bindings are under Documentation/devicetree/bindings/sound/fsl,spdif.txt and Documentation/devicetree/bindings/sound/imx-audio-spdfif.txt . 

  • Configure the device tree For i.MX8M Plus, use the xcvr audio block and enable the sound card / DAI link. A representative configuration is:

sound-xcvr {

    compatible = "fsl,imx-audio-card";

    model = "imx-audio-xcvr";

    pri-dai-link {

        link-name = "XCVR PCM";

        cpu {

            sound-dai = <&xcvr>;

        };

    };

};

&xcvr {

    #sound-dai-cells = <0>;

    pinctrl-names = "default";

    pinctrl-0 = <&pinctrl_xcvr>;

    status = "okay";

};

For Tx pin muxing, one documented example uses MX8MP_IOMUXC_SPDIF_TX__AUDIOMIX_SPDIF1_OUT . 

  • Check board routing / jumpers If using the NXP audio board, set the physical routing for the intended S/PDIF path. For i.MX8M Plus, J1500=1-2 routes the coaxial connector to i.MX8M Plus, and J1500=4-5 routes the optical connector to i.MX8M Plus.  If routing through CPLD / HDMI card, J2511=1-3 is documented as “i.MX 8M Plus to CPLD to HDMI card.” 
  • Use ALSA / IEC958 correctly The S/PDIF Tx driver supports 32, 44.1, and 48 kHz sample rates, with S16_LE and S24_LE formats; for 24-bit output, the file must use 32 bits per channel frame with only the 24 LSBs valid.  If the path expects IEC958 subframes rather than raw PCM, do the PCM-to-IEC958 conversion in user space, for example using an ALSA PCM plugin. 

Validation steps:

aplay -l

arecord -l

Use these to identify the S/PDIF playback / capture card and device IDs. The documentation shows the S/PDIF device appearing as an ALSA card such as imxspdif [imx-spdif], device 0: S/PDIF PCM . 

Tx validation:

aplay -D hw:<card_id>,<pcm_id> audio48k24S.wav

The reference validation method uses an external optical S/PDIF receiver, such as an M-Audio Transit USB sound card with WaveLab, then records the stream externally and plays it back to check correctness. 

Rx validation:

arecord -D hw:<card_id>,<pcm_id> -c 2 -d 20 -r 48000 -f S24_LE record.wav

The sample rate passed to arecord must match the incoming S/PDIF stream sample rate.  For Rx, the application flow is to open the S/PDIF Rx PCM device, wait for the internal DPLL to lock to the input bit stream, get the input sample rate, set channel / format / rate parameters, then prepare and trigger capture. 

For protocol-level checks, use:

iecset -c <card_id>

iecset is the standard utility documented for setting or dumping IEC958 status bits, and the driver also exposes channel-status handling through the ALSA control interface. 

For i.MX8M Plus EVK-style validation, NXP also documents loopback-style Linux testing using the imxaudioxcvr card, for example recording from imxaudioxcvr and playing to wm8960audio :

arecord -Dsysdefault:CARD=imxaudioxcvr -c2 -r48000 -fS32_LE -twav | \

aplay -Dsysdefault:CARD=wm8960audio

In short: enable the i.MX S/PDIF / XCVR ALSA driver, configure the xcvr device tree and board routing, then validate Tx/Rx with aplay , arecord , iecset , and an external optical/coax S/PDIF source or sink.

0 Kudos
Reply

41 Views
ramkrish
Contributor I
Hi Yipingwang,

Could you please guide me with any reference schematics to implement SPDIF in Simplest way.
0 Kudos
Reply

33 Views
yipingwang
NXP TechSupport
NXP TechSupport

For the simplest i.MX 8M Plus S/PDIF implementation, use the i.MX Audio Board / MCIMX8M-AUD as the closest NXP reference hardware, not the base i.MX 8M Plus EVK alone. The audio board is documented as supporting i.MX 8M Plus and providing S/PDIF I/O with RCA and TOSLINK connectors, with TOSLINK support up to 192 kHz.

Recommended simple approach:

  • Use optical S/PDIF first if possible
    • Easiest hardware path: i.MX8MP SPDIF_OUT → optical TOSLINK transmitter module.
    • For receive: optical TOSLINK receiver module → i.MX8MP SPDIF_IN .
    • This avoids coaxial 75 Ω line-drive, transformer/coupling, and grounding concerns.
  • Use the i.MX 8M Plus S/PDIF pins through IOMUX
    • The i.MX 8M Plus audio subsystem includes SPDIF input and output .
    • The reference manual shows IOMUX options for AUDIOMIX_SPDIF1_OUT and AUDIOMIX_SPDIF1_IN on selectable pads.
    • In Linux, the corresponding IOMUX definitions include MX8MP_IOMUXC_SPDIF_TX__AUDIOMIX_SPDIF_OUT and MX8MP_IOMUXC_SPDIF_RX__AUDIOMIX_SPDIF_IN .
  • If you need coaxial RCA
    • Do not treat the SoC pin like a direct RCA line driver.
    • Add the proper 75 Ω S/PDIF coax output network / coupling per the selected transmitter/interface circuit.
    • Optical is usually the simpler and safer first implementation.
  • Reference material to look at
    • MCIMX8M-AUD / i.MX Audio Board : best NXP reference for S/PDIF I/O with RCA and TOSLINK on the i.MX 8M family.
    • i.MX 8M Plus Reference Manual : pinmux / IOMUX setup for AUDIOMIX_SPDIF1_IN and AUDIOMIX_SPDIF1_OUT .
    • i.MX 8M Plus datasheet : S/PDIF timing parameters are documented, including clock high/low timing.

For the simplest design, route AUDIOMIX_SPDIF1_OUT/IN to optical TOSLINK modules and use the MCIMX8M-AUD as the NXP reference point for S/PDIF I/O behavior.

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2397053%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3Ei.MX8M%20Plus%20-%20SPDIF%20Protocol%20Implementation%20Example%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2397053%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20Team%2C%3CBR%20%2F%3E%3CBR%20%2F%3ECould%20someone%20pls%20suggest%20how%20to%20implement%20and%20validate%20SPDIF%20Protocol%20in%20i.MX8M%20plus%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2397546%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20i.MX8M%20Plus%20-%20SPDIF%20Protocol%20Implementation%20Example%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2397546%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EFor%20the%20simplest%20i.MX%208M%20Plus%20S%2FPDIF%20implementation%2C%20use%20the%20i.MX%20Audio%20Board%20%2F%20MCIMX8M-AUD%20as%20the%20closest%20NXP%20reference%20hardware%2C%20not%20the%20base%20i.MX%208M%20Plus%20EVK%20alone.%20The%20audio%20board%20is%20documented%20as%20supporting%20i.MX%208M%20Plus%20and%20providing%20S%2FPDIF%20I%2FO%20with%20RCA%20and%20TOSLINK%20connectors%2C%20with%20TOSLINK%20support%20up%20to%20192%20kHz.%3C%2FP%3E%0A%3CP%3ERecommended%20simple%20approach%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3EUse%20optical%20S%2FPDIF%20first%20if%20possible%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CUL%3E%0A%3CUL%3E%0A%3CLI%3EEasiest%20hardware%20path%3A%26nbsp%3Bi.MX8MP%20SPDIF_OUT%26nbsp%3B%E2%86%92%20optical%20TOSLINK%20transmitter%20module.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FUL%3E%0A%3CUL%3E%0A%3CUL%3E%0A%3CLI%3EFor%20receive%3A%20optical%20TOSLINK%20receiver%20module%20%E2%86%92%26nbsp%3Bi.MX8MP%20SPDIF_IN%26nbsp%3B.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FUL%3E%0A%3CUL%3E%0A%3CUL%3E%0A%3CLI%3EThis%20avoids%20coaxial%2075%20%CE%A9%20line-drive%2C%20transformer%2Fcoupling%2C%20and%20grounding%20concerns.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FUL%3E%0A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3EUse%20the%20i.MX%208M%20Plus%20S%2FPDIF%20pins%20through%20IOMUX%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CUL%3E%0A%3CUL%3E%0A%3CLI%3EThe%20i.MX%208M%20Plus%20audio%20subsystem%20includes%26nbsp%3B%3CSTRONG%3ESPDIF%20input%20and%20output%3C%2FSTRONG%3E%26nbsp%3B.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FUL%3E%0A%3CUL%3E%0A%3CUL%3E%0A%3CLI%3EThe%20reference%20manual%20shows%20IOMUX%20options%20for%26nbsp%3BAUDIOMIX_SPDIF1_OUT%26nbsp%3Band%26nbsp%3BAUDIOMIX_SPDIF1_IN%26nbsp%3Bon%20selectable%20pads.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FUL%3E%0A%3CUL%3E%0A%3CUL%3E%0A%3CLI%3EIn%20Linux%2C%20the%20corresponding%20IOMUX%20definitions%20include%26nbsp%3BMX8MP_IOMUXC_SPDIF_TX__AUDIOMIX_SPDIF_OUT%26nbsp%3Band%26nbsp%3BMX8MP_IOMUXC_SPDIF_RX__AUDIOMIX_SPDIF_IN%26nbsp%3B.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FUL%3E%0A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3EIf%20you%20need%20coaxial%20RCA%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CUL%3E%0A%3CUL%3E%0A%3CLI%3EDo%26nbsp%3B%3CSTRONG%3Enot%3C%2FSTRONG%3E%26nbsp%3Btreat%20the%20SoC%20pin%20like%20a%20direct%20RCA%20line%20driver.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FUL%3E%0A%3CUL%3E%0A%3CUL%3E%0A%3CLI%3EAdd%20the%20proper%2075%20%CE%A9%20S%2FPDIF%20coax%20output%20network%20%2F%20coupling%20per%20the%20selected%20transmitter%2Finterface%20circuit.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FUL%3E%0A%3CUL%3E%0A%3CUL%3E%0A%3CLI%3EOptical%20is%20usually%20the%20simpler%20and%20safer%20first%20implementation.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FUL%3E%0A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3EReference%20material%20to%20look%20at%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CUL%3E%0A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3EMCIMX8M-AUD%20%2F%20i.MX%20Audio%20Board%3C%2FSTRONG%3E%26nbsp%3B%3A%20best%20NXP%20reference%20for%20S%2FPDIF%20I%2FO%20with%20RCA%20and%20TOSLINK%20on%20the%20i.MX%208M%20family.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FUL%3E%0A%3CUL%3E%0A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3Ei.MX%208M%20Plus%20Reference%20Manual%3C%2FSTRONG%3E%26nbsp%3B%3A%20pinmux%20%2F%20IOMUX%20setup%20for%26nbsp%3BAUDIOMIX_SPDIF1_IN%26nbsp%3Band%26nbsp%3BAUDIOMIX_SPDIF1_OUT%26nbsp%3B.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FUL%3E%0A%3CUL%3E%0A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3Ei.MX%208M%20Plus%20datasheet%3C%2FSTRONG%3E%26nbsp%3B%3A%20S%2FPDIF%20timing%20parameters%20are%20documented%2C%20including%20clock%20high%2Flow%20timing.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FUL%3E%0A%3CP%3EFor%20the%20simplest%20design%2C%20route%26nbsp%3BAUDIOMIX_SPDIF1_OUT%2FIN%26nbsp%3Bto%20optical%20TOSLINK%20modules%20and%20use%20the%20MCIMX8M-AUD%20as%20the%20NXP%20reference%20point%20for%20S%2FPDIF%20I%2FO%20behavior.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2397501%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20i.MX8M%20Plus%20-%20SPDIF%20Protocol%20Implementation%20Example%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2397501%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EHi%20Yipingwang%2C%3CBR%20%2F%3E%3CBR%20%2F%3ECould%20you%20please%20guide%20me%20with%20any%20reference%20schematics%20to%20implement%20SPDIF%20in%20Simplest%20way.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2397074%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20i.MX8M%20Plus%20-%20SPDIF%20Protocol%20Implementation%20Example%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2397074%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EUse%20the%20existing%20Linux%20ALSA%20Audio%20XCVR%20%2F%20S%2FPDIF%20driver%20on%20i.MX8M%20Plus%3B%20you%20normally%20do%26nbsp%3B%3CSTRONG%3Enot%3C%2FSTRONG%3E%26nbsp%3Bimplement%20the%20S%2FPDIF%20protocol%20from%20scratch.%20The%20i.MX8M%20Plus%20Audio%20XCVR%20supports%20eARC%2C%20ARC%2C%20and%20S%2FPDIF%20modes%2C%20and%20the%20Linux%20S%2FPDIF%20support%20exposes%20one%20playback%20device%20for%20Tx%20and%20one%20capture%20device%20for%20Rx%20through%20ALSA.%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESuggested%20implementation%20path%3A%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EEnable%20the%20kernel%20driver%3C%2FSTRONG%3E%26nbsp%3BEnable%3A%3C%2FP%3E%0A%3CP%3ECONFIG_SND_IMX_SPDIF%3C%2FP%3E%0A%3CP%3EMenu%20path%3A%3C%2FP%3E%0A%3CP%3ECopy%3C%2FP%3E%0A%3CP%3EDevice%20Drivers%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%20-%26gt%3B%20Sound%20card%20support%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20-%26gt%3B%20Advanced%20Linux%20Sound%20Architecture%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20-%26gt%3B%20ALSA%20for%20SoC%20audio%20support%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20-%26gt%3B%20SoC%20Audio%20for%20Freescale%20i.MX%20CPUs%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20-%26gt%3B%20SoC%20Audio%20support%20for%20i.MX%20boards%20with%20S%2FPDIF%3C%2FP%3E%0A%3CP%3EThe%20documented%20DT%20bindings%20are%20under%26nbsp%3BDocumentation%2Fdevicetree%2Fbindings%2Fsound%2Ffsl%2Cspdif.txt%26nbsp%3Band%26nbsp%3BDocumentation%2Fdevicetree%2Fbindings%2Fsound%2Fimx-audio-spdfif.txt%26nbsp%3B.%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3EConfigure%20the%20device%20tree%3C%2FSTRONG%3E%26nbsp%3BFor%20i.MX8M%20Plus%2C%20use%20the%26nbsp%3Bxcvr%26nbsp%3Baudio%20block%20and%20enable%20the%20sound%20card%20%2F%20DAI%20link.%20A%20representative%20configuration%20is%3A%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3Esound-xcvr%20%7B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20compatible%20%3D%20%22fsl%2Cimx-audio-card%22%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20model%20%3D%20%22imx-audio-xcvr%22%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20pri-dai-link%20%7B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20link-name%20%3D%20%22XCVR%20PCM%22%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20cpu%20%7B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20sound-dai%20%3D%20%26lt%3B%26amp%3Bxcvr%26gt%3B%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7D%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7D%3B%3C%2FP%3E%0A%3CP%3E%7D%3B%3C%2FP%3E%0A%3CP%3E%26amp%3Bxcvr%20%7B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%23sound-dai-cells%20%3D%20%26lt%3B0%26gt%3B%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20pinctrl-names%20%3D%20%22default%22%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20pinctrl-0%20%3D%20%26lt%3B%26amp%3Bpinctrl_xcvr%26gt%3B%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20status%20%3D%20%22okay%22%3B%3C%2FP%3E%0A%3CP%3E%7D%3B%3C%2FP%3E%0A%3CP%3EFor%20Tx%20pin%20muxing%2C%20one%20documented%20example%20uses%26nbsp%3BMX8MP_IOMUXC_SPDIF_TX__AUDIOMIX_SPDIF1_OUT%26nbsp%3B.%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3ECheck%20board%20routing%20%2F%20jumpers%3C%2FSTRONG%3E%26nbsp%3BIf%20using%20the%20NXP%20audio%20board%2C%20set%20the%20physical%20routing%20for%20the%20intended%20S%2FPDIF%20path.%20For%20i.MX8M%20Plus%2C%26nbsp%3BJ1500%3D1-2%26nbsp%3Broutes%20the%20coaxial%20connector%20to%20i.MX8M%20Plus%2C%20and%26nbsp%3BJ1500%3D4-5%26nbsp%3Broutes%20the%20optical%20connector%20to%20i.MX8M%20Plus.%26nbsp%3B%26nbsp%3BIf%20routing%20through%20CPLD%20%2F%20HDMI%20card%2C%26nbsp%3BJ2511%3D1-3%26nbsp%3Bis%20documented%20as%20%E2%80%9Ci.MX%208M%20Plus%20to%20CPLD%20to%20HDMI%20card.%E2%80%9D%26nbsp%3B%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3EUse%20ALSA%20%2F%20IEC958%20correctly%3C%2FSTRONG%3E%26nbsp%3BThe%20S%2FPDIF%20Tx%20driver%20supports%2032%2C%2044.1%2C%20and%2048%20kHz%20sample%20rates%2C%20with%26nbsp%3BS16_LE%26nbsp%3Band%26nbsp%3BS24_LE%26nbsp%3Bformats%3B%20for%2024-bit%20output%2C%20the%20file%20must%20use%2032%20bits%20per%20channel%20frame%20with%20only%20the%2024%20LSBs%20valid.%26nbsp%3B%26nbsp%3BIf%20the%20path%20expects%20IEC958%20subframes%20rather%20than%20raw%20PCM%2C%20do%20the%20PCM-to-IEC958%20conversion%20in%20user%20space%2C%20for%20example%20using%20an%20ALSA%20PCM%20plugin.%26nbsp%3B%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EValidation%20steps%3A%3C%2FP%3E%0A%3CP%3Eaplay%20-l%3C%2FP%3E%0A%3CP%3Earecord%20-l%3C%2FP%3E%0A%3CP%3EUse%20these%20to%20identify%20the%20S%2FPDIF%20playback%20%2F%20capture%20card%20and%20device%20IDs.%20The%20documentation%20shows%20the%20S%2FPDIF%20device%20appearing%20as%20an%20ALSA%20card%20such%20as%26nbsp%3Bimxspdif%20%5Bimx-spdif%5D%2C%20device%200%3A%20S%2FPDIF%20PCM%26nbsp%3B.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3ETx%20validation%3A%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3Eaplay%20-D%20hw%3A%3CCARD_ID%3E%2C%3CPCM_ID%3E%20audio48k24S.wav%3C%2FPCM_ID%3E%3C%2FCARD_ID%3E%3C%2FP%3E%0A%3CP%3EThe%20reference%20validation%20method%20uses%20an%20external%20optical%20S%2FPDIF%20receiver%2C%20such%20as%20an%20M-Audio%20Transit%20USB%20sound%20card%20with%20WaveLab%2C%20then%20records%20the%20stream%20externally%20and%20plays%20it%20back%20to%20check%20correctness.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3ERx%20validation%3A%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3Earecord%20-D%20hw%3A%3CCARD_ID%3E%2C%3CPCM_ID%3E%20-c%202%20-d%2020%20-r%2048000%20-f%20S24_LE%20record.wav%3C%2FPCM_ID%3E%3C%2FCARD_ID%3E%3C%2FP%3E%0A%3CP%3EThe%20sample%20rate%20passed%20to%26nbsp%3Barecord%26nbsp%3Bmust%20match%20the%20incoming%20S%2FPDIF%20stream%20sample%20rate.%26nbsp%3B%26nbsp%3BFor%20Rx%2C%20the%20application%20flow%20is%20to%20open%20the%20S%2FPDIF%20Rx%20PCM%20device%2C%20wait%20for%20the%20internal%20DPLL%20to%20lock%20to%20the%20input%20bit%20stream%2C%20get%20the%20input%20sample%20rate%2C%20set%20channel%20%2F%20format%20%2F%20rate%20parameters%2C%20then%20prepare%20and%20trigger%20capture.%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFor%20protocol-level%20checks%2C%20use%3A%3C%2FP%3E%0A%3CP%3Eiecset%20-c%20%3CCARD_ID%3E%3C%2FCARD_ID%3E%3C%2FP%3E%0A%3CP%3Eiecset%26nbsp%3Bis%20the%20standard%20utility%20documented%20for%20setting%20or%20dumping%20IEC958%20status%20bits%2C%20and%20the%20driver%20also%20exposes%20channel-status%20handling%20through%20the%20ALSA%20control%20interface.%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFor%20i.MX8M%20Plus%20EVK-style%20validation%2C%20NXP%20also%20documents%20loopback-style%20Linux%20testing%20using%20the%26nbsp%3Bimxaudioxcvr%26nbsp%3Bcard%2C%20for%20example%20recording%20from%26nbsp%3Bimxaudioxcvr%26nbsp%3Band%20playing%20to%26nbsp%3Bwm8960audio%26nbsp%3B%3A%3C%2FP%3E%0A%3CP%3Earecord%20-Dsysdefault%3ACARD%3Dimxaudioxcvr%20-c2%20-r48000%20-fS32_LE%20-twav%20%7C%20%5C%3C%2FP%3E%0A%3CP%3Eaplay%20-Dsysdefault%3ACARD%3Dwm8960audio%3C%2FP%3E%0A%3CP%3EIn%20short%3A%20enable%20the%20i.MX%20S%2FPDIF%20%2F%20XCVR%20ALSA%20driver%2C%20configure%20the%26nbsp%3Bxcvr%26nbsp%3Bdevice%20tree%20and%20board%20routing%2C%20then%20validate%20Tx%2FRx%20with%26nbsp%3Baplay%26nbsp%3B%2C%26nbsp%3Barecord%26nbsp%3B%2C%26nbsp%3Biecset%26nbsp%3B%2C%20and%20an%20external%20optical%2Fcoax%20S%2FPDIF%20source%20or%20sink.%3C%2FP%3E%3C%2FLINGO-BODY%3E