Integrate lib_i2s in app_usb_aud_xk_216_mc Topic is solved

Technical questions regarding the XTC tools and programming with XMOS.
nick
Active Member
Posts: 42
Joined: Tue Jan 07, 2020 10:35 am

Integrate lib_i2s in app_usb_aud_xk_216_mc

Post by nick »

Hi,
I'm developing a firmware based on the app_usb_aud_xk_216_mc. I need 32 input and 32 output channels, but on TDM16 lines.
I've already modified the code to do TDM16, but after some tests I noticed a sample loss when using both lines: I tried to send a tone (on 2 channels) to a device (working in TDM slave mode) which it sends it back to the XMOS.
- if I send the tone on channels 1-2 the recorded signal is perfect: no loss.
- if I send the tone on channels 17-18 the recorded signal is perfect: no loss.
- if I send the tone on channels 16-17 the recorded signal on channel 16 is perfect but the one on channel 17 has sample losses (zero samples).
This made me think that when streaming audio to both the TDM lines, the second line has problems due to TDM performances.

Then I tried the same setup, but using the AVB firmware (based on AN00203), which I modified to use TDM16. With this setup I didn't noticed sample losses and everything worked perfectly.
So it seems an optimization problem with TDM code in the USB application. Is this the real cause of the problem I'm facing?

So I thought to integrate the library lib_i2s in the USB application. Has anyone tried to do this? Any suggestions on the part of the code to modify?
I'm pretty sure the file involved is the audio.xc (in module_usb_audio), but it's not so clear to me how to integrate the tdm client task of the lib_i2s.


View Solution
nick
Active Member
Posts: 42
Joined: Tue Jan 07, 2020 10:35 am

Post by nick »

Hi,
I solved the problem by using a MCLK at 49.152 MHz instead of 24.576 MHz.
On the multichannel EVM this can be done by using the PLL CS2100 and changing its multiplier to obtain that frequency.

Using the MCLK at this frequency seems to improve performance with TDM16.