I'm writing an application that uses the AKU242 on-board microphone to process ambient sound. However, the input is really low. During testing, it really only records tapping directly on top of it. Is it a gain issue? I see defines for gain values - such as kDA7212_DACGain12DB - but it appears they're used only for playback, not input. Here's the relevant code, mostly taken from the SDK provided example source:
format.bitWidth = kSAI_WordWidth16bits; // kSAI_WordWidth8bits; // kSAI_WordWidth32bits; format.channel = 0U; format.sampleRate_Hz = kSAI_SampleRate32KHz; #if (defined FSL_FEATURE_SAI_HAS_MCLKDIV_REGISTER && FSL_FEATURE_SAI_HAS_MCLKDIV_REGISTER) || \ (defined FSL_FEATURE_PCC_HAS_SAI_DIVIDER && FSL_FEATURE_PCC_HAS_SAI_DIVIDER) format.masterClockHz = OVER_SAMPLE_RATE * format.sampleRate_Hz; #else format.masterClockHz = SAI_CLK_FREQ; #endif format.protocol = config.protocol; format.stereo = kSAI_Stereo; format.isFrameSyncCompact = true; #if defined(FSL_FEATURE_SAI_FIFO_COUNT) && (FSL_FEATURE_SAI_FIFO_COUNT > 1) format.watermark = FSL_FEATURE_SAI_FIFO_COUNT / 2U; #endif CODEC_Init( &codecHandle, &boardCodecConfig ); CODEC_SetFormat( &codecHandle, format.masterClockHz, format.sampleRate_Hz, format.bitWidth ); DA7212_ChangeInput( &codecHandle, kDA7212_Input_MIC1_An );
The same code works fine if I use the AUX input channel with line level values. So, by process of elimination, I lean toward some issue with the AKU242.
Follow-up: Turns out I somehow broke the on-board MEMS mic on this K66F board. The SAI demo code to which you referred *did* work, and the code I had been using also worked with a minor tweak, on the new K66F I got. I tried both programs on the old K66F and they didn't work at all, using the on-board mic, though the AUX input works. Something I did with the older board must have damaged the circuitry. So, at least I know why the MIC1_Dig input isn't working on my original K66F. Thanks for the assistance, Felipe!
Your welcome! Thanks for keeping the post updated.
Best regards,
Felipe
Hello Aaron,
I have used the MIC on my side and I did not perceive the levels low as your description I was able to hear ambient sound through the headphone jack.
For your reference, I used the frdmk66f_sai example from the SDK. I modified the example to use the digital microphone by defining DIG_MIC on the project.
I used FRDM-K66F, SDK 2.7.0 and MCUXpresso IDE 11.1.1 for my tests. Please let me know your inputs.
Best regards,
Felipe
I created a new project with the K66F 2.7 SDK and used the sample code as a base. The output of both AUX and Mic1 are almost inaudible. I even went back to my earlier project with SDK 2.5, which had sort-of worked with AUX, but not really with Mic1, and the audio, there, was also nearly inaudible. I think the board has been damaged, so I ordered a new one. For completeness, I'll follow up on this after the new one arrives.
Though, curiously, in the SDK 2.5 project, with my oscilloscope I could see data moving on I2S_RXD / PTE7, but that pin flatlines in the 2.7 SDK. They must've routed signals differently in the two projects.
Thanks for the feedback, Felipe. I actually read your earlier related question and used your code as a starting point for some adjustments to mine. However, my MCUXpresso workspace got corrupted as I was working on a new project to test - dunno what happened; it was working yesterday - so I had to toss the project. I'll give it another try and let you know. Thanks again.