i.mx rt1050 wm8960 - enabling main board MIC

cancel
Showing results for 
Search instead for 
Did you mean: 

i.mx rt1050 wm8960 - enabling main board MIC

473 Views
pazdimpazdim
Contributor II

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?

Tags (2)
0 Kudos
2 Replies

256 Views
pazdimpazdim
Contributor II

Data from the SAI with both ADC enabled :

0xFF 0xFF 0xFF 0xFF
0xB6 0xFF 0xB6 0xFF
0xB6 0xFF 0xB6 0xFF
0x4E 0xFF 0x4E 0xFF
0x4E 0xFF 0x4E 0xFF
0x9A 0xFF 0x9A 0xFF
0x9A 0xFF 0x9A 0xFF
0x82 0xFF 0x82 0xFF
0x82 0xFF 0x82 0xFF
0x71 0xFF 0x71 0xFF
0x71 0xFF 0x71 0xFF
0x72 0xFF 0x72 0xFF
0x72 0xFF 0x72 0xFF
0xB5 0xFF 0xB5 0xFF
0xB5 0xFF 0xB5 0xFF
0xA5 0xFF 0xA5 0xFF
0xA5 0xFF 0xA5 0xFF
0x86 0xFF 0x86 0xFF
0x86 0xFF 0x86 0xFF
0xAE 0xFF 0xAE 0xFF
0xAE 0xFF 0xAE 0xFF
0x91 0xFF 0x91 0xFF
0x91 0xFF 0x91 0xFF
0x6F 0xFF 0x6F 0xFF

...

First and third columns is left channel, right? No data from right channel. If I turn off left ADC, all values will be zeroes. Are there examples for setting up codec registers?

0 Kudos

256 Views
pazdimpazdim
Contributor II

Ooops... Word width = 16 bit :smileyhappy:. Left channel = right channel. Maybe, I found problem - register R23.DATSEL was setted to 01.

0 Kudos