I have these two audio devices, the I2S MAX98357A and the I2S SPH0645LM4H. I need to use both of these devices for my project but the jetson nano only has one i2s channel. How do I go about solving this problem. Can I reconfigure some gpio pins that I am not already using for i2s?
The ‘Board Interfaces’ chapter in the audio documentation shows the audio interfaces available on each of the Jetson boards. For Jetson Nano there are two I2S interfaces available; one on the 40-pin header and one on the M.2 Key E slot (underneath the module which is a bit harder to get to).
The I2S interface available on the M.2 Key E slot is I2S3 and I2S3 is mapped to the dmic1/2 pins. By default the dmic1/2 pins should be configured for I2S3. You can check by executing the following command …
$ sudo grep -r "dmic1\|dmic2" /sys/kernel/debug/tegra_pinctrl_reg Bank: 1 Reg: 0x700030a4 Val: 0x00000041 -> dmic1_clk_pe0 Bank: 1 Reg: 0x700030a8 Val: 0x00000041 -> dmic1_dat_pe1 Bank: 1 Reg: 0x700030ac Val: 0x00000041 -> dmic2_clk_pe2 Bank: 1 Reg: 0x700030b0 Val: 0x00000041 -> dmic2_dat_pe3 $ sudo grep "CNF\| E:" /sys/kernel/debug/tegra_gpio Name:Bank:Port CNF OE OUT IN INT_STA INT_ENB INT_LVL E: 1:0 00 00 00 00 00 00 000000
If you have the same as the above then the pins should be configured.
Without anything connected to the I2S3 pins, you should be able to check that they are driving the pins by executing the following commands …
$ amixer -c tegrasndt210ref sset "I2S3 Mux" ADMAIF2 $ speaker-test -D hw:tegrasndt210ref,1 -c 2 -r 48000 -F S16_LE -t sine -f 500
Note you will need an oscilloscope to verify that the pins are being driven.
Okay, thanks. But how would I connect to these pins? Also, what are the dmic pins.
So I can’t just connect the LRC and BCLK pins as common for the two devices. Why is that?
Most pins on the device have an internal mux that allows you to configure what signal is route to a given pin. Each pin has a default function that the default function is typically used as the name of a pin. If you download the pinmux spreadsheet for Jetson Nano, you will see that the pins with ‘Ball Name’ that are DMIC1 xxx and DMIC2 xxx, can also be configured for I2S3. In fact, the default configuration of these pins is to route the I2S3 signals to the DMIC1/2 pins and not the DMIC signals.
It gets a bit confusing, because per the above the name of the DMIC1/2 pins (or I2S3 signals), on the Nano Carrier Board schematic (Jetson_Nano_Carrier_Board_OrCAD_Schematics.pdf), is actually I2S1, because this is the 2nd I2S interface enabled (and the I2S1 signals are labeled I2S0 in the schematic!). Anyway, what you need to do, it connect the codec to the I2S1 pins on the M.2 Key E connector as shown on page 14 of the schematic.
So you just need to connect the device to the I2S1 pins are shown in the schematic.
It could be possible, given that one device will use the I2S data input and one device will use the I2S data output. The only problem you would have is if both are active at the same time, in other words you are doing simultaneous playback and capture, they would both have to operate at the same sample rate, sample size, number of channels and frame format. Furthermore, even if both are not active at the same time, you would have to ensure that the bit clock and frame sync always operate with in the range that are supported by both devices, because if you were playing audio but not capturing audio, the bit clock and frame clock would still be active clocking the playback device even if there is no playback data being sent. And vice versa.
Okay, so is there no way to configure 4 of the pins on the 40-pin expansion header to as i2s3? Because I am going to have a hell of a time trying to connect the pins of the M.2 Key E connector. For connections, I only have jumper cables with me. Do you have any suggestions for connecting M.2 Key E connector to the device?
Only I2S4 is available on the 40-pin header and so if you cannot use a single I2S interface for both devices, then yes you will need to access the other I2S interface via the M.2 Key E slot. Yes this is not easy to access. Ideally you would need some sort of breakout board, but from a quick search I have been unable to find anything. So if you only have jumper wires, then that is not an option. Have you ruled out the possibility of only using I2S4?