Page 1 of 1

I2S: what's the rationale behind changing WS on LSB?

Posted: Thu Jun 27, 2019 6:42 pm
by blippy
I'm looking at the timing diagram for I2S: https://en.wikipedia.org/wiki/I%C2%B2S

If, for example, you are transmitting the left channel, WS (word select) changes from 0 to 1 when you transmit the LSB (least significant bit). What's the rationale behind this? I would have thought it would be more logical to change the WS only when you are about to transmit the MSB (most significant bit).

Re: I2S: what's the rationale behind changing WS on LSB?

Posted: Thu Jun 27, 2019 8:00 pm
by blippy
One thing that springs to mind is that when the WS changes, receiver knows that the bytes for the channel have been completed, so it can do whatever it needs to. That way, if transmitter stops transmitting, receiver does not have to guess if the bitstreams for that channel has been completed.

Seem reasonable, or am I wide of the mark?

Re: I2S: what's the rationale behind changing WS on LSB?

Posted: Sun Jul 07, 2019 12:25 am
by icb
Yes, that's pretty much it. I2S explicitly allows any length words, without negotiation, so the WS doubles as "size of word" and "end of word" markers. See §3.1 and §3.2 of the I2S specification.
3.1 Serial Data

Serial data is transmitted in two’s complement with the MSB first.
The MSB is transmitted first because the transmitter and receiver
may have different word lengths. It isn’t necessary for the transmitter
to know how many bits the receiver can handle, nor does the
receiver need to know how many bits are being transmitted

[...]

3.2 Word Select

[...] The WS line
changes one clock period before the MSB is transmitted. This allows
the slave transmitter to derive synchronous timing of the serial data
that will be set up for transmission. Furthermore, it enables the
receiver to store the previous word and clear the input for the next
word.