Audio I2S on 40 Pin Connector

I am trying to get audio on the 40 pin connector of the Jetson Nano.
I found the following pinout:
Pin7 = AUDIO_MCLK
Pin12 = DAP4_SCLK
Pin35 = DAP4_FS
Pin38 = DAP4_DIN
Pin40 = DAP4_DOUT

I tried to setup the audio routing using amixer with the following commands:
amixer -c1 sset ‘ADMAIF1 Mux’ I2S4
amixer -c1 sset ‘ADMAIF1 Channels’ 2

amixer -c1 sset ‘I2S4 Mux’ ADMAIF1
amixer -c1 sset ‘I2S4 Channels’ 2
amixer -c1 sset ‘I2S4 Sample Rate’ 48000

I also tried different I2S and ADMAIF number but so far looking at the pin with a scope I cannot see any signals or clock signals.

Is there something else I need to setup?
Thanks.

Hello!

Yes by default I believe that the pins on the 40-pin header are all configured as GPIO and so they need to be reconfigured as what is called ‘SFIO’ (special function IO) in order to route the I2S signals to the pads.

The I2S and AUDIO_MCLK are mapped to the following GPIOs …

AUDIO_MCLK --> GPIO BB.00
DAP4_SCLK --> GPIO J.07
DAP4_FS --> GPIO J.04
DAP4_DIN --> GPIO J.05
DAP4_DOUT --> GPIO J.06

You can check to see if the pins are configured for GPIO by …

$ sudo grep "Name:\|J:\|BB:" /sys/kernel/debug/tegra_gpio                                                                                                                                                                
Name:Bank:Port CNF OE OUT IN INT_STA INT_ENB INT_LVL
 J: 2:1 f0 00 00 00 00 00 000000
BB: 6:3 01 00 00 00 00 00 000000

The GPIO ‘CNF’ register indicate whether a pin is a GPIO or SFIO. If the bit is set it is a GPIO. So for example, in the above the DAP4 pins are all GPIO because the ‘CNF’ register has the value 0xf0 and the per the above the DAP4 pins occupy the GPIO port J 4-7 which maps to bits 4-7 in the CNF register. Similarly the AUDIO_MCLK is configured as a GPIO because GPIO port BB has bit 0 set to 1.

So we need to reconfigure the pins to be SFIO for this to work. I took a quick look at our documentation for Jetson Nano and it looks like the ‘Adaptation Guide’ is not yet available. I will check to see what the status is and if there are instructions available for reconfiguring the pins.

Regards,
Jon

I ran the command you gave on my board and got the same register values.
Thanks a lot for looking into this.

Hi Jon, I have a similar question but for enabling spi. I have gone thru Jetson.GPIO and Adafruit Blinka library and came up with the below summary of GPIO usage in the library. I got all the listed GPIOs as well as 2 i2c ports worked like charm but no luck on spi, uart and i2s. But the Jetson nano documents did mention the availability of functions other than GPIO and i2c. Could you also help to take a look into spi and uart as well?

Many thanks, wq

Summary of GPIO/i2c library usage below in case someone also spend efforts on Jetson Nano as an IoT/MCU device.

‘’’
usage of jetson nano’s gpio
qing.wei@live.com, 2019.04.09
‘’’

jetson nano board definition: https://github.com/adafruit/Adafruit_Blinka/blob/master/src/adafruit_blinka/board/jetson_nano.py

note: the gpio pin number used in adafruit blinka python library is to follow the Raspberry Pi GPIO naming system not the pin sequence on board

- i2c pins: (can not be used as gpio)

