Tx2 J21A I2S1 does not record audio correct,please help

Hi sir,
I connect a standard i2s audio device to J21A (I2S1), the wires connections as follows:

Tx2 Side i2s audio device
P39.GND — GND
P35.AUDIO_I2S_SFSYNC_3V3 ----- LRCLK
P38.AUDIO_I2S_SIN_3V3 ----- DATA
P12.AUDIO_I2S_SRCLK_3V3 ----- BCLK

The i2s audio device is an FPGA chip,all outputs are right,all signals measured with a oscilloscope are okay.
the fpga outpus fixed number LeftChannel(0x12345600),RightChannel(0x789abc00).
BCLK is 2.048MHz.
LRCK is 32kHz.

so i run command in tx2 to capture audio data:
amixer -c tegrasndt186ref sset “ADMAIF1 Mux” “I2S1”
arecord -D hw:tegrasndt186ref,0 -r 32000 -f S32_LE -c 2 -d 10 cap.wav

https://user-images.githubusercontent.com/32056331/60144348-9b032600-97f4-11e9-9c77-478f07404f9a.png
from the hexdump, almost data are not correct,only few data are right.
why?
what causes it ? please guide me, thanks .

I want to capture audio from J21A(I2S1), what should i do ?

I use JetPack4.2 to flush tx2.

does JetPack4.2 have something wrong?

Hello!

Can you tell me who is the I2S bitclock and frame master? Is it Tegra or the FPGA that is driving the bitclock and frame sync?

For Jetson TX2 we have tested external loopback by connecting one I2S interface to another and verifying that the data captured is identical to the data sent. So you should be able to capture the data and it be bit exact.

Most likely there is a slight I2S configuration mismatch between the Tegra and FPGA.

When you are capturing data via the I2S, can you dump the I2S registers by reading the following file so that we can review the configuration?

sudo /sys/kernel/debug/regmap/tegra186-i2s.0/registers

Regards,
Jon

Dear jonathanh,
The i2s audio device I’m using is FPGA.I make sure it works well.
FPGA outputs BCLK/LRCK/DATA signal, I use tx2 i2s1 to capture.

when I use the following command (copied from nvidia forum) to capture, 
  I found captured data are not right. 

amixer -c tegrasndt186ref sset “ADMAIF1 Mux” “I2S1”
arecord -D hw:tegrasndt186ref,0 -r 32000 -f S32_LE -c 2 -d 10 cap.wav

So I measured BCLK/LRCK pins On JetsonTx2 Board J21A connector, oh my god,I found bclk output signal and lrck output signal too. OMG! In theory, I want Tx2 sample data on the rising edge of BCLK ( BCLK supplied by FPGA).

Attention here,please. I mean capture,so I use arecord not aplay command. so the BCLK/LRCK should not be has signal on tx2 j21a. FPGA output clocks signal, tx2 use external input clocks to capture data.

Why BCLK/LRCK has output signal when I use arecord command ?

I searched more in google, some forums guide to make some trying.
for example I changed bitclock-slave/frame-slave to bitclock-master/frame-master and update dtb using flash.sh, no efforts, failed.
nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra/kernel/dtb/tegra186-quill-p3310-1000-c03-00-base.dtb

why should i do ? please help me. thanks.

zhangshaoyan@YNT3:~/Jetson-Tx2/butterfly/helpful$ sudo cat /sys/kernel/debug/regmap/tegra186-i2s.0/registers
[sudo] password for zhangshaoyan:
00: 00000000
04: XXXXXXXX
08: 00000000
0c: XXXXXXXX
10: XXXXXXXX
14: 00000003
18: 00000000
1c: 00000000
20: 03113300
24: 00000100
28: 00000000
2c: 00000000
30: 00000000
34: 00000000
38: 00000000
3c: 00000000
40: 00000000
44: XXXXXXXX
48: 00000000
4c: XXXXXXXX
50: XXXXXXXX
54: 00000003
58: 00000000
5c: 00000000
60: 00117700
64: 00000100
68: 00000000
6c: 00000000
70: 00000000
74: 00000000
78: 00000000
7c: 00000000
80: 00000001
84: 00000000
88: 00000001
8c: 00000000
90: XXXXXXXX
94: 00000000
98: 00000000
9c: 00000000
a0: 1f000407
a4: 0000001f
a8: 00000000
ac: 00000000
b0: 00000000
zhangshaoyan@YNT3:~/Jetson-Tx2/butterfly/helpful$

Dear jonathanh, the following are my operating logs,please check to find out what error I were make.Thanks.

zhangshaoyan@YNT5:~/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra/kernel/dtb$ …/dtc -I dtb -O dts -o tegra186-quill-p3310-1000-c03-00-base.dts tegra186-quill-p3310-1000-c03-00-base.dtb
zhangshaoyan@YNT5:~/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra/kernel/dtb$ vim tegra186-quill-p3310-1000-c03-00-base.dts
nvidia,dai-link-1 {
link-name = “rt565x-playback”;
cpu-dai = <0xbe>;
codec-dai = <0xbf>;
cpu-dai-name = “I2S1”;
codec-dai-name = “dit-hifi”;
format = “i2s”;
bitclock-master; //original is bitclock-slave,i changed to bitclock-master.
frame-master; //original is frame-slave, i changed to frame-master.

                    bitclock-noninversion;
                    frame-noninversion;
                    bit-format = "s16_le";
                    bclk_ratio = <0x0>;
                    srate = <0xbb80>;
                    num-channel = <0x2>;
                    ignore_suspend;
                    name-prefix = [78 00];
                    status = "okay";
                    linux,phandle = <0x11c>;
                    phandle = <0x11c>;
            };

zhangshaoyan@YNT5:~/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra/kernel/dtb$ …/dtc -I dts -O dtb -o tegra186-quill-p3310-1000-c03-00-base.dtb tegra186-quill-p3310-1000-c03-00-base.dts
zhangshaoyan@YNT5:~/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra/kernel/dtb$

zhangshaoyan@YNT5:~/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra$ sudo ./flash.sh -r -k kernel-dtb jetson-tx2 mmcblk0p1
###############################################################################

L4T BSP Information:

R32 (release), REVISION: 1.0, GCID: 14531094, BOARD: t186ref, EABI: aarch64,

DATE: Wed Mar 13 07:41:08 UTC 2019

###############################################################################

Target Board Information:

Name: jetson-tx2, Board Family: t186ref, SoC: Tegra 186,

OpMode: production, Boot Authentication: NS,

###############################################################################
./tegraflash.py --chip 0x18 --applet “/home/zhangshaoyan/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra/bootloader/mb1_recovery_prod.bin” --skipuid --cmd “dump eeprom boardinfo cvm.bin”
Welcome to Tegra Flash
version 1.0.0
Type ? or help for help and q or quit to exit
Use ! to execute system commands

