Content originally posted in LPCWare by DF9DQ on Fri Dec 21 03:59:51 MST 2012
Hi Chris,
Asynchronous mode is the correct mode for the LPC1768, since you have no way of synchronizing the I2S clock to the USB (SOF) clock. Only the host can prevent a buffer overflow or underflow by adjusting the rate at which it sends samples. It does this by sending one sample less or more in certain frames.
For the host to know whether your sample buffer is going to over/underflow, you must provide feedback to the host. There are basically two options: explicit feedback and implicit feedback.
Explicit feedback must go through an extra isochronous endpoint. You monitor the speed of incoming (USB) and outgoing data (I2S). If you see that I2S drains your buffer faster than it gets refilled by USB, you report, for instance, "48.05" to the feedback pipe. The host will then increase its average sample rate by a factor of (48.05/48).
Implicit feedback can be used if your device also implements an isochronous data source (device->host). If both are derived from the same clock (the source marked as asynchronous as well), the host uses the amount of samples coming through the source pipe as a measure to adjust the rate at which it sends to the sink pipe.
You can find a description of the procedure and feedback channel data format in the USB spec (USB Data Flow Model, Synchronization Types), chapter 5.12.4 in my very old 2.0 copy.
I'm not an expert in this field though, but I hope this gives you a good start.
Regards,
Rolf