This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Audio Codec I2S lsb handling



I'm trying to program a micro with 32-bit size word to connect to TLV32 Codec. I'm using the uC as the I2S master for transmit only. 

I'm using standard I2S mode with 32 bit word. 

The problem is that in I2S, the data MSB is latched 1 clock cycle after the WS assertion of left channel. To get 32 bits per channel, the lsb of left channel is going to come out on the 1st bit after WS rise to latch in the Right channel. So it follows that the lsb of the Right channel is going to come out 1 bit after the fall of WS. 

The problem is that if the uC stops the transmission, the last double word (32+32=64 bits) must be transmitted before the stop. In transmitting the last word Should the uC transmit lsb of right channel before stopping? If it does, it leaves WS as low and the codec waiting for more data. If it doesn't, it won't send the lsb of the last word on the right channle causing corruption of the word.  What is the proper way to stop this transmission?!

This problem will not exist if the right justified format is used. But that is not I2S compatible. Please help. Tx. 

  • Take a care full look at both the CPOL and CPHA  (I2S clock Polarity and Phase) code within your master and the requirement for the CODEC.  CPHA = 0 starts one bit late.

    Let us know if this helps....  I have code for the aic26...

    HS

  • Thanks for the comment. But this does not address the issue. CPOL and CPHA are related to SPI and not I2S. 

    Any ways, the codec interface works fine. The question is only regarding stop-start condition of the traffic. When the master stops the last word, there is one extra toggle of WS which causes the 1st WORD after the restart to get corrupted. How is this usually handled? 

    The extra WS toggle is due to the fact that when the WORD starts, it starts with a 1 byte offset from the WS edge. So when it stops, it needs to send the last bit after WS toggle. But this means that there needs to be an extra WS toggle. How should this be handled? Wouldn't this corrupt the 1st WORD after restart? How is start stop handled in I2S without corrupting any of the words. 

    Thanks,