[ 0.0027 ] Generating RCM messages
[ 0.0037 ] tegrarcm_v2 --listrcm rcm_list.xml --chip 0x18 0 --download rcm /home/zhangshaoyan/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra/bootloader/mb1_recovery_prod.bin 0 0
[ 0.0045 ] RCM 0 is saved as rcm_0.rcm
[ 0.0049 ] RCM 1 is saved as rcm_1.rcm
[ 0.0049 ] List of rcm files are saved in rcm_list.xml
[ 0.0049 ]
[ 0.0049 ] Signing RCM messages
[ 0.0056 ] tegrasign_v2 --key None --list rcm_list.xml --pubkeyhash pub_key.key
[ 0.0063 ] Assuming zero filled SBK key
[ 0.0091 ]
[ 0.0092 ] Copying signature to RCM mesages
[ 0.0099 ] tegrarcm_v2 --chip 0x18 0 --updatesig rcm_list_signed.xml
[ 0.0109 ]
[ 0.0110 ] Boot Rom communication
[ 0.0116 ] tegrarcm_v2 --chip 0x18 0 --rcm rcm_list_signed.xml --skipuid
[ 0.0123 ] RCM version 0X180001
[ 0.0132 ] Boot Rom communication completed
[ 1.0201 ]
[ 2.0240 ] tegrarcm_v2 --isapplet
[ 2.0263 ] Applet version 01.00.0000
[ 2.0413 ]
[ 2.0426 ] Retrieving EEPROM data
[ 2.0427 ] tegrarcm_v2 --oem platformdetails eeprom cvm /home/zhangshaoyan/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra/bootloader/cvm.bin
[ 2.0440 ] Applet version 01.00.0000
[ 2.0815 ] Saved platform info in /home/zhangshaoyan/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra/bootloader/cvm.bin
[ 2.1555 ]
Board ID(3310) version(D00) sku(1000) revision(E.0)
copying bctfile(/home/zhangshaoyan/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra/bootloader/t186ref/BCT/P3310_A00_8GB_Samsung_8GB_lpddr4_204Mhz_A02_l4t.cfg)… done.
copying misc_config(/home/zhangshaoyan/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra/bootloader/t186ref/BCT/tegra186-mb1-bct-misc-si-l4t.cfg)… done.
copying pinmux_config(/home/zhangshaoyan/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra/bootloader/t186ref/BCT/tegra186-mb1-bct-pinmux-quill-p3310-1000-c03.cfg)… done.
copying pmic_config(/home/zhangshaoyan/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra/bootloader/t186ref/BCT/tegra186-mb1-bct-pmic-quill-p3310-1000-c04.cfg)… done.
copying pmc_config(/home/zhangshaoyan/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra/bootloader/t186ref/BCT/tegra186-mb1-bct-pad-quill-p3310-1000-c03.cfg)… done.
copying prod_config(/home/zhangshaoyan/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra/bootloader/t186ref/BCT/tegra186-mb1-bct-prod-quill-p3310-1000-c03.cfg)… done.
copying scr_config(/home/zhangshaoyan/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra/bootloader/t186ref/BCT/minimal_scr.cfg)… done.
copying scr_cold_boot_config(/home/zhangshaoyan/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra/bootloader/t186ref/BCT/mobile_scr.cfg)… done.
copying bootrom_config(/home/zhangshaoyan/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra/bootloader/t186ref/BCT/tegra186-mb1-bct-bootrom-quill-p3310-1000-c03.cfg)… done.
copying dev_params(/home/zhangshaoyan/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra/bootloader/t186ref/BCT/emmc.cfg)… done.
Existing bootloader(/home/zhangshaoyan/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra/bootloader/nvtboot_cpu.bin) reused.
populating kernel to rootfs… done.
populating initrd to rootfs… done.
populating extlinux.conf.emmc to rootfs… done.
populating /home/zhangshaoyan/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra/kernel/dtb/tegra186-quill-p3310-1000-c03-00-base.dtb to rootfs… done.
done.
Making Boot image… done.
Existing sosfile(/home/zhangshaoyan/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra/bootloader/mb1_recovery_prod.bin) reused.
copying tegraboot(/home/zhangshaoyan/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra/bootloader/t186ref/nvtboot.bin)… done.
Existing cpu_bootloader(/home/zhangshaoyan/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra/bootloader/nvtboot_cpu.bin) reused.
Existing mb2blfile(/home/zhangshaoyan/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra/bootloader/nvtboot_recovery.bin) reused.
Existing mtspreboot(/home/zhangshaoyan/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra/bootloader/preboot_d15_prod_cr.bin) reused.
Existing mts(/home/zhangshaoyan/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra/bootloader/mce_mts_d15_prod_cr.bin) reused.
Existing mb1file(/home/zhangshaoyan/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra/bootloader/mb1_prod.bin) reused.
Existing bpffile(/home/zhangshaoyan/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra/bootloader/bpmp.bin) reused.
copying bpfdtbfile(/home/zhangshaoyan/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra/bootloader/t186ref/tegra186-a02-bpmp-quill-p3310-1000-c04-00-te770d-ucm2.dtb)… done.
Existing scefile(/home/zhangshaoyan/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra/bootloader/camera-rtcpu-sce.img) reused.
Existing spefile(/home/zhangshaoyan/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra/bootloader/spe.bin) reused.
Existing drameccfile(/home/zhangshaoyan/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra/bootloader/dram-ecc.bin) reused.
Existing badpagefile(/home/zhangshaoyan/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra/bootloader/badpage.bin) reused.
copying wb0boot(/home/zhangshaoyan/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra/bootloader/t186ref/warmboot.bin)… done.
Existing tosfile(/home/zhangshaoyan/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra/bootloader/tos-mon-only.img) reused.
Existing eksfile(/home/zhangshaoyan/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra/bootloader/eks.img) reused.
copying dtbfile(/home/zhangshaoyan/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra/kernel/dtb/tegra186-quill-p3310-1000-c03-00-base.dtb)… done.
Reusing existing system.img…
done.
Existing tbcfile(/home/zhangshaoyan/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra/bootloader/cboot.bin) reused.
copying tbcdtbfile(/home/zhangshaoyan/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra/kernel/dtb/tegra186-quill-p3310-1000-c03-00-base.dtb)… done.
copying cfgfile(/home/zhangshaoyan/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra/bootloader/t186ref/cfg/flash_l4t_t186.xml) to flash.xml… done.
Existing flasher(/home/zhangshaoyan/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra/bootloader/nvtboot_recovery_cpu.bin) reused.
Existing flashapp(/home/zhangshaoyan/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra/bootloader/tegraflash.py) reused.
*** Updating [kernel-dtb] with tegra186-quill-p3310-1000-c03-00-base.dtb ***
./tegraflash.py --bl nvtboot_recovery_cpu.bin --chip 0x18 --applet mb1_recovery_prod.bin --sdram_config P3310_A00_8GB_Samsung_8GB_lpddr4_204Mhz_A02_l4t.cfg --misc_config tegra186-mb1-bct-misc-si-l4t.cfg --pinmux_config tegra186-mb1-bct-pinmux-quill-p3310-1000-c03.cfg --pmic_config tegra186-mb1-bct-pmic-quill-p3310-1000-c04.cfg --pmc_config tegra186-mb1-bct-pad-quill-p3310-1000-c03.cfg --prod_config tegra186-mb1-bct-prod-quill-p3310-1000-c03.cfg --scr_config minimal_scr.cfg --scr_cold_boot_config mobile_scr.cfg --br_cmd_config tegra186-mb1-bct-bootrom-quill-p3310-1000-c03.cfg --dev_params emmc.cfg --cfg flash.xml --bins “mb2_bootloader nvtboot_recovery.bin; mts_preboot preboot_d15_prod_cr.bin; mts_bootpack mce_mts_d15_prod_cr.bin; bpmp_fw bpmp.bin; bpmp_fw_dtb tegra186-a02-bpmp-quill-p3310-1000-c04-00-te770d-ucm2.dtb; tlk tos-mon-only.img; eks eks.img; bootloader_dtb tegra186-quill-p3310-1000-c03-00-base.dtb” --cmd “signwrite kernel-dtb tegra186-quill-p3310-1000-c03-00-base.dtb; reboot”
Welcome to Tegra Flash
version 1.0.0
Type ? or help for help and q or quit to exit
Use ! to execute system commands

