Dear support,
As I use RT1170, the PDM data width is 32-bits, but I just need a 16-bits audio data. And I'd like to use the pdm_sai_edma SDK for faster data transfer, how can I make edma read just 16-bits MSB of pdm data and then send it to s_buffer? (I can get 16-bits audio data by taking 16-bits MSB when 32-bits data get to s_buffer, but I perfer to do it as edma reading and then I just need to transfer half the amount of data)
Thanks.
Hello,
I review the code about the s_buffer and I suggest changing the size of the buffer in macro [BUFFER_SIZE] to 2 bytes.
if (s_bufferValidBlock > 0)
{
pdmXfer.data = (uint8_t *)((uint32_t)s_buffer + s_readIndex * BUFFER_SIZE);
pdmXfer.dataSize = BUFFER_SIZE;
pdmXfer.linkTransfer = NULL;
if (kStatus_Success == PDM_TransferReceiveEDMA(DEMO_PDM, &s_pdmRxHandle, &pdmXfer))
{
s_readIndex++;
}
if (s_readIndex == BUFFER_NUMBER)
{
s_readIndex = 0U;
}
}I hope this works for your application if you need more information please let me know.
Best regards,
Pavel
Hello Pavel_Hernandez,
Do you mean to modify code like the following in pdm_sai_edma.c?
#define BUFFER_SIZE (16)
When I do it, the demo will be blocked, and the log is like the following.
PDM SAI Edma example started!
ASSERT ERROR " fsl_edma.c:1013 : (transferBytes % bytesEachRequest) == 0U
Hello,
The number indicated in the macro BUFFER_SIZE is in bytes, 2 bytes for 16 bits, but recently the IDE [11.6] and the SDK [2.12] were updated, could you try to use the new version, I saw this change for this.
Best regards,
Pavel