Specification issues (I²S)

Status
Not open for further replies.

Felipe Lacerda

New member
Hi there,

I have not found on the site clearly the specifications the boards on I²S with USB.
I want to be sure of the limits before choosing the teensy board version to buy.

With a quick search in the forum, it appeared to be a limit of 4 I²S connections.

  • Are 2 channels of audio per I²S connection? (Total 8 channels of audio) ?? :confused:
  • Can I use 4 stereo DAC chips? Or 4 stereo ADC? :confused:
  • Or even 2 stereo DAC chips + 2 stereo ADC chips? :confused:


  • Is it possible to work at 24bit? (Even if it has less channels)

I realized that the implementation of SPDIF output is already functional, this is awesome! :D

But the SPDIF input will not :(

  • Will it be possible in the future to use SPDIF input?

A USB interface only for SPDIF I/O would be very interesting! :rolleyes:


Best Regards.

Felipe Lacerda.
 
Last edited:
There is one I2S interface on T3.x

from Kinetis I2S description the I2S interface
• Transmitter with independent bit clock and frame sync supporting 2 data channels
• Receiver with independent bit clock and frame sync supporting 2 data channels
• Maximum Frame Size of 32 words
• Word size of between 8-bits and 32-bits
• Word size configured separately for first word and remaining words in frame
 
There are 2 ways to think about I2S (or any other hardware) capability.

1: Hardware specs - what is possible if you write your own drivers and all the code
2: Well supported software - what you can do easily, with little or no modification to existing libraries (device driver level code)

For example "Is it possible to work at 24bit?". Yes, 24 bits is certainly possible. But the Teensy Audio Library only supports 16 bit sample size, so to work with more bits you'd have a write quite a lot of code!

I2S is fundamentally a stereo digital audio communication protocol. One I2S data stream always carries exactly 2 channels.

The Teensy 3.2, 3.5 & 3.6 hardware has dual I2S input and output. So using I2S, you can have at most 4 channel input and 4 channels output.

The SAI hardware can support other non-I2S protocols. TDM is supported by the audio library. Currently the only well tested TDM chip is CS42448, which provides 6 inputs and 8 outputs.

Something to keep in mind is the SAI (Synchronous Audio Interface) hardware generally only supports 1 protocol at a time. So if you use it for TDM, you can't also use it for I2S. So you can't do something like connect a CS42448 chip and then also connect the SGTL5000 chip, as on the audio shield.

Likewise, the SPDIF output and PT8211 use the SAI hardware in other modes, so you can't use I2S or TDM while using either of those.

But you can use the on-chip DACs and ADC (singular) for 2 more outputs and 1 more input, at only 12 bit resolution. This is well supported by the audio library, so using those while also using I2S or TDM or SPDIF or PT8211 (mutually exclusive "or") is as easy as just dragging their symbols onto the design tool canvas and connecting them into the system you intend to implement.

If you're not familiar with the design tool and audio library, I highly recommend starting with the tutorial.

https://www.pjrc.com/store/audio_tutorial_kit.html

There's a 31 page PDF manual with step-by-step instructions and a full 45 minute walkthrough video which comes in handy if you get stuck & need to see how a step is done.

Of course, this already-written library and the tutorial material is the answer to question #2 - what you can do quickly & easily by leveraging existing libraries.

If you instead intend to write all your own code, then the answers you seek can be found in the reference manual for the chip.

https://www.pjrc.com/teensy/datasheets.html

For example, if you read the MK20DX256 manual, the SAI chapter begins on page 1297. If you believe you'll take path #1, I would highly recommend trying to read that chapter, and also the chapters about DMA. Maybe also look through the audio library code on github. This library is the result of about 4 years of work. Earlier efforts in 2012 & 2013 are still around in very old threads on this forum, if you want an idea of what starting from scratch looks like! I can't emphasize enough how many hours of pretty advanced level coding are required to develop high quality & easily usable audio processing code. If you really do intend to go that route, of course I don't want to discourage you. But do so with a fully informed idea of the work required.

But for 16 bits and a pretty large feature set, as you can see in the tutorial, the existing library and design tool makes it very easy. :)
 
There are 2 ways to think about I2S (or any other hardware) capability.

...

Thank you Paul, for your detailed explanation.
First of all, congratulations on the development, I imagine how difficult it was.

I forgot to mention that my question is exclusively about their libraries, because I'm already suffering a lot with XMOS and C-MEDIA, :(
so something "ready" could avoid some white hairs.

Anyway ... For 16bit we have some Texas integrated PCM27xx series, PCM29xx that are already ready for 16bit with I²S I/O and SPDIF I/O (some C-MEDIA as well).

The difficulty is in executing 24bit.
An SPDIF I/O would only be great for me as long as I could support 24 bit. :p

I know there is firmware for XMOS, but this prototyping firmware costs the price of a retail product.
This does not make any sense to me.

Best Regards
 
The Teensy 4.0 will have SPDIF in and out.

What discouraged me is the 16bit issue only. I thought about the possibility of Teensy working at 24 bit because for 16 bit it is already known that some Texas / C-MEDIA usb controllers work very well.
It could only be spdif i/o or i²s i/o. Any option would be great if it worked at 24bit.
Is it really something extremely complex to implement?
 
What discouraged me is the 16bit issue only. I thought about the possibility of Teensy working at 24 bit because for 16 bit it is already known that some Texas / C-MEDIA usb controllers work very well.
It could only be spdif i/o or i²s i/o. Any option would be great if it worked at 24bit.
Is it really something extremely complex to implement?

No, not difficult. Just rewrite the audio library. The hardware can do it.
 
The audio library's I2S interfaces supports the full 64-bit (32-bits per Left / Right channel) specification. However, only the upper 16 bits are significant. Your 24-bit devices will be perfectly happy receiving I2S with the 16 upper bits active and the lower 8 bits always zero. On input, the lower 8 bits from the 24-bit device will simply be truncated. The library will work just fine on on the upper 16.
 
Last edited:
Status
Not open for further replies.
Back
Top