[ 0.0098 ] tegrasign_v2 --key None --getmode mode.txt
[ 0.0106 ] Assuming zero filled SBK key
[ 0.0107 ]
[ 0.0109 ] sign_type : 218103808
[ 0.0109 ] header_magic: d00dfeed
[ 0.0118 ] tegrahost_v2 --chip 0x18 --align 1_tegra186-quill-p3310-1000-c03-00-base.dtb
[ 0.0125 ]
[ 0.0133 ] tegrahost_v2 --appendsigheader 1_tegra186-quill-p3310-1000-c03-00-base.dtb zerosbk
[ 0.0146 ]
[ 0.0156 ] tegrasign_v2 --key None --list 1_tegra186-quill-p3310-1000-c03-00-base_sigheader.dtb_list.xml
[ 0.0164 ] Assuming zero filled SBK key
[ 0.0250 ]
[ 0.0263 ] tegrahost_v2 --updatesigheader 1_tegra186-quill-p3310-1000-c03-00-base_sigheader.dtb.encrypt 1_tegra186-quill-p3310-1000-c03-00-base_sigheader.dtb.hash zerosbk
[ 0.0277 ]
[ 0.0279 ] Generating RCM messages
[ 0.0286 ] tegrarcm_v2 --listrcm rcm_list.xml --chip 0x18 0 --download rcm mb1_recovery_prod.bin 0 0
[ 0.0293 ] RCM 0 is saved as rcm_0.rcm
[ 0.0296 ] RCM 1 is saved as rcm_1.rcm
[ 0.0296 ] List of rcm files are saved in rcm_list.xml
[ 0.0296 ]
[ 0.0296 ] Signing RCM messages
[ 0.0304 ] tegrasign_v2 --key None --list rcm_list.xml --pubkeyhash pub_key.key
[ 0.0311 ] Assuming zero filled SBK key
[ 0.0340 ]
[ 0.0340 ] Copying signature to RCM mesages
[ 0.0347 ] tegrarcm_v2 --chip 0x18 0 --updatesig rcm_list_signed.xml
[ 0.0358 ]
[ 0.0358 ] Boot Rom communication
[ 0.0365 ] tegrarcm_v2 --chip 0x18 0 --rcm rcm_list_signed.xml
[ 0.0371 ] BootRom is not running
[ 5.2428 ]
[ 6.2468 ] tegrarcm_v2 --isapplet
[ 6.2490 ] Applet version 01.00.0000
[ 6.2519 ]
[ 6.2546 ] tegrasign_v2 --key None --getmode mode.txt
[ 6.2562 ] Assuming zero filled SBK key
[ 6.2564 ]
[ 6.2564 ] Parsing partition layout
[ 6.2574 ] tegraparser_v2 --pt flash.xml.tmp
[ 6.2589 ]
[ 6.2590 ] Creating list of images to be signed
[ 6.2600 ] tegrahost_v2 --chip 0x18 0 --partitionlayout flash.xml.bin --list images_list.xml zerosbk
[ 6.2815 ]
[ 6.2815 ] Generating signatures
[ 6.2824 ] tegrasign_v2 --key None --list images_list.xml --pubkeyhash pub_key.key
[ 6.2831 ] Assuming zero filled SBK key
[ 6.5209 ]
[ 6.5210 ] Reading BCT from device for further operations
[ 6.5210 ] Generating blob
[ 6.5220 ] tegrahost_v2 --chip 0x18 --align blob_nvtboot_recovery_cpu.bin
[ 6.5228 ]
[ 6.5236 ] tegrahost_v2 --appendsigheader blob_nvtboot_recovery_cpu.bin zerosbk
[ 6.5247 ]
[ 6.5257 ] tegrasign_v2 --key None --list blob_nvtboot_recovery_cpu_sigheader.bin_list.xml
[ 6.5265 ] Assuming zero filled SBK key
[ 6.5313 ]
[ 6.5325 ] tegrahost_v2 --updatesigheader blob_nvtboot_recovery_cpu_sigheader.bin.encrypt blob_nvtboot_recovery_cpu_sigheader.bin.hash zerosbk
[ 6.5338 ]
[ 6.5351 ] tegrahost_v2 --chip 0x18 --align blob_nvtboot_recovery.bin
[ 6.5361 ]
[ 6.5369 ] tegrahost_v2 --appendsigheader blob_nvtboot_recovery.bin zerosbk
[ 6.5378 ]
[ 6.5389 ] tegrasign_v2 --key None --list blob_nvtboot_recovery_sigheader.bin_list.xml
[ 6.5396 ] Assuming zero filled SBK key
[ 6.5419 ]
[ 6.5429 ] tegrahost_v2 --updatesigheader blob_nvtboot_recovery_sigheader.bin.encrypt blob_nvtboot_recovery_sigheader.bin.hash zerosbk
[ 6.5438 ]
[ 6.5447 ] tegrahost_v2 --chip 0x18 --align blob_preboot_d15_prod_cr.bin
[ 6.5455 ]
[ 6.5463 ] tegrahost_v2 --appendsigheader blob_preboot_d15_prod_cr.bin zerosbk
[ 6.5474 ]
[ 6.5491 ] tegrasign_v2 --key None --list blob_preboot_d15_prod_cr_sigheader.bin_list.xml
[ 6.5499 ] Assuming zero filled SBK key
[ 6.5516 ]
[ 6.5526 ] tegrahost_v2 --updatesigheader blob_preboot_d15_prod_cr_sigheader.bin.encrypt blob_preboot_d15_prod_cr_sigheader.bin.hash zerosbk
[ 6.5536 ]
[ 6.5545 ] tegrahost_v2 --chip 0x18 --align blob_mce_mts_d15_prod_cr.bin
[ 6.5552 ]
[ 6.5559 ] tegrahost_v2 --appendsigheader blob_mce_mts_d15_prod_cr.bin zerosbk
[ 6.5601 ]
[ 6.5612 ] tegrasign_v2 --key None --list blob_mce_mts_d15_prod_cr_sigheader.bin_list.xml
[ 6.5620 ] Assuming zero filled SBK key
[ 6.6103 ]
[ 6.6115 ] tegrahost_v2 --updatesigheader blob_mce_mts_d15_prod_cr_sigheader.bin.encrypt blob_mce_mts_d15_prod_cr_sigheader.bin.hash zerosbk
[ 6.6146 ]
[ 6.6157 ] tegrahost_v2 --chip 0x18 --align blob_bpmp.bin
[ 6.6164 ]
[ 6.6173 ] tegrahost_v2 --appendsigheader blob_bpmp.bin zerosbk
[ 6.6190 ]
[ 6.6199 ] tegrasign_v2 --key None --list blob_bpmp_sigheader.bin_list.xml
[ 6.6207 ] Assuming zero filled SBK key
[ 6.6341 ]
[ 6.6352 ] tegrahost_v2 --updatesigheader blob_bpmp_sigheader.bin.encrypt blob_bpmp_sigheader.bin.hash zerosbk
[ 6.6366 ]
[ 6.6379 ] tegrahost_v2 --chip 0x18 --align blob_tegra186-a02-bpmp-quill-p3310-1000-c04-00-te770d-ucm2.dtb
[ 6.6391 ]
[ 6.6403 ] tegrahost_v2 --appendsigheader blob_tegra186-a02-bpmp-quill-p3310-1000-c04-00-te770d-ucm2.dtb zerosbk
[ 6.6418 ]
[ 6.6428 ] tegrasign_v2 --key None --list blob_tegra186-a02-bpmp-quill-p3310-1000-c04-00-te770d-ucm2_sigheader.dtb_list.xml
[ 6.6436 ] Assuming zero filled SBK key
[ 6.6548 ]
[ 6.6559 ] tegrahost_v2 --updatesigheader blob_tegra186-a02-bpmp-quill-p3310-1000-c04-00-te770d-ucm2_sigheader.dtb.encrypt blob_tegra186-a02-bpmp-quill-p3310-1000-c04-00-te770d-ucm2_sigheader.dtb.hash zerosbk
[ 6.6573 ]
[ 6.6583 ] tegrahost_v2 --chip 0x18 --align blob_tos-mon-only.img
[ 6.6590 ]
[ 6.6597 ] tegrahost_v2 --appendsigheader blob_tos-mon-only.img zerosbk
[ 6.6606 ]
[ 6.6615 ] tegrasign_v2 --key None --list blob_tos-mon-only_sigheader.img_list.xml
[ 6.6622 ] Assuming zero filled SBK key
[ 6.6644 ]
[ 6.6654 ] tegrahost_v2 --updatesigheader blob_tos-mon-only_sigheader.img.encrypt blob_tos-mon-only_sigheader.img.hash zerosbk
[ 6.6663 ]
[ 6.6672 ] tegrahost_v2 --chip 0x18 --align blob_eks.img
[ 6.6679 ]
[ 6.6687 ] tegrahost_v2 --appendsigheader blob_eks.img zerosbk
[ 6.6695 ]
[ 6.6705 ] tegrasign_v2 --key None --list blob_eks_sigheader.img_list.xml
[ 6.6712 ] Assuming zero filled SBK key
[ 6.6714 ]
[ 6.6724 ] tegrahost_v2 --updatesigheader blob_eks_sigheader.img.encrypt blob_eks_sigheader.img.hash zerosbk
[ 6.6732 ]
[ 6.6740 ] tegrahost_v2 --chip 0x18 --align blob_tegra186-quill-p3310-1000-c03-00-base.dtb
[ 6.6747 ]
[ 6.6754 ] tegrahost_v2 --appendsigheader blob_tegra186-quill-p3310-1000-c03-00-base.dtb zerosbk
[ 6.6767 ]
[ 6.6777 ] tegrasign_v2 --key None --list blob_tegra186-quill-p3310-1000-c03-00-base_sigheader.dtb_list.xml
[ 6.6785 ] Assuming zero filled SBK key
[ 6.6867 ]
[ 6.6877 ] tegrahost_v2 --updatesigheader blob_tegra186-quill-p3310-1000-c03-00-base_sigheader.dtb.encrypt blob_tegra186-quill-p3310-1000-c03-00-base_sigheader.dtb.hash zerosbk
[ 6.6889 ]
[ 6.6898 ] tegrahost_v2 --chip 0x18 --generateblob blob.xml blob.bin
[ 6.6905 ] number of images in blob are 9
[ 6.6907 ] blobsize is 3866440
[ 6.6908 ] Added binary blob_nvtboot_recovery_cpu_sigheader.bin.encrypt of size 202832
[ 6.6924 ] Added binary blob_nvtboot_recovery_sigheader.bin.encrypt of size 89184
[ 6.6928 ] Added binary blob_preboot_d15_prod_cr_sigheader.bin.encrypt of size 63104
[ 6.6931 ] Added binary blob_mce_mts_d15_prod_cr_sigheader.bin.encrypt of size 2082144
[ 6.6935 ] Added binary blob_bpmp_sigheader.bin.encrypt of size 533056
[ 6.6940 ] Added binary blob_tegra186-a02-bpmp-quill-p3310-1000-c04-00-te770d-ucm2_sigheader.dtb.encrypt of size 466240
[ 6.6945 ] Added binary blob_tos-mon-only_sigheader.img.encrypt of size 83760
[ 6.6948 ] Added binary blob_eks_sigheader.img.encrypt of size 1440
[ 6.6951 ] Added binary blob_tegra186-quill-p3310-1000-c03-00-base_sigheader.dtb.encrypt of size 344528
[ 6.6962 ]
[ 6.6963 ] Sending bootloader and pre-requisite binaries
[ 6.6972 ] tegrarcm_v2 --download blob blob.bin
[ 6.6980 ] Applet version 01.00.0000
[ 6.7162 ] Sending blob
[ 6.7163 ] […] 100%
[ 7.2842 ]
[ 7.2869 ] tegrarcm_v2 --boot recovery
[ 7.2892 ] Applet version 01.00.0000
[ 7.3060 ]
[ 8.3105 ] tegrarcm_v2 --isapplet
[ 8.3268 ]
[ 8.3295 ] tegradevflash_v2 --iscpubl
[ 8.3305 ] CPU Bootloader is not running on device.
[ 8.3466 ]
[ 9.3507 ] tegrarcm_v2 --isapplet
[ 9.3679 ]
[ 9.3693 ] tegradevflash_v2 --iscpubl
[ 9.3706 ] Bootloader version 01.00.0000
[ 9.3889 ] Bootloader version 01.00.0000
[ 9.3896 ]
[ 9.3897 ] Writing partition
[ 9.3922 ] tegradevflash_v2 --write kernel-dtb 1_tegra186-quill-p3310-1000-c03-00-base_sigheader.dtb.encrypt
[ 9.3946 ] Bootloader version 01.00.0000
[ 9.4124 ] Writing partition kernel-dtb with 1_tegra186-quill-p3310-1000-c03-00-base_sigheader.dtb.encrypt
[ 9.4139 ] […] 100%
[ 9.4369 ]
[ 9.4370 ] Coldbooting the device
[ 9.4390 ] tegradevflash_v2 --reboot coldboot
[ 9.4411 ] Bootloader version 01.00.0000
[ 9.4475 ]
*** The [kernel-dtb] has been updated successfully. ***
zhangshaoyan@YNT5:~/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra$

