Teensy 4.0 I2S slave problem

Status
Not open for further replies.

hoho

Well-known member
Hi,

I'm trying to connect two Teensys 4.0 together. One is I2S master, the second one is I2S slave, with a simple PassThroughStereo example in both (the second one uses the slave I2S classes).
The signal goes from ADC to the master Teensy, then to the slave Teensy, then do DAC.

Without the slave Teensy, everything works fine, but when I connect it (pins 20 and 21 are connected together, pins 7 and 8 are connected according to the signal chain above), I get an extremely loud consistent buzz at the DAC output.

Was Teensy 4.0 I2S slave mode tested? Is my configuration supposed to work? Am I doing something wrong?

Thanks.
 
Was Teensy 4.0 I2S slave mode tested?

Yes, I personally tested I2S slave mode on Teensy 4.0, but with WM8731 in master mode, not with another Teensy. The code I tested is File > Examples > Audio > HardwareTesting > WM8731MikroSine. The connections used are documented in that example's comments.

Before I try to look into this, can you share photos of how you've actually connected everything. I see you mention 2 connections. I2S needs at least 3 signals (data, bclk, lrclk), plus ground.
 
The basic connections are the same as on these pictures: https://forum.pjrc.com/threads/5726...nd-audio-board?p=219550&viewfull=1#post219550. The same ADC/DAC boards. Just plus one Teensy.

VIN together, ground between everything, BCK (pin 21, goes to all ADC, DAC, and both Teensys), LCK (pin 20, goes to all ADC, DAC, and both Teensys), I2S out from ADC to the master Teensy (pin 8), I2S out from the master Teensy to the slave Teensy (master pin 7 to slave pin 8), then I2S out from the slave Teensy (pin 7) to DAC.

Also pin 23 goes to SCL of the ADC and DAC boards (tried to connect it to the slave Teensy, no effect), and 3.3v goes to the ADC and DAC boards.

When I remove the slave Teensy and connect the master's I2S out to the DAC — PassThroughStereo works properly. But with two Teensys together — a huge buzz.

If the description above is not sufficient, I can take a photo of my setup, I can also try to record the buzz.
 
Just in case you will try — be carefull, it's very loud.
I was lucky to have it in the headphones which were not fully on me.
Otherwise, I wouldn't care about the sounds anymore :).
 
Your first message said this was just 2 Teensy boards. Or maybe I assumed ADC meant the analog input on one Teensy and DAC meant an analog output on the other. Now I know it's 4 devices wired together, 2 of them I have never used.

I see your photos, but I can't see where the wires actually connect.

If you believe something is wrong with Teensy's I2S slave implementation (it absolutely does work with the WM8731 in master mode), I need you to give me a test case using only 2 Teensy boards, or Teensy and the PJRC audio shield. I also need to clearly see the wiring. I am willing to wire it up here and investigate, but I'm not going to buy those 2 other boards. I will only put time into reproducing the problem knowing exactly which code to run on both boards.
 
I don't have the audio shield. It has inconvenient form factor and connectivity options (two separate smaller boards for ADC and DAC without unnecessary components are more flexible), plus it has SD card slot which I don't need.

In the initial message I thought it's only obvious that if I try to play audio through that I have ADC and DAC, and saying that a single Teensy configuration works properly to me implies that I have the basic things (such as ground) connected properly. Sorry if it was confusing. I understand that getting these boards is beyond your interest, that's understandable.

I can try to connect two Teensys using built-in ADC/DAC. Should the build-in DAC be capable of driving the headphones? I will also try to swap master and slave (not ADC-Master-Slave-DAC, but ADC-Slave-Master-DAC). Other than that, we might be in a dead end situation when you don't want to waste time trying two Teensys with the audio shield, because my setup is different. Or I will have to order an audio shield to simply try if the situation is reproducible.

Maybe someone else with the audio shield and two T4 could try it out...
 
Because Teensy's I2S slave mode does work when used with WM8731 in master mode, my gut feeling is the problem here is not Teensy. Your setup is complicated, with all sorts of opportunities for things to go wrong. I realize you've concluded Teensy must be at fault. You may indeed be right about that, but I'm skeptical because I know I2S slave mode does indeed work in another test with one of the most popular codec chips.

I personally tested WM8731. People who wanted to use it master mode (prompting those tests and earlier fixes in I2S slave) have confirmed it did work for them. That is why I have a high degree of confidence I2S slave mode does work.

This could also be a case where Teensy's slave mode requires a specific set of I2S parameters, which may not be documented well (or at all). It may be that slave mode works properly when the right BCLK / LRCLK ratio, but fails with other ratios.

I am willing to put quite a lot of work into investigating this sort of problem, but there are limits. It needs to be reproducible. The info to reproduce the problem needs to be clear and complete (wiring can be followed from photos, exact code on each Teensy given or clearly specified exactly which unmodified example, etc). When I have a stronger feeling Teensy may be at fault, I'm more willing to buy various hardware and pour more time into figuring out how to recreate the problem, working with less complete info if absolutely necessary. In this case, the threshold for "reproducibility" is higher, before I will divert engineering time away from so many other things so many other people want of Teensy.
 
I can try with two t4 + audioshield. Maybe tomorrow or early next week.
I remember that I had tested it with the early betas, too (and SPDIF-Input, too). Ok, something might have changed, so I'll do it again.
 
I pulled my WM8731 test board out, to recheck this and document the BCLK / LRCLK ratio it uses.

Looks like I may be wrong. The sine wave output sounds distorted, so there may indeed be a bug in the code. I will investigate soon...
 
To chime more in. The problem is indeed Teensy 4.0 related.
My wiring was correct. I'm just trying the same setup but with Teensy 4.0 as master and Teensy 3.6 as slave — and it works.
 
I am planning to test Teensy 4.0 as i2s slave tomorrow. To a second T4 master and also to an ADAU1701. I will post results and I welcome advice.
 
Thanks for the tip, and so far so good. I have one Teensy 4.0 running as I2S master, generating test signals. I2S pins jumpered to a 2nd T4, running as an I2S slave and routing the audio to USB. No audible distortion, listening to the USB connection on my laptop. Details to follow. On to trying the ADI codec.
 
I would be very interested in the details. How did you get usb audio on the T4? I didn't think that was implemented.
 
Final followup - I retested this today using 1.52-beta4 and the Teensy 4.0 I2S slave problem is definitely fixed.

The fix came from this post which was committed on github weeks ago.

I ran the HardwareTesting > WM8731MikroSine example. The sine wave sounds correct on Teensy 4.0 and exactly the same as with Teensy 3.6.

I also edited the connections to route the input to output, then listened to actual music played through.

Code:
//AudioConnection          patchCord1(waveform1, 0, i2sslave2, 0);
//AudioConnection          patchCord2(waveform1, 0, i2sslave2, 1);
AudioConnection          patchCord1(i2sslave1, 0, i2sslave2, 0);
AudioConnection          patchCord2(i2sslave1, 1, i2sslave2, 1);

Both Teensy 4.0 and Teensy 3.6 are passing good quality sound through. I'm taking this issue off my list, since it seems to be fully resolved.

DSC_0792_web.jpg

However, the MikroE-506 input seems to lack low frequency response. I'm pretty sure this is just the MikroE-506 hardware meant for a microphone, but it is a bit "tinty" to listen without much bass response.

Or this lack of bass response might be something about how we're configuring the M8731 chip??
 
Status
Not open for further replies.
Back
Top