Re: [alsa-devel] USB asynchronous mode feedback format
Am Donnerstag, 14. Oktober 2010, 13:15:45 schrieb Alex:
Great to hear that ASYNC OUT with rate feedback is working for u now :-)
Btw, are u using 12.13 format for Linux ? U can try with OSX snow leopard, which can understand 10.14 and 16.16. Apply Clemens' patch and linux can understand all formats - but users will have to wait for kernel 2.6.37 !
I changed my code to do 12.13 format now. Will try to connect it to my MacBook later.
I have implemented a sophisticated rate feedback with ping pong audio buffer, calculation of gap between USB data and i2s data, determining whether gap is increasing or decreasing etc.
This actually looks like a good approach. Just studying your code.
Channel inversion is a known issue and u need to sync the channel to the LRCK, and resync when the USB stream is stopped and restarted and when doing sample rate changes (48 to 96 etc).
So far I only support one fixed sample rate (48 kHz) in the device. Regarding the sync I am wondering how to determine the alignment of the data coming from USB. Is there some way to be sure that the data frames do start with the left channel when reading them from USB? The output to the I2S is done in bigger chunks through the DMA engine of the AT91SAM7 - it might be possible that I loose one packet in some case at this place... This would actually cause a inversion on the channels...
As for i2s for the DAC etc, u need to have the right timing for the various clocks. As Daniel suggested, u need to scope the signals with a dual trace scope to see whether u are giving the DAC and other chips the right timing.
See my other mail with the attached measurement.
If u are interested, u can take a look at our open source project sdr-widget. Google for it.
Yep, I just discovered it. Really nice project. Covers even more than I want to do. My goal is only to have a 192kHz/24bit USB->I2S brige which can be used for high quality audio designs. If I would have seen your project before I might not even have started working on this. Well, now it's topic of my bachelor thesis, so I really should get this done (c:
Regards, Julian
On Thu, Oct 14, 2010 at 01:44:23PM +0200, Julian Scheel wrote:
Am Donnerstag, 14. Oktober 2010, 13:15:45 schrieb Alex:
Channel inversion is a known issue and u need to sync the channel to the LRCK, and resync when the USB stream is stopped and restarted and when doing sample rate changes (48 to 96 etc).
So far I only support one fixed sample rate (48 kHz) in the device. Regarding the sync I am wondering how to determine the alignment of the data coming from USB. Is there some way to be sure that the data frames do start with the left channel when reading them from USB?
Yes, a USB packet always starts at a sample frame boundary. In other words, after the SOF, the USB stream will start with the first byte of the first channel. One USB packet must also transport multiple full audio frames (ie, samples for all channels), and not only fractions thereof.
The output to the I2S is done in bigger chunks through the DMA engine of the AT91SAM7 - it might be possible that I loose one packet in some case at this place... This would actually cause a inversion on the channels...
If you lose one entire packet and catch up with the next one, there shouldn't be any channel inversion, just a data dropout. However I would add an extra check to assure your internal counters are in sync whenever a SOF is received.
Daniel
participants (2)
-
Daniel Mack
-
Julian Scheel