It seems I2S1 now in play output mode, not in record input mode.
I think nvidia tx2 i2s drver is okay, but I don’t know how to operate it to use external BCLK&LRCK to capture DATA.

Regards.
Thanks in advance.

Hello!

The following register is the Tegra I2S_CTRL register. Bit 10 of this register configures whether the Tegra I2S is the master or slave. With bit 10 set, this means that Tegra is the master this explain why it is driving the I2S bitclock and frame sync.

The following is the correct change to make to configure I2S1 to be the slave and not master.

After updating the DTB and flashing are you still not seeing the Tegra I2S configured as the slave?

If you check the following directory, do you still see bitclock-slave and frame-slave?

ls /proc/device-tree/sound/nvidia,dai-link-1/

Regards,
Jon

Yes,jonathanh.

I make sure I changed bitclock-master & frame-master in dts file,compile to dtb ,then flush dtb to jetson tx2.

I checked the /proc/device-tree/sound/nvidia,dai-link-1/ directory you mentioned above, but why it still shows bitclock-slave/frame-slave ? why not changed to bitclock-master/frame-master?
are there something I missed? please help me.

zhangshaoyan@YNT3:/proc/device-tree/sound/nvidia,dai-link-1$ pwd
/proc/device-tree/sound/nvidia,dai-link-1
zhangshaoyan@YNT3:/proc/device-tree/sound/nvidia,dai-link-1$ ls
bclk_ratio bit-format cpu-dai frame-noninversion link-name name-prefix srate
bitclock-noninversion codec-dai cpu-dai-name frame-slave linux,phandle num-channel status
bitclock-slave codec-dai-name format ignore_suspend name phandle
zhangshaoyan@YNT3:/proc/device-tree/sound/nvidia,dai-link-1$ ls -l
total 0
-r–r--r-- 1 root root 4 7月 3 09:28 bclk_ratio
-r–r--r-- 1 root root 0 7月 3 09:28 bitclock-noninversion
-r–r--r-- 1 root root 0 7月 3 09:28 bitclock-slave
-r–r--r-- 1 root root 7 7月 3 09:28 bit-format
-r–r--r-- 1 root root 4 7月 3 09:28 codec-dai
-r–r--r-- 1 root root 9 7月 3 09:28 codec-dai-name
-r–r--r-- 1 root root 4 7月 3 09:28 cpu-dai
-r–r--r-- 1 root root 5 7月 3 09:28 cpu-dai-name
-r–r--r-- 1 root root 4 7月 3 09:28 format
-r–r--r-- 1 root root 0 7月 3 09:28 frame-noninversion
-r–r--r-- 1 root root 0 7月 3 09:28 frame-slave
-r–r--r-- 1 root root 0 7月 3 09:28 ignore_suspend
-r–r--r-- 1 root root 16 7月 3 09:28 link-name
-r–r--r-- 1 root root 4 7月 3 09:28 linux,phandle
-r–r--r-- 1 root root 18 7月 3 09:28 name
-r–r--r-- 1 root root 2 7月 3 09:28 name-prefix
-r–r--r-- 1 root root 4 7月 3 09:28 num-channel
-r–r--r-- 1 root root 4 7月 3 09:28 phandle
-r–r--r-- 1 root root 4 7月 3 09:28 srate
-r–r--r-- 1 root root 5 7月 3 09:28 status
zhangshaoyan@YNT3:/proc/device-tree/sound/nvidia,dai-link-1$

Dear jonathanh,
here please allow me to make a brief conculution.

I download sdkmanager_0.9.12-4180_amd64.deb from nvidia website.
install it on ubuntu18.04, then flush Jetson Tx2 hardware with it.

The project requires me to connect another FPGA board with I2S output to Tx2.
FPGA output i2s audio data(it drives BCLK/LRCK/DATA) ,Tx2 read audio data in.
So, I connect 4 wires to Tx2 J21A connector.
All wires are connected okay I make sure.

So far,I don’t know how to programming to read data in,so I searched in nvidia forum.
Fortunately,I found two following commands:
amixer -c tegrasndt186ref sset “ADMAIF1 Mux” “I2S1”
arecord -D hw:tegrasndt186ref,0 -r 32000 -f S32_LE -c 2 -d 10 cap.wav

