Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 12 of 12

Thread: use any I2S board in place of the Audio Adaptor Board?

  1. #1
    Junior Member
    Join Date
    Jan 2020
    Location
    Madrid
    Posts
    5

    use any I2S board in place of the Audio Adaptor Board?

    Hello,

    I'm trying to use different I2S sound cards with the examples but nothing seems to work... I also tried connecting the Audio Adaptor Board to another board (STM32) but it isnt working either.

    I'm doing this for educational purposes, I wonder if this should be at all possible (exchanging sound cards using the same protocol) and have everything work seamlessly, I have the intuition that this should be possible but maybe certain aspects (like that resistor connected to the master clock) make it complicated to do so?

    PS: I tried using a stereo Pmod I2S2 card.

    Thanks!
    Last edited by vectorsize; 01-20-2020 at 04:56 PM. Reason: its actually Pmod I2S2

  2. #2
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    6,218
    I2S is not I2s.
    There are several variants with different details when which bits (and how many) get set.
    Then, the audio-shield for exampe needs an initialization which happens through another bus, I2C.

    A good example is the PT8211 shield for Teensy, which uses the "japanese" protocol. On single Bit (if I remember correctly) has a different handling than on SGTL500. Because of this, it has its own Audio Library driver.

    You need to read the datasheets carefully and perhaps write some software for other I2S devices.

  3. #3
    Junior Member
    Join Date
    Jan 2020
    Location
    Madrid
    Posts
    5
    ok, thanks! I didnt know about the subtleties of I2S and I2s (I know I2S is not I2C).

    Probably the fact that the audio-shield is initialised via I2C explains the compatibility issues I might have.

    than you, just wanted to get an idea if this should be as simple as I thought or not.

  4. #4
    Senior Member
    Join Date
    Jul 2014
    Posts
    2,527
    The PMod I2S2 uses a Cirrus chip, which easily can be connected to Teensy I2S.
    At least if you are willing to create your own audio module.
    Chances are good that you can use Pmod I2S2 with minimal changes with existing audio objects.
    Unfortunately I have no Pmod I2S2, so I cannot test.

  5. #5
    Junior Member
    Join Date
    Jan 2020
    Location
    Madrid
    Posts
    5
    Thats great news, I wanted to attempt to understand the protocol to the point I can swap devices so it might be a good exercise to look into!

    /cheers

  6. #6
    Senior Member DD4WH's Avatar
    Join Date
    Oct 2015
    Location
    Central Europe
    Posts
    532
    you can also use separate ADC/DAC for audio. I use the ADC PCM1808 and the DAC PCM5102a (quite cheap modules of both are available on the internet), which seem to use the same I2S protocol as the Teensy audio shield and can be used as a drop-in replacement in most cases. You would have to care about correcting gain settings, however, because the Teensy audio shield has different gain.

  7. #7
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    21,332
    Quote Originally Posted by vectorsize View Post
    I wanted to attempt to understand the protocol to the point I can swap devices...
    The most important concept is I2S master vs I2S slave. It's about the direction of the clocks, not data. The I2S master creates the clock signals, BCLK & LRCLK (and maybe also MCLK). Those signals are outputs from the master. The I2S slave receives the clock signals.

    Normally Teensy is used in I2S master mode, and normal ADC, DAC, Codec chips are used in I2S slave mode.

    If you have any two I2S devices, whether you can get them to talk to each other depends on have one side be the master which creates the clocks, and the other side be the slave which listens for the clocks.

    Teensy can also run in I2S slave mode. But when in slave mode, Teensy is no longer in control of the audio sample rate. So if you try to use more than one audio interface simultaneously, usually it runs poorly because the audio library doesn't resample the data. It's designed around all inputs and outputs having the same clock. So normally Teensy I2S is used in master mode, and you can use I2S and other interfaces simultaneously.

  8. #8
    Junior Member
    Join Date
    Jan 2020
    Location
    Madrid
    Posts
    5
    Thanks everyone for your answers!

    the question's goal was rather to fact check wether it was supposed to be as simple as I imagined or if I was being naif, so I guess I was being naif.

    I will look deeper in the datasheets and use your tips as references/guidelines.

    Thanks again

  9. #9
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    3,486
    FWIW, I have used this board with the Teensy 4.0 and at least one of the Teensy 3.x's:
    • https://smile.amazon.com/gp/product/...?ie=UTF8&psc=1
    • Teensy 4.0 I2S1: Pin 7 -> DIN, Pin 20 -> LRC, pin 21 -> BCLK, Ground -> Ground, VIN -> Vin;
    • Teensy 4.0 I2S2: Pin 2 -> DIN, Pin 3 -> LRC, Pin 4 -> BCLK, Ground -> Ground, VIN -> Vin; (or)
    • Teensy 3.x: Pin 13 -> DIN, Pin 23 -> LRC, Pin 9 -> BCLK, Ground -> Ground, VIN -> Vin.


    I think I have used this as well, but I don't remember if I have actually used it:


    Note, the Makerhawk board is mono, and it includes an amplifier to attach a small speaker. By default, it uses 1/2 of the left channel and 1/2 of the right channel. The HiLetGo board is stereo, and like the Teensy Sound adapter, it does not provide amplification.

  10. #10
    Junior Member
    Join Date
    Jan 2020
    Location
    Madrid
    Posts
    5
    Quote Originally Posted by MichaelMeissner View Post
    FWIW, I have used this board with the Teensy 4.0 and at least one of the Teensy 3.x's
    cool! thanks, I'll check those too!

  11. #11
    Junior Member
    Join Date
    Jul 2019
    Posts
    18
    very interesting, i was assuming someone must have tried these "high quality" raspberry DAC modules?
    https://www.audiophonics.fr/en/dac-a...&orderway=desc
    i don't care about 384khz sampling rates or 32bit (lol) but maybe these converters have nicer S/N and THD?

  12. #12
    Senior Member
    Join Date
    Feb 2017
    Posts
    348
    I'd be careful of the products explicitly targeted to Raspberry. This one looked really good for my application: https://www.hifiberry.com/shop/boards/hifiberry-amp2/
    But it requires their Linux drivers to configure the board. While, in theory, it could be done by a bare-metal processors, the company provides no support for doing so.

    On the other hand, this one works quite nicely with Teensy: https://www.infineon.com/cms/en/prod...io_d_ma12070p/. You only need to set a few registers over I2C to get the proper I2S mode and set desired volume level.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •