[LPC4337] Synchronising SGPIO slices with LRCLK (I2S)

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by eva_lpc on Tue Aug 26 10:06:15 MST 2014
I'm trying to read in multiple I2S stereo-channels using SGPIO. The SCLK and LRCLK/WS are generated by the external AD-Converter. Every I2S stero-channel sends first 32 bits of one channel, when LRCLK is low, then 32 bits of the other channel when LRCLK is high. The data slices are shifted at the SCLK, which seems to go fine. After 32 bits, the slice buffers are swapped. So the data of the first channel should be in one buffer, and data of the second channel in the other buffer.  However I need to align the data with the LRCLK/WS, so that the 32 bits in one buffer are the actual 32 bits of the corresponding channel. Now there are offsets resulting in mixed up data in the buffers.

How can I synchronise the slices with this LRCLK? I cannot use LRCLK as qualifier as I also need the data the is sent when LRCLK is low.