But the result is error, so I measured BCLK/LRCK pins with an oscilloscope, I found they output signal!
It’s clear this not fit my requirement.

So I searched again in nvidia forum to try to find something useful to help me.
I got following messages.
Tx2 I2S1 works in slave mode at default, so it outputs clock to latch data in. describe as follows.
Tx2 BCLK >>>>>>>>>>>>>>> FPGA BCLK
Tx2 LRCK >>>>>>>>>>>>>>> FPGA LRCK
Tx2 DATA <<<<<<<<<<<<<<< FPGA DATA

Thus FPGA code cannot be changed,So I must to make Tx2 I2S1 to use external BCLK/LRCK to latch DATA.
Here I draw the flow briefly,please read carefully.thanks.
Tx2 BCLK <<<<<<<<<<<<<<< FPGA BCLK
Tx2 LRCK <<<<<<<<<<<<<<< FPGA LRCK
Tx2 DATA <<<<<<<<<<<<<<< FPGA DATA

Someone said in forum, change bitclock-slave/frame-slave to bitclock-master/frame-master in dtb file may works.
So I changed and tried , but failed. Although I changed to bitclock-master/frame-master,
BCLK/LRCK pins are still have output signals. why ?

I am not familiar with Jetson Tx2’s datasheet.
The registers of Audio section are huge.
You recommend me check the file /sys/kernel/debug/regmap/tegra186-i2s.0/registers , I did it.
Thank you to point out the possible errors, but how should I do now?
a0: 1f000407

what should be changed in dts/dtb? or what should be changed in kernel source driver?

Are there other codes should be changed except bitclock-master/frame-master?

Please help me,please jonathanh .

I doubt that the modify bitclock-master/frame-master in dtb file does not work.
Should I modify tegra186-quill-p3310-1000-c03-00-base.dtb file ?

I’m using the following packages,
sdkmanager_0.9.12-4180_amd64.deb
JetPack_4.2_Linux_P3310
Jetson TX2 Developer Kit
jetson-tx2, Board Family: t186ref, SoC: Tegra 186,

“uname -r” output “4.9.140-tegra”.

Best regards.

Congratulations!

I rename tegra186-quill-p3310-1000-a00-00-base.dtb to another name, then flash.sh reports errors.
then I restore original name and execute flash.sh again.
The jetson tx2 reboot automatically,
then I see bitclock-master & frame-master in directory /proc/device-tree/sound/nvidia,dai-link-1
Is there caching or something special here to cause this error?
Whatever, bitclock-master & frame-master appear.

zhangshaoyan@YNT3:/proc/device-tree/sound$ pwd
/proc/device-tree/sound
zhangshaoyan@YNT3:/proc/device-tree/sound$ ls
clock-names iommu-group-id name nvidia,dai-link-10 nvidia,dai-link-3 nvidia,dai-link-7 nvidia,num-clk reset-names
clocks iommu-resv-regions nvidia,audio-routing nvidia,dai-link-11 nvidia,dai-link-4 nvidia,dai-link-8 nvidia,num-codec-link resets
compatible iommus nvidia,clk-rates nvidia,dai-link-12 nvidia,dai-link-5 nvidia,dai-link-9 nvidia,xbar status
dma-mask linux,phandle nvidia,dai-link-1 nvidia,dai-link-2 nvidia,dai-link-6 nvidia,model phandle
zhangshaoyan@YNT3:/proc/device-tree/sound$ ls -l nvidia,dai-link-1
total 0
-r–r--r-- 1 root root 4 7月 3 17:11 bclk_ratio
-r–r--r-- 1 root root 0 7月 3 17:11 bitclock-master
-r–r--r-- 1 root root 0 7月 3 17:11 bitclock-noninversion
-r–r--r-- 1 root root 7 7月 3 17:11 bit-format
-r–r--r-- 1 root root 4 7月 3 17:11 codec-dai
-r–r--r-- 1 root root 9 7月 3 17:11 codec-dai-name
-r–r--r-- 1 root root 4 7月 3 17:11 cpu-dai
-r–r--r-- 1 root root 5 7月 3 17:11 cpu-dai-name
-r–r--r-- 1 root root 4 7月 3 17:11 format
-r–r--r-- 1 root root 0 7月 3 17:11 frame-master
-r–r--r-- 1 root root 0 7月 3 17:11 frame-noninversion
-r–r--r-- 1 root root 0 7月 3 17:11 ignore_suspend
-r–r--r-- 1 root root 16 7月 3 17:11 link-name
-r–r--r-- 1 root root 4 7月 3 17:11 linux,phandle
-r–r--r-- 1 root root 18 7月 3 17:11 name
-r–r--r-- 1 root root 2 7月 3 17:11 name-prefix
-r–r--r-- 1 root root 4 7月 3 17:11 num-channel
-r–r--r-- 1 root root 4 7月 3 17:11 phandle
-r–r--r-- 1 root root 4 7月 3 17:11 srate
-r–r--r-- 1 root root 5 7月 3 17:11 status
zhangshaoyan@YNT3:/proc/device-tree/sound$


But,But,But,it seems something wrong still.

When I execute following commands to read in, the BCLK/LRCK on J21 still output signal!!! OMG!

amixer -c tegrasndt186ref sset “ADMAIF1 Mux” “I2S1”
arecord -D hw:tegrasndt186ref,0 -r 32000 -f S32_LE -c 2 -d 10 cap.wav

why? how to set i2s1 to use external BCLK/LRCK to latch data in ?

Best regards.

Hello!

Yes this should be the correct DTB, you can check by …

$ dmesg | grep DTS
[    0.184257] DTS File Name: /home/jonathanh/workdir/tegra/l4t-rel32/kernel/kernel-4.9/arch/arm64/boot/dts/../../../../../../hardware/nvidia/platform/t18x/quill/kernel-dts/tegra186-quill-p3310-1000-c03-00-base.dts

So yes you should modify the DT file that is being used for the version of the board you have.

Regards
Jon

Hello!

OK great that looks better.

Now that is odd. Can you dump the I2S registers again now?

sudo /sys/kernel/debug/regmap/tegra186-i2s.0/registers

There is a mixer control that will also show the configuration of the I2S master mode …

$ amixer -c tegrasndt186ref cget name='I2S1 codec master mode'
numid=1082,iface=MIXER,name='I2S1 codec master mode'
  ; type=ENUMERATED,access=rw------,values=1,items=5
  ; Item #0 'None'
  ; Item #1 'cbm-cfm'
  ; Item #2 'cbs-cfm'
  ; Item #3 'cbm-cfs'
  ; Item #4 'cbs-cfs'
  : values=4

By default for me it is ‘cbs-cfs’ meaning codec bitclock slave and frame slave. You want ‘cbm-cfm’ and you can set this by …

$ amixer -c tegrasndt186ref cset name='I2S1 codec master mode' 1                                                                                                                                                         
numid=1082,iface=MIXER,name='I2S1 codec master mode'
  ; type=ENUMERATED,access=rw------,values=1,items=5
  ; Item #0 'None'
  ; Item #1 'cbm-cfm'
  ; Item #2 'cbs-cfm'
  ; Item #3 'cbm-cfs'
  ; Item #4 'cbs-cfs'
  : values=1

The reason why the DT value may not have been taken is because it you only flash the DTB, then the value for the above mixer control will be reloaded from the previous value stored in /var/lib/alsa/asound.state.

If you reflash the entire system, then by default /var/lib/alsa/asound.state does not exist and so the default value from DT will not be overridden.

Regards,
Jon

Dear jonathanh!

     Thank you for your patient. 
     I did follow your guides,but still error occured.  

