Teensy 4 / Audio shield multiple sounds inputs

Status
Not open for further replies.

Caffeine

Active member
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?
 
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-ESP32-as-I2S-input-device?highlight=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.
 
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.
 
Oh, it doesn't do 16 bit? Take a look at the 32 bit audio library maybe? https://github.com/chipaudette/OpenAudio_ArduinoLibrary/blob/master/input_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.
 
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...
 
Status
Not open for further replies.
Back
Top