AnsweredAssumed Answered

imx7 how to capture raw PCM samples from I2S

Question asked by peter zhang on Jul 3, 2019
Latest reply on Jul 4, 2019 by peter zhang

imx7 how to capture raw PCM samples from I2S.

 

I config imx7 i2s as slave mode( fs ,clock and data pin as input which are conneted to my data device that generates clock,fs and data) after changing fsl_sai.c driver following here iMX7 I2S playback in Slave mode   to clear 

bit BCD register I2Sx_TCR2,  bit FSD register I2Sx_TCR4, the code changed as posting later:

 

and the i2s do not connect to sgtl5000. it connects to my device which is i2s masrer.

 

after that,I want  read data  directly from i2s. 

how can I do? 

I tried  imx6_platform_sdk/apps/obds/src/tests (GitHub - flit/imx6_platform_sdk: Bare metal SDK for i.MX6 Q/D/DL/S/SL ). but I did  not make it work.

 

any idea?

Thanks

 

 

========================

 

diff -Naur ori/sound/soc/fsl/fsl_sai.c patches/sound/soc/fsl/fsl_sai.c
--- ori/sound/soc/fsl/fsl_sai.c 2019-07-02 15:58:04.328667455 -0400
+++ patches/sound/soc/fsl/fsl_sai.c 2019-07-03 10:24:58.693299060 -0400
@@ -374,17 +374,17 @@
/* DAI clock master masks */
switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
case SND_SOC_DAIFMT_CBS_CFS:
- val_cr2 |= FSL_SAI_CR2_BCD_MSTR;
- val_cr4 |= FSL_SAI_CR4_FSD_MSTR;
+ //val_cr2 |= FSL_SAI_CR2_BCD_MSTR;
+ //val_cr4 |= FSL_SAI_CR4_FSD_MSTR;
break;
case SND_SOC_DAIFMT_CBM_CFM:
sai->slave_mode[tx] = true;
break;
case SND_SOC_DAIFMT_CBS_CFM:
- val_cr2 |= FSL_SAI_CR2_BCD_MSTR;
+ //val_cr2 |= FSL_SAI_CR2_BCD_MSTR;
break;
case SND_SOC_DAIFMT_CBM_CFS:
- val_cr4 |= FSL_SAI_CR4_FSD_MSTR;
+ //val_cr4 |= FSL_SAI_CR4_FSD_MSTR;
sai->slave_mode[tx] = true;
break;
default:
@@ -392,10 +392,10 @@
}

regmap_update_bits(sai->regmap, FSL_SAI_xCR2(tx, offset),
- FSL_SAI_CR2_BCP | FSL_SAI_CR2_BCD_MSTR, val_cr2);
+ FSL_SAI_CR2_BCP /*| FSL_SAI_CR2_BCD_MSTR*/, val_cr2);
regmap_update_bits(sai->regmap, FSL_SAI_xCR4(tx, offset),
FSL_SAI_CR4_MF | FSL_SAI_CR4_FSE |
- FSL_SAI_CR4_FSP | FSL_SAI_CR4_FSD_MSTR, val_cr4);
+ FSL_SAI_CR4_FSP /* | FSL_SAI_CR4_FSD_MSTR*/, val_cr4);

return 0;
}

Outcomes