zhangshaoyan@YNT3:~/Jetson-Tx2/butterfly/helpful$ ls /proc/device-tree/sound/
clock-names iommu-group-id name nvidia,dai-link-10 nvidia,dai-link-3 nvidia,dai-link-7 nvidia,num-clk reset-names
clocks iommu-resv-regions nvidia,audio-routing nvidia,dai-link-11 nvidia,dai-link-4 nvidia,dai-link-8 nvidia,num-codec-link resets
compatible iommus nvidia,clk-rates nvidia,dai-link-12 nvidia,dai-link-5 nvidia,dai-link-9 nvidia,xbar status
dma-mask linux,phandle nvidia,dai-link-1 nvidia,dai-link-2 nvidia,dai-link-6 nvidia,model phandle
zhangshaoyan@YNT3:~/Jetson-Tx2/butterfly/helpful$ ls /proc/device-tree/sound/nvidia,dai-link-1
bclk_ratio bitclock-noninversion codec-dai cpu-dai format frame-noninversion link-name name num-channel srate
bitclock-master bit-format codec-dai-name cpu-dai-name frame-master ignore_suspend linux,phandle name-prefix phandle status
zhangshaoyan@YNT3:~/Jetson-Tx2/butterfly/helpful$ sudo cat /sys/kernel/debug/regmap/tegra186-i2s.0/registers
00: 00000000
04: XXXXXXXX
08: 00000000
0c: XXXXXXXX
10: XXXXXXXX
14: 00000003
18: 00000000
1c: 00000000
20: 03113300
24: 00000100
28: 00000000
2c: 00000000
30: 00000000
34: 00000000
38: 00000000
3c: 00000000
40: 00000000
44: XXXXXXXX
48: 00000000
4c: XXXXXXXX
50: XXXXXXXX
54: 00000003
58: 00000000
5c: 00000000
60: 00117700
64: 00000100
68: 00000000
6c: 00000000
70: 00000000
74: 00000000
78: 00000000
7c: 00000000
80: 00000001
84: 00000000
88: 00000001
8c: 00000000
90: XXXXXXXX
94: 00000000
98: 00000000
9c: 00000000
a0: 1f000007
a4: 0000001f
a8: 00000000
ac: 00000000
b0: 00000000
zhangshaoyan@YNT3:~/Jetson-Tx2/butterfly/helpful$
zhangshaoyan@YNT3:~/Jetson-Tx2/butterfly/helpful$ amixer -c tegrasndt186ref cset name=“I2S1 codec master mode” 1
numid=1082,iface=MIXER,name=‘I2S1 codec master mode’
; type=ENUMERATED,access=rw------,values=1,items=5
; Item #0 ‘None’
; Item #1 ‘cbm-cfm’
; Item #2 ‘cbs-cfm’
; Item #3 ‘cbm-cfs’
; Item #4 ‘cbs-cfs’
: values=1
zhangshaoyan@YNT3:~/Jetson-Tx2/butterfly/helpful$ amixer -c tegrasndt186ref cget name=“I2S1 codec master mode”
numid=1082,iface=MIXER,name=‘I2S1 codec master mode’
; type=ENUMERATED,access=rw------,values=1,items=5
; Item #0 ‘None’
; Item #1 ‘cbm-cfm’
; Item #2 ‘cbs-cfm’
; Item #3 ‘cbm-cfs’
; Item #4 ‘cbs-cfs’
: values=1
zhangshaoyan@YNT3:~/Jetson-Tx2/butterfly/helpful$

zhangshaoyan@YNT3:~/Jetson-Tx2/butterfly/helpful$ amixer -c tegrasndt186ref sset “ADMAIF1 Mux” “I2S1”
Simple mixer control ‘ADMAIF1 Mux’,0
Capabilities: enum
Items: ‘None’ ‘ADMAIF1’ ‘ADMAIF2’ ‘ADMAIF3’ ‘ADMAIF4’ ‘ADMAIF5’ ‘ADMAIF6’ ‘ADMAIF7’ ‘ADMAIF8’ ‘ADMAIF9’ ‘ADMAIF10’ ‘ADMAIF11’ ‘ADMAIF12’ ‘ADMAIF13’ ‘ADMAIF14’ ‘ADMAIF15’ ‘ADMAIF16’ ‘I2S1’ ‘I2S2’ ‘I2S3’ ‘I2S4’ ‘I2S5’ ‘I2S6’ ‘SFC1’ ‘SFC2’ ‘SFC3’ ‘SFC4’ ‘MIXER1-1’ ‘MIXER1-2’ ‘MIXER1-3’ ‘MIXER1-4’ ‘MIXER1-5’ ‘AMX1’ ‘AMX2’ ‘AMX3’ ‘AMX4’ ‘ARAD1’ ‘AFC1’ ‘AFC2’ ‘AFC3’ ‘AFC4’ ‘AFC5’ ‘AFC6’ ‘OPE1’ ‘SPKPROT1’ ‘MVC1’ ‘MVC2’ ‘IQC1-1’ ‘IQC1-2’ ‘IQC2-1’ ‘IQC2-2’ ‘DMIC1’ ‘DMIC2’ ‘DMIC3’ ‘DMIC4’ ‘ADX1-1’ ‘ADX1-2’ ‘ADX1-3’ ‘ADX1-4’ ‘ADX2-1’ ‘ADX2-2’ ‘ADX2-3’ ‘ADX2-4’ ‘ADX3-1’ ‘ADX3-2’ ‘ADX3-3’ ‘ADX3-4’ ‘ADX4-1’ ‘ADX4-2’ ‘ADX4-3’ ‘ADX4-4’ ‘ADMAIF17’ ‘ADMAIF18’ ‘ADMAIF19’ ‘ADMAIF20’ ‘ASRC1-1’ ‘ASRC1-2’ ‘ASRC1-3’ ‘ASRC1-4’ ‘ASRC1-5’ ‘ASRC1-6’
Item0: ‘I2S1’
zhangshaoyan@YNT3:~/Jetson-Tx2/butterfly/helpful$ arecord -D hw:tegrasndt186ref,0 -r 48000 -f S32_LE -t raw -c 2 -d 10 cap.pcm
Recording raw data ‘cap.pcm’ : Signed 32 bit Little Endian, Rate 48000 Hz, Stereo
arecord: pcm_read:2103: read error: Input/output error
zhangshaoyan@YNT3:~/Jetson-Tx2/butterfly/helpful$
zhangshaoyan@YNT3:~/Jetson-Tx2/butterfly/helpful$ du -sh cap.pcm
0 cap.pcm

I check log, belows are dmesg output.
[ 92.307265] tegra210-i2s tegra186-i2s.0: Failed at I2S0_TX sw reset
[ 92.313708] tegra210-i2s tegra186-i2s.0: ASoC: PRE_PMU: I2S1 DAP TX event failed: -22
[ 328.370878] tegra210-i2s tegra186-i2s.0: Failed at I2S0_TX sw reset
[ 328.377326] tegra210-i2s tegra186-i2s.0: ASoC: PRE_PMU: I2S1 DAP TX event failed: -22
[ 356.482402] tegra210-i2s tegra186-i2s.0: Failed at I2S0_RX sw reset
[ 356.488679] tegra210-i2s tegra186-i2s.0: ASoC: PRE_PMU: I2S1 DAP RX event failed: -22
[ 395.772094] tegra210-i2s tegra186-i2s.0: Failed at I2S0_RX sw reset
[ 395.778413] tegra210-i2s tegra186-i2s.0: ASoC: PRE_PMU: I2S1 DAP RX event failed: -22

I don’t know how to solve it.
So I reboot tx2 without executing any commands. At now, I measured BCLK/BCLK,it has output signal!
OMG! Why? I’m not execute any commands!

Please guide me again ,jonathanh. Best regards. Thank you very much.

Hello!

Great! That looks better!

OK, this means that the I2S interface is not seeing the bitclock and so the software reset of the I2S interface is failing.

Can you dump the following …

sudo grep dap1 /sys/kernel/debug/tegra_pinctrl_reg

We need to check that the input enable bit for the I2S pins are enabled. The DAP1 (I2S1) pins are configured via the MB1 pinmux configuration file …

$ grep dap1 bootloader/tegra186-mb1-bct-pinmux-quill-p3310-1000-c03.cfg 
pinmux.0x02431040 = 0x00000440; # dap1_sclk_pj0: i2s1, tristate-disable, input-enable
pinmux.0x02431038 = 0x00000400; # dap1_dout_pj1: i2s1, tristate-disable, input-disable
pinmux.0x02431030 = 0x00000448; # dap1_din_pj2: i2s1, pull-up, tristate-disable, input-enable
pinmux.0x02431028 = 0x00000440; # dap1_fs_pj3: i2s1, tristate-disable, input-enable

