Hello, I am migrating from LPCOpen DMIC examples to MCUXpresso SDK DMIC examples. I am using the LPCXpresso54114 Audio and Voice Kit with the MAO shield. Previously, I built and ran the LPCOpen 'periph_i2s_dmic' example. I take the CODEC output from the shield into an amplifier/headphones. This example worked just fine 'out-of-the-box'.
I am now trying the various SDK DMIC examples. There are two projects which are supposed to send data to the CODEC in a similar way: 1 - The 'DMIC_I2S_CODEC' project and 2 - the 'DMIC_I2S_DMA' project. So far I have been unable to get any audio output from either of these projects.
Also, in both projects there are two sections of code which are commented out; should these be uncommented ? Both sections ?
Thanks,
Jim
Hi, James,
Sorry for the delay.
From our discussion, I see that you want to read the voice data from DMIC and save the data in a File in SD card.
First of all, the LPC54114 has not the SD/MMC interface, in other words, you can connect a SD card connector on the LPC54114.
I suggest you use the other LPC family for example LPC54618, it has SD/MMC module, you can connect a SD card connector to the LPC54618 SD/MMC interface.
We have developed the fatfs middleware code, and the fatfs example, you can use mount/create to establish a file in FAT format, use open/write...function to write the data to a file.
Regarding the dmic code, because you do not use DAM, I2S, so you can truncate the dmic code, for example configure the dmic clock, dmic module, in the ISR of dmic, you can read the FIFO of DMIC and write the data to a large buffer, when the buffer is full, then stop reading data, then write the data in buffer to a File.
I post the screenshot of fatfs example.
Hope it can help you
BR
XiangJun Rong
Hello, Xiangjun,
Thank you for the quick reply and suggestions. I have a few more questions/comments.
Normally, BEFORE I contact the Community, or, Technical/Application Engineering I like to work the problem myself to see where I might actually get stuck. However, since we are in contact I have a few questions:
Again, normally, I would attack these things before contacting you, but as we are already discussing them I would appreciate your opinion. If you have any other tips to get me going they will be appreciated.
Best regards,
Jim
Hi, James,
I have checked both the 'DMIC_I2S_DMA', or, 'DMIC_I2S_CODEC' , the second example puts the DMIC sample data to I2S transmitter FIFO directly, you can not use it or you need to change it. I suggest you use the 'DMIC_I2S_DMA' example.
For the 'DMIC_I2S_DMA' example, the example uses DMA to transfer DMIC data FIFO to a large buffer, when the buffer is full, the DMIC_UserCallback() is called. In the DMIC_UserCallback() function, a flag g_Transfer_Done is set.
In the main, you need to poll the flag, when it is set, you know the buffer is full, so you can write the buffer to File.
/* DMIC user callback */
void DMIC_UserCallback(DMIC_Type *base, dmic_dma_handle_t *handle, status_t status, void *userData)
{
userData = userData;
if (status == kStatus_DMIC_Idle)
{
g_Transfer_Done = true;
}
}
uint16_t g_rxBuffer_PING[BUFFER_LENGTH] = {0};
uint16_t g_rxBuffer_PONG[BUFFER_LENGTH] = {0};
bool PING_flag;
while(1)
{
/* Wait for DMA transfer finish */
while (g_Transfer_Done == false) {} //waiting for the buffer is full
if(PING_flag)
{
receiveXfer.dataSize = 2 * BUFFER_LENGTH;
receiveXfer.data = g_rxBuffer_PONG; //use Ping-Pong buffer if you like
DMIC_TransferReceiveDMA(DMIC0, &g_dmicDmaHandle, &receiveXfer, APP_DMIC_CHANNEL);
PING_flag=false;
//write data from g_rxBuffer_Ping to File
}
else
{
receiveXfer.dataSize = 2 * BUFFER_LENGTH;
receiveXfer.data = g_rxBuffer_PING; //use Ping-Pong buffer if you like
DMIC_TransferReceiveDMA(DMIC0, &g_dmicDmaHandle, &receiveXfer, APP_DMIC_CHANNEL);
PING_flag=true;
//write data from g_rxBuffer_PONG to File
}
}
Hope it can help you
BR
Xiangjun Rong
Hello, XiangJun,
Thanks, so much.
Will give a try to all that you have suggested.
Best regards,
Jim