Summary
We need a copy of the speaker playback signal inside a microphone capture stream (echo-cancellation reference)
on Orin NX. On Jetson Linux R35 we routed the playback through the XBAR into the capture path and it worked.
On R39.2.1 with the default DPCM links, the same routing breaks playback: opening or closing the capture stream
disables I2S4 while playback is running (silence, no error), and opening the capture first makes the playback open
fail with failed to stop AMX, err = -110.
With nvidia,ahub-c2c-links (codec2codec links) the R35 routing works again, but per-module rates and channels can
only be set with the PCM override controls (“Sample Rate/Channels/Bits”), which the R39 documentation says will be
deprecated. codec2codec mode itself is not described in the R39 documentation.
We would like to know whether codec2codec mode is a configuration we can rely on for this use case.
Environment
- Jetson Orin NX 16GB, Jetson Orin NX Engineering Reference Developer Kit Super (p3768-0000+p3767-0000-super)
and our own carrier board - Jetson Linux R39.2.1 (kernel 6.8.12-tegra), stock
tegra-audio-graph-card - Comparison: Jetson Linux R35.4.1 on the same developer kit (Orin NX)
Routing
playback : ADMAIF2 (48 kHz) -> MVC2 -> I2S4 (speaker amplifier, DSP-A, Tegra is clock master)
capture : I2S2 (microphones, 16 kHz, 4 ch, DSP-A) -> AMX2 RX1
MVC2 -> SFC2 (48 kHz -> 16 kHz) -> AMX2 RX2 ("SFC2 Mux" = MVC2, the reference)
AMX2 (6 ch: 4 mic + 2 reference) -> ADMAIF3 (16 kHz, 6 ch)
The script nvidia_repro.sh (attached) sets this route with amixer and runs the tests below.
It changes only the APE card mixer state; please save it with alsactl store -f <file> 1 beforehand.
DPCM links (default): playback stops
sudo ./nvidia_repro.sh setup-fanout
sudo ./nvidia_repro.sh trial none|close|keep|first
trial plays a 10 s tone on ADMAIF2, opens/closes ADMAIF3 capture, and samples I2S4 RX_ENABLE
(regmap offset 0x00) every 0.25 s.
| trial | R35.4.1 | R39.2.1 (DPCM) |
|---|---|---|
| none | playback 10 s | playback 10 s |
| close (capture opened at +2 s for 1 s) | playback 10 s, I2S4 stays enabled | aplay returns 0 at +2.17 s, I2S4 RX_ENABLE 1 → 0 at +2.32 s |
| keep (capture opened at +2 s and kept) | playback 10 s | aplay returns 0 at +2.17 s, I2S4 RX_ENABLE 1 → 0 at +2.33 s |
| first (capture opened before playback) | both complete | opening ADMAIF2 fails: audio open error: Connection timed out (log below) |
The R39.2.1 column was taken with nvidia_repro.sh on the developer kit (no overlay, DPCM links).
The R35.4.1 column was taken on the developer kit with the same mux routing and the same trial procedure,
but without the I2S frame/master mode settings and AMX byte map (an earlier version of the script).
On our product (same R39.2.1, same routing) the playback PCM stays open when the capture process closes:
I2S4 RX_ENABLE goes 1 → 0 and the I2S4/SFC2 regmaps become unreadable (runtime-suspended) while the ADMAIF2 DMA
keeps running and aplay does not report an error, so the speaker stays silent until the playback PCM is reopened.
Kernel log for the first trial (same on the developer kit and on our product):
tegra210-amx 2903100.amx: failed to stop AMX, err = -110
tegra210-amx 2903100.amx: ASoC: error at snd_soc_dai_startup on AMX-TX-CIF: -110
fe.admaif@290f000.ADMAIF2: ASoC: error at dpcm_fe_dai_startup on fe.admaif@290f000.ADMAIF2: -110
codec2codec links: works with PCM override controls
We added nvidia,ahub-c2c-links; to the sound node with overlays/c2c.dts on the developer kit.
install_overlay.sh (attached) builds it with dtc and installs it as /boot/ape-c2c.dtbo; jetson-io then writes
the extlinux entry (the overlay has jetson-header-name so that jetson-io lists it):
sudo ./install_overlay.sh overlays/c2c.dts
sudo /opt/nvidia/jetson-io/config-by-hardware.py -n 1="APE AHUB codec2codec links (experiment)"
sudo reboot
After reboot, /proc/device-tree/sound/nvidia,ahub-c2c-links exists. To go back to DPCM links, restore
/boot/extlinux/extlinux.conf.jetson-io-backup. The overlay’s compatible lists the Orin NX developer kit;
adjust it for other boards.
With the overlay applied, the same routing behaves like R35:
none/close/keep/first all keep I2S4 enabled and play the full 10 s.
All internal links then take the hw_params of the last opened ADMAIF (tegra_audio_graph_hw_params), so we set the
per-module values with the PCM override controls:
sudo ./nvidia_repro.sh setup-fanout
sudo ./nvidia_repro.sh set-overrides
sudo ./nvidia_repro.sh reference play_first # and cap_first
The reference is correct (440 Hz in ch4/ch5, 16 kHz) in both open orders. In this mode the override values
persist after the stream closes and are restored by alsactl restore after reboot.
We also ran a playback (1 ch, 48 kHz), a microphone capture on ADMAIF4 (I2S2, 16 kHz, 4 ch) and repeated
open/close of ADMAIF3 together, in three start orders, without problems.
Questions
- With DPCM links, is sharing AHUB modules (MVC/SFC/AMX) between a playback FE and a capture FE supported,
and is the I2S4 shutdown above expected behaviour? - Is
nvidia,ahub-c2c-linkswith per-module values set by the PCM override controls a supported configuration on
R39 that will stay available (“PCM override controls will be deprecated in future releases”)?
If not, what is the recommended way on R39 to get the speaker reference into a microphone capture stream?
Attachments
r39-ape-c2c.zip (4.2 KB)
nvidia_repro.sh: reproduction scriptinstall_overlay.sh,overlays/c2c.dts: overlay for the codec2codec links