Dear NXP support,
We are trying to evaluate the "fitfullness" of the MIMXRT685-AUD-EVK, for ANC purposes. For that, I am testing on how to mimimize the audio delay from input to output.
To this end, I tested with the `mimxrt685audevk_i2s_dma_ping_pong_buffer` project. I think I managed to increase the samplerate to the full 192kHz by setting it to 192k and setting the clock divider from 16 to 4.
However, now I need to have the CS42448 CODEC to run in quad speed mode (QSM), and the audio input/output buffers to as small as possible. Changing kCS42448_ModeSlave to kCS42448_ModeMasterQSM does not appear to reduce the latency.
As a second thing, when I decrease the DEMO_BUFFER_SIZE to below 48, the output is "garbage". Can you please help me forward with reducing latency further?
Thank you in advance for your answer.
Best regards,
Anne de Jong
Dear Pablo Avalos,
Thank you for your response. I am tweaking the project `mimxrt685audevk_i2s_dma_ping_pong_buffer` to give me the lowest digital loopback latency. For that, I managed to get the CODEC running in quad speed mode and at 192 kHz. Therefore, I made the following changes to the source file i2s_dma_ping_pong_buffer.c:
```
#define DEMO_I2S_CLOCK_DIVIDER 4
#define DEMO_BUFFER_SIZE 48
//#define DEMO_I2S_TX_MODE kI2S_MasterSlaveNormalMaster
//#define DEMO_I2S_RX_MODE kI2S_MasterSlaveNormalMaster
#define DEMO_I2S_TX_MODE kI2S_MasterSlaveNormalSlave
#define DEMO_I2S_RX_MODE kI2S_MasterSlaveNormalSlave
cs42448_config_t cs42448Config = {
// .DACMode = kCS42448_ModeSlave,
// .ADCMode = kCS42448_ModeSlave,
.DACMode = kCS42448_ModeMasterQSM,
.ADCMode = kCS42448_ModeMasterQSM,
// .master = false,
.master = true,
```
I found however, that the size of the buffer does not work out properly. Decreasing it below 48 bytes I get bad out put. My current measure of latency used is by sending in white noise and measure the 360 deg point of phase. Then the delay in samples is is 192 kHz / (f_360). What I expect to have at minimum is the CS42448 codec input group delay + codec output group delay, which are in quad speed mode 5 + 2.5 samples = 7.5 samples, then adding the minimal digital buffer, which would be 2 samples, which makes in total ~ 9.5 samples of latency, which is 49 microseconds at 192 kHz.
When the DEMO_BUFFER_SIZE is currently at my minimum value of 48 bytes, for which I expect with stereo at 16 bit a buffer of 12 samples per channel. I do expect a latency of at least 31 samples of latency. I strangely get a value of only 19 samples. I do not understand how the buffer size influences the callback rate.
It would be really helpful / appreciated if you could send me an example, where the callback is runned every 1/192e3 seconds, and for example, scale the input by, say 0.5 and return the output back. That would give us a headstart with some DSP'ing.
With kind regards,
Anne de Jong
Dear @anne
Thanks for sharing the detailed info!
Your questions and concerns are already asked internally for applications engineers. As soon as I get an answer from them, hopefully soon, I will make sure to reach you back here.
I really appreciate your patience and thank you so much for using our products.
Have a Happy New Year.
Best Regards.
Pablo Avalos.
Dear Pablo,
Thank you for your reaction. As an amendment I would like to mention that I am not restricted to doing this with the CM33 core. Actually, the preferred option would be by using the Hifi4 core.
Best regards, and have a nice end of the year,
Anne de Jong
Dear @anne
Thanks a lot for your fast response and for letting me know! Also, I appreciate your nice wishes for the end of the year.
I will make sure to let them know too that additional information you shared with me.
Thanks a lot and I will get back to you when I get an answer from them.
Sincerely,
Pablo Avalos.
Dear @anne
Please accept my apologies for the delay on my response. Our backlog on RT requests these days was too high, I really appreciate your patience.
Regarding your issue, I would like to know if I can have the code snippet you are configuring just to have an idea of what you are trying to do there. Also, I will make sure as a task, to ask my teammates for some alternatives for reducing latency further as you are asking.
I will stay tuned to your case and I will be back with you as soon as I can, to bring you some news.
Thanks a lot!
Best Regards.
Pablo Avalos.