Hi Team,
Could someone pls suggest how to implement and validate SPDIF Protocol in i.MX8M plus?
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:
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.
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 .
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 .
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:
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:
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
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.