So check the above file to see if it has the ‘input-enable’ set for the dap1_sclk and dap1_fs pins. If not we need to set bit 6 in the above registers. We can do this by updating the MB1 configuration and reflashing the device.

Regards,
Jon

Dear jonathanh.

I’m so sorry to trouble you many times. I followed your tips, but not capture data correctly yet.

###############################################################################

L4T BSP Information:

R32 (release), REVISION: 1.0, GCID: 14531094, BOARD: t186ref, EABI: aarch64,

DATE: Wed Mar 13 07:41:08 UTC 2019

###############################################################################

Target Board Information:

Name: jetson-tx2, Board Family: t186ref, SoC: Tegra 186,

OpMode: production, Boot Authentication: NS,

###############################################################################
./tegraflash.py --chip 0x18 --applet “/home/zhangshaoyan/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra/bootloader/mb1_recovery_prod.bin” --skipuid --cmd “dump eeprom boardinfo cvm.bin”
Welcome to Tegra Flash
version 1.0.0
Type ? or help for help and q or quit to exit
Use ! to execute system commands

[ 0.0087 ] Generating RCM messages
[ 0.0108 ] tegrarcm_v2 --listrcm rcm_list.xml --chip 0x18 0 --download rcm /home/zhangshaoyan/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra/bootloader/mb1_recovery_prod.bin 0 0
[ 0.0127 ] RCM 0 is saved as rcm_0.rcm
[ 0.0293 ] RCM 1 is saved as rcm_1.rcm
[ 0.0293 ] List of rcm files are saved in rcm_list.xml
[ 0.0293 ]
[ 0.0293 ] Signing RCM messages
[ 0.0415 ] tegrasign_v2 --key None --list rcm_list.xml --pubkeyhash pub_key.key
[ 0.0434 ] Assuming zero filled SBK key
[ 0.0511 ]
[ 0.0511 ] Copying signature to RCM mesages
[ 0.0531 ] tegrarcm_v2 --chip 0x18 0 --updatesig rcm_list_signed.xml
[ 0.0555 ]
[ 0.0556 ] Boot Rom communication
[ 0.0574 ] tegrarcm_v2 --chip 0x18 0 --rcm rcm_list_signed.xml --skipuid
[ 0.0591 ] RCM version 0X180001
[ 0.0604 ] Boot Rom communication completed
[ 1.0671 ]
[ 2.0711 ] tegrarcm_v2 --isapplet
[ 2.0735 ] Applet version 01.00.0000
[ 2.0765 ]
[ 2.0791 ] Retrieving EEPROM data
[ 2.0794 ] tegrarcm_v2 --oem platformdetails eeprom cvm /home/zhangshaoyan/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra/bootloader/cvm.bin
[ 2.0807 ] Applet version 01.00.0000
[ 2.0954 ] Saved platform info in /home/zhangshaoyan/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra/bootloader/cvm.bin
[ 2.1695 ]
Board ID(3310) version(D00) sku(1000) revision(E.0)
copying bctfile(/home/zhangshaoyan/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra/bootloader/t186ref/BCT/P3310_A00_8GB_Samsung_8GB_lpddr4_204Mhz_A02_l4t.cfg)… done.
copying misc_config(/home/zhangshaoyan/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra/bootloader/t186ref/BCT/tegra186-mb1-bct-misc-si-l4t.cfg)… done.
copying pinmux_config(/home/zhangshaoyan/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra/bootloader/t186ref/BCT/tegra186-mb1-bct-pinmux-quill-p3310-1000-c03.cfg)… done.
copying pmic_config(/home/zhangshaoyan/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra/bootloader/t186ref/BCT/tegra186-mb1-bct-pmic-quill-p3310-1000-c04.cfg)… done.
copying pmc_config(/home/zhangshaoyan/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra/bootloader/t186ref/BCT/tegra186-mb1-bct-pad-quill-p3310-1000-c03.cfg)… done.
copying prod_config(/home/zhangshaoyan/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra/bootloader/t186ref/BCT/tegra186-mb1-bct-prod-quill-p3310-1000-c03.cfg)… done.
copying scr_config(/home/zhangshaoyan/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra/bootloader/t186ref/BCT/minimal_scr.cfg)… done.
copying scr_cold_boot_config(/home/zhangshaoyan/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra/bootloader/t186ref/BCT/mobile_scr.cfg)… done.
copying bootrom_config(/home/zhangshaoyan/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra/bootloader/t186ref/BCT/tegra186-mb1-bct-bootrom-quill-p3310-1000-c03.cfg)… done.
copying dev_params(/home/zhangshaoyan/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra/bootloader/t186ref/BCT/emmc.cfg)… done.
Existing bootloader(/home/zhangshaoyan/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra/bootloader/nvtboot_cpu.bin) reused.
populating kernel to rootfs… done.
populating initrd to rootfs… done.
populating extlinux.conf.emmc to rootfs… done.
populating /home/zhangshaoyan/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra/kernel/dtb/tegra186-quill-p3310-1000-c03-00-base.dtb to rootfs… done.
done.

from the flash.sh output logs, I think the pin mux config file is
/home/zhangshaoyan/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra/bootloader/t186ref/BCT/tegra186-mb1-bct-pinmux-quill-p3310-1000-c03.cfg

firstly,I changed in #### Pinmux for gpio-input pins #### section then execute sudo ./flash.sh jetson-tx2 mmcblk0p2 to flush tx2. after reboot, no change in tegra_pinctrl_reg file.

#### Pinmux for gpio-input pins ####
pinmux.0x022130a0 = 0x00000001; # CONFIG B5
pinmux.0x02434050 = 0x00000000; # GPIO gpio_wan2_pb5
pinmux.0x02213200 = 0x00000001; # CONFIG C0
pinmux.0x02434040 = 0x00000000; # GPIO gpio_wan4_pc0
pinmux.0x02215000 = 0x00000001; # CONFIG J0
pinmux.0x02431040 = 0x00000440; # GPIO dap1_sclk_pj0
pinmux.0x02215020 = 0x00000001; # CONFIG J1
pinmux.0x02431038 = 0x00000400; # GPIO dap1_dout_pj1
pinmux.0x02215040 = 0x00000001; # CONFIG J2
pinmux.0x02431030 = 0x00000448; # GPIO dap1_din_pj2
pinmux.0x02215060 = 0x00000001; # CONFIG J3
pinmux.0x02431028 = 0x00000440; # GPIO dap1_fs_pj3

another try I add four setting lines code in #### Pinmux for used pins ####, flush tx2 again, I failed again.