SDA = pin.SDA_1 (pin #3)

SCL = pin.SCL_1 (pin #5)

SDA_1 = pin.SDA (pin #27)

SCL_1 = pin.SCL (pin #28)

- uart pins: (not defined yet as of 2019-04-09. can not be used as gpio)

TXD0 = pin.GPIO14 (pin #8)

RXD0 = pin.GPIO15 (pin #10)

- spi/i2s: nil

- gpio pins:

D4 = pin.BB00 (pin #7)

D5 = pin.S05 (pin #29)

D6 = pin.Z00 (pin #31)

D7 = pin.C04 (pin #26)

D8 = pin.C03 (pin #24)

D9 = pin.C01 (pin #21)

D10 = pin.C00 (pin #19)

D11 = pin.C02 (pin #23)

D12 = pin.V00 (pin #32)

D13 = pin.E06 (pin #33)

D16 = pin.G03 (pin #36)

D17 = pin.G02 (pin #11)

D18 = pin.J07 (pin #12)

D19 = pin.J04 (pin #35)

D20 = pin.J05 (pin #38)

D21 = pin.J06 (pin #40)

D22 = pin.Y02 (pin #15)

D23 = pin.DD00 (pin #16)

D24 = pin.B07 (pin #18)

D25 = pin.B05 (pin #22)

D26 = pin.B04 (pin #37)

D27 = pin.B06 (pin #13)

To use 2nd i2c bus at GPIO pin 27(SDA_1)/28(SCL_1) on Jetson Nano:

- connect i2c sensor/oled i2c_sda --> jetson nano pin#27(sda_1)

- connect i2c sesnor/oled i2c_scl --> jetson nano pin#28(scl_1)

- connect i2c sensor/oled vcc(3v3) --> jetson nano pin#17(3v3) or pin#2/4 if the sensor/oled board is 5v/3.3v compatible

- connect i2c sesnor/oled gnd --> jetson nano pin#14(gnd) or any available gnd pins on board

‘’’
ref: ~/jetbot/.local/lib/python3.6/site-packages/Jetson/GPIO/gpio_pin_data.py:
JETSON_NANO_PIN_DEFS = [

(tegra210_pin, <-> , brd_pin#, rpi_pin_name, <->, <->)

(216, "/sys/devices/6000d000.gpio", 7, 4, 'AUDIO_MCLK', 'AUD_MCLK'),
(50, "/sys/devices/6000d000.gpio", 11, 17, 'UART2_RTS', 'UART2_RTS'),
(79, "/sys/devices/6000d000.gpio", 12, 18, 'DAP4_SCLK', 'DAP4_SCLK'),
(14, "/sys/devices/6000d000.gpio", 13, 27, 'SPI2_SCK', 'SPI2_SCK'),
(194, "/sys/devices/6000d000.gpio", 15, 22, 'LCD_TE', 'LCD_TE'),
(232, "/sys/devices/6000d000.gpio", 16, 23, 'SPI2_CS1', 'SPI2_CS1'),
(15, "/sys/devices/6000d000.gpio", 18, 24, 'SPI2_CS0', 'SPI2_CS0'),
(16, "/sys/devices/6000d000.gpio", 19, 10, 'SPI1_MOSI', 'SPI1_MOSI'),
(17, "/sys/devices/6000d000.gpio", 21, 9, 'SPI1_MISO', 'SPI1_MISO'),
(13, "/sys/devices/6000d000.gpio", 22, 25, 'SPI2_MISO', 'SPI2_MISO'),
(18, "/sys/devices/6000d000.gpio", 23, 11, 'SPI1_SCK', 'SPI1_SCK'),
(19, "/sys/devices/6000d000.gpio", 24, 8, 'SPI1_CS0', 'SPI1_CS0'),
(20, "/sys/devices/6000d000.gpio", 26, 7, 'SPI1_CS1', 'SPI1_CS1'),
(149, "/sys/devices/6000d000.gpio", 29, 5, 'CAM_AF_EN', 'CAM_AF_EN'),
(200, "/sys/devices/6000d000.gpio", 31, 6, 'GPIO_PZ0', 'GPIO_PZ0'),
(168, "/sys/devices/6000d000.gpio", 32, 12, 'LCD_BL_PWM', 'LCD_BL_PW'),
(38, "/sys/devices/6000d000.gpio", 33, 13, 'GPIO_PE6', 'GPIO_PE6'),
(76, "/sys/devices/6000d000.gpio", 35, 19, 'DAP4_FS', 'DAP4_FS'),
(51, "/sys/devices/6000d000.gpio", 36, 16, 'UART2_CTS', 'UART2_CTS'),
(12, "/sys/devices/6000d000.gpio", 37, 26, 'SPI2_MOSI', 'SPI2_MOSI'),
(77, "/sys/devices/6000d000.gpio", 38, 20, 'DAP4_DIN', 'DAP4_DIN'),
(78, "/sys/devices/6000d000.gpio", 40, 21, 'DAP4_DOUT', 'DAP4_DOUT')

]
‘’’

Hello!

Yes I am looking to see what we can provide to unblock you on this.

I will keep you posted.

Regards,
Jon

Hi Jon,

Thank you for your quick response. Really look forward to it!

Thanks!

Hello!

Just to let you know I am still checking on this. I was out for a couple days the end of last week, but I will see where we are on this.

Regards,
Jon

Thanks Jon.

Hello!

Sorry for the delay on this but we are still in the process of completing the appropriate documentation. Typically, the process for reconfiguring the pins is …

  1. Using the provided pinmux spreadsheet, configure the pins are
    required and then using the spreadsheet there is a button to generate
    an updated device-tree source file with the pin settings.
  2. Using the update device-tree source file we need to rebuild the
    bootloader and install on the board.

We are still waiting for the spreadsheet to be finalised and so in the meantime to unblock you we can use the u-boot bootloader to directly program the appropriate registers which is OK for testing but ideally we should follow the above procedure. Furthermore, the setting will be lost after a reset/power-down.

For the I2S signals, from the u-boot command prompt execute the following commands. Note that press any key when u-boot start to access the u-boot command prompt.

  1. Read the DAP4 pinmux registers

Tegra210 (P3450-Porg) # md 0x70003144 4

  1. Verify and configure the DAP4 pinmux registers for DAP4
  • In all register bits [1:0] should be 0 to select DAP4
  • Bits [3:2] control if there is any pull-up/down. Please see the
    ‘PINMUX’ register description in the Tegra X1 TRM [0] on how to
    program these.
  • If the pin is an input (eg. DIN) then bit 6 should be set although I
    don’t believe that there isn’t any harm is setting this for an output
    either.
  • To write the register use the command

Tegra210 (P3450-Porg) # mw

  1. Read the corresponding GPIO CNF register for DAP4

Tegra210 (P3450-Porg) # md 0x6000d204 1

  1. Verify and configure GPIO CNF for DAP4
  • Bits 4-7 need to be 0. If they are not use the ‘mw’ command to set
    these bits to 0.
  1. For the AUD_MCLK repeat steps 1-4 above but …
    a). Using the address 0x70003180 for the pinmux register and set this to
    0x4.
    b). Using the address 0x6000d60c for the GPIO CNF and verify/set bit 0
    to 0.

  2. For SPI1 repeat steps 1-4 above but …
    a). Using the addresses 0x70003050 - 0x70003060 for the pinmux
    registers. Refer to the Tegra X1 TRM on how to program these.
    b). Using the address 0x6000d008 for the GPIO CNF and verify/set bits
    [4:0] to 0.

  3. For SPI2 repeat steps 1-4 above but …
    a). Using the addresses 0x70003064 - 0x70003078 for the pinmux
    registers. Refer to the Tegra X1 TRM on how to program these.
    b). Using the address 0x6000d004 and 0x6000d704 for the GPIO CNF and
    verify/set bits [7:4] in 0x6000d004 are 0 and bit 0 in 0x6000d004 is
    0.

  4. For UART2 repeat steps 1-4 above but …
    a). Using the addresses 0x700030f4 - 0x70003100 for the pinmux
    registers. Refer to the Tegra X1 TRM on how to program these.
    b). Using the address 0x6000d108 for the GPIO CNF and verify/set bits
    [3:0] 0.

Regards,
Jon

[0] http://developer.nvidia.com/embedded/dlc/tegra-x1-technical-reference-manual

Jon, thanks.

I have a side question:
Is it possible to have 2x I2S to the 40 pin connector.
For example, can I have 1 set of clock (MCLK, SCLK,FS) but 2x DIN and 2x DOUT?

Hello!

Unfortunately not on the 40-pin header. There is a 2nd I2S interface that is available on the M.2 Key E connector (which is located on the main board under the module).

Please note that each I2S interface can support upto 16 channels in TDM mode. So if you are using a codec that supports either the dsp-a or dsp-b timing modes, then you can have more than 2 channels.

Regards,
Jon

Unfortunately the Codecs I am using now are only I2S.

Do you know of a board or device I can buy that will convert for example a TDM 8 channels to 4x I2S?
Thanks

Thanks Jon. This information is very helpful!

jonathanh, I appreciate the effort in getting the means to convert the pinout from GPIO to SFIO in order to use I2S functionality. However, I do not specialize in hardware and low-level programming. Can you or anyone provide step-by-step instructions in layman’s terms? Thanks.

I’d like to second the request for a user friendly way of enabling the SFIO functionality on the Jetson Nano 40 pin header. I have an I2S audio device which I’d like to get working with my Nano, but the above steps and having to decode the Tegra chipset manual looks pretty daunting.

Thanks,
Will

Who purchases a product and then must wait a month for a manual to come out. Me but I can’t wait. I found another product just a good, same price and comes with the total specs. I’ll let you know how that goes tomorrow when it arrives.

Hello!

I am sorry for the inexcusable delay on this. I am continuing to ask when this will be available.

In the meantime, can you try this for setting up the I2S signals from the u-boot command prompt …

  1. Configure the pinmux registers for I2S4
# mw 0x70003144 0x6044
# mw 0x70003148 0x6044
# mw 0x7000314c 0x6044
# mw 0x70003150 0x6044
  1. Read the corresponding GPIO_CNF register for I2S4
# md 0x6000d204 1
  1. Write the GPIO_CNF register (to enable I2S4)

In my case step 2 returns the value 000000f0 …

Tegra210 (P3450-Porg) # md 0x6000d204 1
6000d204: 000000f0

We need to clear bits [7:4] if they are set. In my case they are and because bits [3:0] are not set, I simply write 0 to this register. However, if any of the bits [3:0] are set you should ensure you do not clear them.

# mw 0x6000d204 0

Regards,
Jon

Jon, I have not been able to install u-boot. Therefore, I can’t perform your recommended tasks.

Hello!

Sorry, but I think that there is a misunderstanding here. U-Boot is the bootloader and it is what is loading the Linux kernel. You just need to press any key on the console when U-Boot starts to access its command line and enter the commands. Once you had executed the commands you simply execute the ‘boot’ command to load Linux.

Regards,
Jon

Unfortunately, pressing any key during boot doesn’t work on this machine. After 3 fresh installs of jetson-nano-sd-r32.1-2019-03-18, a wired keyboard and a wireless keyboard in different USB ports, depressing of several different keys including letters, numbers and function keys, I’m lost. This should not be this big an issue.