How to make edma read 16-bits MSB as pdm data width is 32-bits

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

How to make edma read 16-bits MSB as pdm data width is 32-bits

1,341 次查看
yalin
Contributor II

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.

0 项奖励
回复
3 回复数

1,323 次查看
Pavel_Hernandez
NXP TechSupport
NXP TechSupport

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

0 项奖励
回复

1,317 次查看
yalin
Contributor II

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

0 项奖励
回复

1,310 次查看
Pavel_Hernandez
NXP TechSupport
NXP TechSupport

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.

破坏者
xfer.dataSize = BUFFER_SIZE * 2U;

Best regards,
Pavel

0 项奖励
回复