#### Pinmux for used pins ####
pinmux.0x02434038 = 0x00000400; # uart4_tx_pb0: uartd, tristate-disable, input-disable, lpdr-disable
pinmux.0x02434030 = 0x00000458; # uart4_rx_pb1: uartd, pull-up, tristate-enable, input-enable, lpdr-disable
pinmux.0x02434028 = 0x00000400; # uart4_rts_pb2: uartd, tristate-disable, input-disable, lpdr-disable
pinmux.0x02434020 = 0x00000458; # uart4_cts_pb3: uartd, pull-up, tristate-enable, input-enable, lpdr-disable
pinmux.0x02431040 = 0x00000440; # GPIO dap1_sclk_pj0
pinmux.0x02431038 = 0x00000400; # GPIO dap1_dout_pj1
pinmux.0x02431030 = 0x00000448; # GPIO dap1_din_pj2
pinmux.0x02431028 = 0x00000440; # GPIO dap1_fs_pj3
pinmux.0x02434018 = 0x00000400; # dap2_sclk_pc1: i2s2, tristate-disable, input-disable, lpdr-disable
pinmux.0x02434008 = 0x00000400; # dap2_dout_pc2: i2s2, tristate-disable, input-disable, lpdr-disable
pinmux.0x02434000 = 0x00000458; # dap2_din_pc3: i2s2, pull-up, tristate-enable, input-enable, lpdr-disable
pinmux.0x02434010 = 0x00000400; # dap2_fs_pc4: i2s2, tristate-disable, input-disable, lpdr-disable
pinmux.0x02434060 = 0x00000460; # gen1_i2c_scl_pc5: i2c1, tristate-disable, input-enable, io_high_voltage-enable, lpdr-disable
pinmux.0x02434068 = 0x00000460; # gen1_i2c_sda_pc6: i2c1, tristate-disable, input-enable, io_high_voltage-enable, lpdr-disable
pinmux.0x02431008 = 0x00000401; # gpio_aud2_pj7: dspk1, tristate-disable, input-disable, lpdr-disable
pinmux.0x02431000 = 0x00000401; # gpio_aud3_pk0: dspk1, tristate-disable, input-disable, lpdr-disable
pinmux.0x02432000 = 0x00004401; # dmic1_clk_pm1: i2s3, tristate-disable, input-disable
pinmux.0x02432008 = 0x00004459; # dmic1_dat_pm0: i2s3, pull-up, tristate-enable, input-enable
pinmux.0x02432018 = 0x00004401; # dmic2_clk_pm3: i2s3, tristate-disable, input-disable
pinmux.0x02432010 = 0x00004401; # dmic2_dat_pm2: i2s3, tristate-disable, input-disable
pinmux.0x02432048 = 0x00004400; # dap4_sclk_pcc0: i2s4, tristate-disable, input-disable
pinmux.0x02432040 = 0x00004400; # dap4_dout_pcc1: i2s4, tristate-disable, input-disable
pinmux.0x02432038 = 0x00004458; # dap4_din_pcc2: i2s4, pull-up, tristate-enable, input-enable
pinmux.0x02432030 = 0x00004400; # dap4_fs_pcc3: i2s4, tristate-disable, input-disable
pinmux.0x02433000 = 0x00004406; # gpio_pq0_pi0: i2s6, pull-down, tristate-disable, input-disable
pinmux.0x02433008 = 0x00004406; # gpio_pq1_pi1: i2s6, pull-down, tristate-disable, input-disable
pinmux.0x02433010 = 0x00004456; # gpio_pq2_pi2: i2s6, pull-down, tristate-enable, input-enable
pinmux.0x02433018 = 0x00004406; # gpio_pq3_pi3: i2s6, pull-down, tristate-disable, input-disable
pinmux.0x02430008 = 0x00000400; # extperiph1_clk_po0: extperiph1, tristate-disable, input-disable, lpdr-disable
pinmux.0x02430000 = 0x00000400; # extperiph2_clk_po1: extperiph2, tristate-disable, input-disable, lpdr-disable
zhangshaoyan@YNT8:~$ sudo cat /sys/kernel/debug/tegra_pinctrl_reg | grep dap1
Bank: 0 Reg: 0x02431028 Val: 0x00000400 -> dap1_fs_pj3
Bank: 0 Reg: 0x02431030 Val: 0x00000458 -> dap1_din_pj2
Bank: 0 Reg: 0x02431038 Val: 0x00000400 -> dap1_dout_pj1
Bank: 0 Reg: 0x02431040 Val: 0x00000400 -> dap1_sclk_pj0

From the dump of tegra_pinctrl_reg, I cannot set bit6 to 1 . from the datasheet, it said bit6 is input mode if it was set.but now,it still keeps 1.

Any there something special I missed ?
Please help me. Best regards.

Hello!

It is probably best to save a copy of the bootloader/t186ref/BCT/tegra186-mb1-bct-pinmux-quill-p3310-1000-c03.cfg file and then show a diff with the change you made …

cp bootloader/t186ref/BCT/tegra186-mb1-bct-pinmux-quill-p3310-1000-c03.cfg bootloader/t186ref/BCT/tegra186-mb1-bct-pinmux-quill-p3310-1000-c03.cfg.bak
diff -u bootloader/t186ref/BCT/tegra186-mb1-bct-pinmux-quill-p3310-1000-c03.cfg.bak bootloader/t186ref/BCT/tegra186-mb1-bct-pinmux-quill-p3310-1000-c03.cfg

What you should end up with a diff that looks like …

diff --git a/pinmux/tegra186-mb1-bct-pinmux-quill-p3310-1000-c03.cfg b/pinmux/tegra186-mb1-bct-pinmux-quill-p3310-1000-c03.cfg
index 25866fb9a8c0..d419920216e5 100644
--- a/pinmux/tegra186-mb1-bct-pinmux-quill-p3310-1000-c03.cfg
+++ b/pinmux/tegra186-mb1-bct-pinmux-quill-p3310-1000-c03.cfg
@@ -13,16 +13,6 @@ pinmux.0x022130a0 = 0x00000001; # CONFIG B5
 pinmux.0x02434050 = 0x00000000; # GPIO gpio_wan2_pb5
 pinmux.0x02213200 = 0x00000001; # CONFIG C0
 pinmux.0x02434040 = 0x00000000; # GPIO gpio_wan4_pc0
-pinmux.0x02215000 = 0x00000001; # CONFIG J0
-pinmux.0x02431040 = 0x00000000; # GPIO dap1_sclk_pj0
-pinmux.0x02215020 = 0x00000001; # CONFIG J1
-pinmux.0x02431038 = 0x00000000; # GPIO dap1_dout_pj1
-pinmux.0x02215040 = 0x00000001; # CONFIG J2
-pinmux.0x02431030 = 0x00000000; # GPIO dap1_din_pj2
-pinmux.0x02215060 = 0x00000001; # CONFIG J3
-pinmux.0x02431028 = 0x00000000; # GPIO dap1_fs_pj3
 pinmux.0x02215080 = 0x00000001; # CONFIG J4
 pinmux.0x02431020 = 0x00000000; # GPIO aud_mclk_pj4
 pinmux.0x022150a0 = 0x00000001; # CONFIG J5
 pinmux.0x02431018 = 0x00000000; # GPIO gpio_aud0_pj5
 pinmux.0x022150c0 = 0x00000001; # CONFIG J6
@@ -329,11 +319,11 @@ pinmux.0x02434058 = 0x00000000; # gpio_wan1_pb4: rsvd0, tristate-disable, input-
 pinmux.0x02434050 = 0x00000058; # gpio_wan2_pb5: rsvd0, pull-up, tristate-enable, input-enable, lpdr-disable
 pinmux.0x02434048 = 0x00000000; # gpio_wan3_pb6: rsvd0, tristate-disable, input-disable, lpdr-disable
 pinmux.0x02434040 = 0x00000058; # gpio_wan4_pc0: rsvd0, pull-up, tristate-enable, input-enable, lpdr-disable
-pinmux.0x02431040 = 0x00000055; # dap1_sclk_pj0: rsvd1, pull-down, tristate-enable, input-enable, lpdr-disable
-pinmux.0x02431038 = 0x00000055; # dap1_dout_pj1: rsvd1, pull-down, tristate-enable, input-enable, lpdr-disable
-pinmux.0x02431030 = 0x00000055; # dap1_din_pj2: rsvd1, pull-down, tristate-enable, input-enable, lpdr-disable
-pinmux.0x02431028 = 0x00000055; # dap1_fs_pj3: rsvd1, pull-down, tristate-enable, input-enable, lpdr-disable
+pinmux.0x02431040 = 0x00000440; # dap1_sclk_pj0: i2s1, tristate-disable, input-enable
+pinmux.0x02431038 = 0x00000400; # dap1_dout_pj1: i2s1, tristate-disable, input-disable
+pinmux.0x02431030 = 0x00000448; # dap1_din_pj2: i2s1, pull-up, tristate-disable, input-enable
+pinmux.0x02431028 = 0x00000440; # dap1_fs_pj3: i2s1, tristate-disable, input-enable
 pinmux.0x02431020 = 0x00000059; # aud_mclk_pj4: rsvd1, pull-up, tristate-enable, input-enable, lpdr-disable
 pinmux.0x02431018 = 0x00000054; # gpio_aud0_pj5: rsvd0, pull-down, tristate-enable, input-enable, lpdr-disable
 pinmux.0x02431010 = 0x00000058; # gpio_aud1_pj6: rsvd0, pull-up, tristate-enable, input-enable, lpdr-disable
 pinmux.0x02432028 = 0x0000405a; # dmic4_clk_pm5: rsvd2, pull-up, tristate-enable, input-enable

In the snippet you share, I don’t see where you change the dap1 pinmux.

Regards,
Jon