Hi, HyMaim
Unfortunately, your concept about the left/right channels is incorrect. Each receiving pin of I2S for example SAI_RXDATA0 can receive both the left channel and right channel, for example the following fig demostrates the I2S protocol, each frame include two slots, when the SFRS(Serial receive frame Sync) is high, it is slot0 or left channel, you get the left channel data for example, when the SFRS is low, it is second slot or right channel, you get the right channel.
This is the procedure to get the I2S receiving data, when the I2S module recieved data, the FRF bit is set, if you enable interrupt, an interrupt is triggered, in the ISR, you can read the FIFO to a buffer, it is okay.
Regarding the left/right channel, in the receiving ISR, you can check the WSF bit in the I2Sx_RCSR to know if the received data is the first slot data or second slot data if you disable FIFO feature. But if you use FIFO mode, if the FIFO size is greater than the watermark, an interrupt can be generated, you can read multiple data from FIFO, in the case, the WSF bit is meaningless. In the FIFO mode, you can enable the Word start interrupt by setting the WSIE bit, in the ISR, you can empty the FIFO, then clear WSIE bit, so that you know that the next data in the FIFO is the first slot data. After you know the first slot data, all the following received data will be in interleaved, slot0 data/slot1 data/slot0 data/slot1 data/........., you can save the slot0 to one buffer, slot1 data to another buffer.
As you know that the received FIFO data is interleaved, it is a bit difficult to identify the left channel data or right channel data.
Hope it can help you
BR
XiangJun Rong
