USB audio generator

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

USB audio generator

1,377 Views
MarkoPanger
Contributor III

Hi,

 

I have an application when we stream sampled audio through the USB port on our K66 board. We sample audio at 16Khz, 16bit, 2 channels.

 

The USB0 port of the K66 MCU has a limited USB buffer size of 64 bytes which just fits our needs. In fact each 1ms 64 bytes can be transferred, which in turns equals to 2 channels * 2 bytes * 16 samples.

 

The problem is that from time to time we lose some samples as the sampling frequency is not 100% the same as the USB polling interval frequency and thus some samples are accumulating.

 

How to solve this ? In other words I need to send more than 64bytes per 1ms ISO frame. Any ideas ?

 

Marko

Labels (1)
Tags (3)
0 Kudos
Reply
2 Replies

917 Views
isaacavila
NXP Employee
NXP Employee

Hello Marko

What you are facing is a synchronization problem when sampling on USB. There are different ways to solve this problem, that basically is, to use a synchronization method.

There are 3 different methods:

  • Synchronous: Audio is sampled based on USB's SOF. In this method, USB Device needs to measure SOF (every 1 ms), compare with its clock and adjust it. This adjust might be modifying the samples (Using interpolation or sample converter) or modify master clock frequency.

  • Adaptive: Recover clock based on data rate and adjust the clock just as synchronous method.

  • Asynchronous: Clocks are fixed. You measure difference on clock from stream and then send a feedback to host. In this feedback you request for more or less samples according to your samples buffer.

You can learn more about these synchronization methods on this post: USB audio sync.

So basically, you need to pay attention on implement a synchronization method.

I hope this can help you,

Best Regards,

Isaac

----------------------------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. Thank you!

----------------------------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply

917 Views
mjbcswitzerland
Specialist V

Hi

I have seen the recommendations for synchronisation in the linked thread: USB audio sync

but it doesn't look like any KSDK audio class references support synchronisation, in particular they look to be based on async mode but without any feedback endpoint, meaning that the drift is unacceptably high.

I was hoping tht IRC48M based clocking would adequately synchronise the USB host to the audio clock domain, thus removing the need for this, but measurements haven't proven it to be suitable: IRC48M Clock Synchronisation with USB

Are there KSDK references that achieve asyn feedback operation?

Regards

Mark

0 Kudos
Reply