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

Thread: Teensy 4 / Audio shield multiple sounds inputs

  1. #1

    Teensy 4 / Audio shield multiple sounds inputs

    I have a Teensy 4 / Audio shield (Rev D) running USB audio, and it's working perfectly using line out to an amplifier.

    What I would like to do is connect a DAB+ module I have here as an alternate input, so the Teensy can do USB audio or receive I2S from the DAB module and forward that to the line out.

    As I understand it, the teensy uses the I2S port tyo send the data to the audio shield. Is it possible to have the DAB module share the same I2S port (and I use a mixer to switch between I2S and USB), or does it need to use I2S2?

  2. #2
    Damn, I meant to post this in the audio section

  3. #3
    Senior Member
    Join Date
    Jul 2020
    Posts
    1,235
    Which module? Is it I2S master or slave?

  4. #4

  5. #5
    Senior Member
    Join Date
    Jun 2018
    Location
    USA
    Posts
    197
    Connect the DAB to in2, lrck2, bckl2, and (if needed) mckl2. Then use teensy in I2S master or slave... yes, sai2 (i2s2) can run in different modes to sai1 (in1, out1, etc.)

    There is a thread discussing the connection of an ESP32 Bluetooth module in the exact same way. It works great! I have a working example on my GitHub taken from that exercise. I haven't linked it yet but it is there. Should help you to get started quickly. https://forum.pjrc.com/threads/68138...ight=ESP32+i2s

    The only issues you might run into is that 16 bit offset. The teensy accepts 16 bit data, but it has to be 32 bit slots. Does the DAB do that? Idk. Otherwise you'll have to modify the teensy to accept 16 bit straight up. (I don't know how).. In our example the ESP32 does the offset.

  6. #6
    Thank you for the info!

    The spe for the T4B module says:

    7.13. I2S interface
    It support I2S output and input for optional and two formats are supported: 32-bit I2S
    format and 32-bit Right justified format.

  7. #7
    Senior Member
    Join Date
    Jun 2018
    Location
    USA
    Posts
    197
    Oh, it doesn't do 16 bit? Take a look at the 32 bit audio library maybe? https://github.com/chipaudette/OpenA...nput_i2s_f32.h

    I think that input accepts 32 bit, if I'm not mistaken.

    Edit: There is no 32 bit input for SAI2 (I2S2) in the 32 bit audio library. You'll likely have to modify that file to get it to work on the SAI2 port. You might need to work on slave mode too.

    Does the T4B do master and slave as an option? On second thought, this won't matter. You can likely run the T4B in master mode no matter what. The esp32 is in master mode in our example too.

  8. #8
    The T4B is set to slave mode, not sure if I can change it.

    Thanks for your help

  9. #9
    Senior Member
    Join Date
    Jun 2018
    Location
    USA
    Posts
    197
    That's fine. The teensy can be master and provide the clocks.

    Only issue your going to have is that the f32 library doesn't seem to have a SAI2 driver to expose in2, lrck2, bclk2, mclk2. You can compare the files in the esp example or audio library examples. Then modify the drivers to expose sai2. It just defining different pins...

Posting Permissions

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