AnsweredAssumed Answered

i.mx rt1050 wm8960 - enabling main board MIC

Question asked by PazDim PazDim on Jun 7, 2018
Latest reply on Jun 8, 2018 by PazDim PazDim

Hello. I am trying to enable main board Mic. For this i changed the example "sai_edma_transfer". MIC is the right channel (RINPUT1, RINPUT2), right? Here is my additional code:

static void callbackRx(I2S_Type *base, sai_edma_handle_t *handle, status_t status, void *userData)
{
    isFinished = true;
     int i = 0;
     for (i = 0; i < 100; i += 4)
     {
          PRINTF("0x%02X 0x%02X 0x%02X 0x%02X\n\r", audioBuf[i], audioBuf[i + 1], audioBuf[i + 2], audioBuf[i + 3]);
     }
}

...

EDMA_CreateHandle(&dmaHandleRx, EXAMPLE_DMA, 1);
...
DMAMUX_SetSource(DMAMUX0, 1, kDmaRequestMuxSai1Rx);
DMAMUX_EnableChannel(DMAMUX0, 1);
...
SAI_RxGetDefaultConfig(&config);
SAI_RxInit(DEMO_SAI, &config);
...
/* Setup MIC */
/* Loopback */
//WM8960_WriteReg(&codecHandle, 0x9, 0x1);
/* RINMUTE, RIZC, RINVOL */
WM8960_WriteReg(&codecHandle, 0x1, 0x63);
WM8960_WriteReg(&codecHandle, 0x1, 0x100);
/* RADCVOL */
WM8960_WriteReg(&codecHandle, 0x16, 0xff);
WM8960_WriteReg(&codecHandle, 0x16, 0x100);
/* VMIDSEL, AINR, ADCR, MICB */     
WM8960_WriteReg(&codecHandle, 0x19, 0xd6);
/* RMN1, RMP2, RMICBOOST, RMIC2B */
WM8960_WriteReg(&codecHandle, 0x21, 0x178);
/* RIN2BOOST */
WM8960_WriteReg(&codecHandle, 0x2c, 0xe);
/* RMIC, LOMIX, ROMIX */
WM8960_WriteReg(&codecHandle, 0x2f, 0x1c);
...
SAI_TransferRxCreateHandleEDMA(DEMO_SAI, &rxHandle, callbackRx, NULL, &dmaHandleRx);
SAI_TransferRxSetFormatEDMA(DEMO_SAI, &rxHandle, &format, mclkSourceClockHz, format.masterClockHz);

Loopback not working - I can't hear the microphone signal, but test signal is working. After I turn off AINL and ADCL (*0x19 = 0xd6, enabling right channel only) callbackRx prints zero values. If I turn both channels on (or left channel only), callbackRx prints non-zero repetitive values (noise?). How i can enable right ADC?

Outcomes