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

Thread: Teensy 4.0 I2S slave problem

  1. #1

    Teensy 4.0 I2S slave problem


    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?


  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Quote Originally Posted by hoho View Post
    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.

  3. #3
    The basic connections are the same as on these pictures: 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.

  4. #4
    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 .

  5. #5
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    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.

  6. #6
    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...

  7. #7
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    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.

  8. #8
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Germany NRW
    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.

  9. #9
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    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...

  10. #10
    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.

Posting Permissions

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