I am trying to enable I2S audio from the 40-pin header. Previously (a couple of years ago) I have used the Jetson-IO tool in /opt/nvidia/jetson-io/jetson-io.py for this with no issue; however this seems to no longer work.
setenv bootcmd 'mw 0x6000d204 0; run distro_bootcmd'
saveenv
The issue is it does not say where this should be done. There is no setenv command in the terminal; and if it is supposed to be added to the extlinux.conf it is not clear to me how exactly that can be achieved so that the commands actually run.
Running the Jetson-IO tool works fine, and it seems to reconfigure the 40-pin header properly – at least the tool itself thinks so after reboot since the I2S and audio clock pins show up in the header overview – I simply do not receive any sound output from my I2S board using speaker-test (or aplay using a wav file).
I have used the same board, and various instances of it, previously on Jetson Nano Developer Kits without issues, but on more recent Jetpack images I get no sound. It seems like more people have had this problem as seen here, where a temporary solution also is presented: Audio I2S on 40 Pin Connector.
It was apparently from that thread that @rowel in Enabling I2S Audio on Jetson Nano GPIO Header got the idea for their more permanent solution from.
Versions and commands
Tried jetpack versions; 32.7.4-20230608212426 32.6.1-20210726122000
(I don’t currently have access to the images that have been working, but they were on older Jetpack versions than these.)
I got ahold of one of my other Jetson Nanos again and simply tried the SD card (with Jetpack v 32.6.1) from first Jetson; and on this second Jetson, the sound just works. Running
So I got it working, and seemingly permanently, using the serial console (as hinted in the mentioned threads).
Small guide for I2S audio and possible issues
With: sudo /opt/nvidia/jetson-io/jetson-io.py
In Configure Jetson 40pin Header -> Configure header pins manually
Enable the aud_mclk and i2s4 on the 40-pin header Back -> Save pin changes -> Reboot to reconfigure
Test audio with noise speaker-test -c2 --scale 40 -D hw:1,0
Test audio with example file: aplay Music/example_file.wav -D hw:1,0 --vumeter stereo -vv
Run these commands with sudo to avoid any (usually temporary) ”resource busy” issues which seem to happen shortly after boots.
If commands are running but there is no audible audio
Use the serial console, see Jetsonhacks Serial debug guide; but I used a serial debug USB cable and then the screen command (available on macOS), found the a tty.usbserial-0001 device using ls /dev/ and then in terminal ran screen /dev/tty.usbserial-0001 115200.
In the serial console and during boot, stop the autoboot process when prompted, and then run the following commands:
(The current bootcmd can be printed using printenv bootcmd.) (Here I had to add the mw 0x6000d60c 0; part from the previous solution in order to get sound output, possibly it is not needed for sound input but I have not tried it.)