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

Thread: I2S pins - Teensy 3.6

  1. #1

    I2S pins - Teensy 3.6

    Hello,

    I try to figure

    - the i/o pins used on the Teensy 3.6 for I2S so I can plug my own chip to it

    - do I need to modify input_i2s.cpp, considering that the chips I looked at don't have the same I2S pins

    chips :

    PCM1802 pins : LRCK FSYNC DOUT BCK SCKI (this one supposed to match LRCK, but it's not really clear in the datasheet)

    CS5343 pins : LRCK MCLK SDOUT SCLK

    I am bit confused, since PCM1802 has an additional pin, and the names barely match

    any help, greatly appreciated

    thanks

  2. #2
    Senior Member
    Join Date
    Jul 2014
    Posts
    3,117
    Quote Originally Posted by phil123456 View Post
    Hello,

    I try to figure

    - the i/o pins used on the Teensy 3.6 for I2S so I can plug my own chip to it

    - do I need to modify input_i2s.cpp, considering that the chips I looked at don't have the same I2S pins

    chips :

    PCM1802 pins : LRCK FSYNC DOUT BCK SCKI (this one supposed to match LRCK, but it's not really clear in the datasheet)

    CS5343 pins : LRCK MCLK SDOUT SCLK

    I am bit confused, since PCM1802 has an additional pin, and the names barely match

    any help, greatly appreciated

    thanks
    From Reference (figure23 and 25) you can see that for PCM1802 FSYNC controls the start of data transmission (data are only send when FSYNC is high) Consider it some sort of chip-select. You can use any digital pin for that

    so my suggestion is
    Teensy.. | CS5343 |PCM1802
    MCLK... | MCLK.... | SCKI
    BCLK.... | SCKL.... | BCK
    LRCLK.. | LRCK..... | LRCK
    DIN..... | SDOUT... | DOUT
    Pinx..... | ----- .. | FSYNC

  3. #3
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    4,011
    And note, that in the Teensy 3.2, 3.5, and 3.6, the I2S pins overlap with the SPI pins. This means if you want to hook up a display using SPI, on the 3.x systems, you have to use the alternate SPI pins. Unfortunately, in the 3.x pinouts, the I2S pins were not listed in the various pinout cards.

    On the Teensy 4.0, the I2S pins are completely different and do not overlap with the SPI pins.

    If you go to the audio shield product page, it lists the I2S pins for both the 3.x Teensies and the 4.0 Teensy:


    For completeness sake, the Teensy 3.1 has the same pinout as the Teensy 3.2.

    I don't believe the Teensy LC supports I2S. Even if it did, the M0 processor inside of the Teensy LC is not compatible with a lot of the audio library, so don't even consider using the LC for I2S work.

    Similarly, I don't believe the original Teensy 3.0 supported I2S either.

  4. #4
    Ok, I found it indeed

    MCLK 11 Audio Master Clock, 11.29 MHz
    BCLK 9 Audio Bit Clock, 1.41 or 2.82 MHz
    LRCLK 23 Audio Left/Right Clock, 44.1 kHz
    DIN 22 Audio Data from Teensy to Audio Shield
    DOUT 13 Audio Data from Audio Shield to Teensy

  5. #5
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    23,956
    Followup on this old thread... today I wrote a blog article about connecting PCM1802 to Teensy.

    https://www.pjrc.com/pcm1802-breakout-board-needs-hack/



    I don't believe the Teensy LC supports I2S. Even if it did, the M0 processor inside of the Teensy LC is not compatible with a lot of the audio library, so don't even consider using the LC for I2S work.

    Similarly, I don't believe the original Teensy 3.0 supported I2S either.
    Indeed the M0+ processor is very limited. But Teensy LC does have the I2S peripheral, and the audio library does have some limited support for Teensy LC. Even fairly simple audio systems quickly use up LC's limited CPU and memory.

    Teensy 3.0 definitely had I2S and the audio library still supports it.

  6. #6
    Quote Originally Posted by PaulStoffregen View Post
    Followup on this old thread... today I wrote a blog article about connecting PCM1802 to Teensy.

    https://www.pjrc.com/pcm1802-breakout-board-needs-hack/

    Indeed the M0+ processor is very limited. But Teensy LC does have the I2S peripheral, and the audio library does have some limited support for Teensy LC. Even fairly simple audio systems quickly use up LC's limited CPU and memory.

    Teensy 3.0 definitely had I2S and the audio library still supports it.

    nice, can't wait to trye this out, great article !!!

  7. #7
    Senior Member PaulS's Avatar
    Join Date
    Apr 2015
    Location
    Netherlands
    Posts
    518
    Quote Originally Posted by PaulStoffregen View Post
    But Teensy LC does have the I2S peripheral, and the audio library does have some limited support for Teensy LC. Even fairly simple audio systems quickly use up LC's limited CPU and memory
    Would it be possible to talk to the PT8211 DAC over I2S with a Teensy LC?
    This small program compiles without error for Teensy LC but no sine output out of the PT8211 kit. This code does work on a Teensy 3.2.
    Code:
    // PT8211 bd    Teensy
    // VCC          3V3
    // GND          GND
    // WS           23
    // DIN          22
    // BCK          9
    // --           11 (MCLK)
    
    #include <Audio.h>
    
    uint32_t Freq = 440;
    
    AudioSynthWaveformSine   sine1;
    AudioOutputPT8211        pt8211_1;
    AudioConnection          patchCord1(sine1, 0, pt8211_1, 0);
    AudioConnection          patchCord2(sine1, 0, pt8211_1, 1);
    
    String incoming;
    
    void setup() {
      Serial.begin(115200);
      while (!Serial);                        // wait for serial monitor to be active
      Serial.setTimeout(50);                  // set timeout in millisecs for readString()
    
      pinMode(LED_BUILTIN, OUTPUT);
      digitalWrite(LED_BUILTIN, HIGH);
    
      AudioMemory(12);
      sine1.frequency(Freq);
      sine1.amplitude(1.0);
    }
    
    void loop() {
      while (Serial.available()) {
        incoming = Serial.readString();         // read string from serial monitor until timeout
        Serial.print(incoming);                 // return input string to serial monitor
        int32_t value = incoming.toInt();       // convert string into number
        Serial.println(value);                  // return value to serial monitor
        sine1.frequency(value);                 // update frequency
      }
    }
    Probably I'm not using the correct I2S pins. Or is this not supported at all?
    [Arduino 1.8.13, Teensyduino 1.53, Windows 10 Pro]

    Thanks,
    Paul
    Last edited by PaulS; 01-05-2021 at 02:43 PM.

  8. #8
    Senior Member PaulS's Avatar
    Join Date
    Apr 2015
    Location
    Netherlands
    Posts
    518
    Looking into the MKL26Z64 datasheet, the I2S pins are available on the 48pin package:

    Click image for larger version. 

Name:	TLC_I2Cpins.PNG 
Views:	15 
Size:	98.0 KB 
ID:	23102

    From the Teensy LC schematic:
    • pin 33 connects to Teensy pin 15/A1
    • pin 34 connects to Teensy pin 22/A8
    • pin 35 connects to Teensy pin 23/A9
    • pin 36 connects to Teensy pin 9
    • pin 39 connects to Teensy pin 11


    So electrically it seems possible to output I2S on a Teensy LC.
    In which audio library files should I now have a look?

    Regards,
    Paul

  9. #9
    Quote Originally Posted by PaulS View Post
    Would it be possible to talk to the PT8211 DAC over I2S with a Teensy LC?
    no offense, but please don't high-jack other 's people threads, this looks like a question on it's own

    I mean for the same effort load, you'd write your own post

  10. #10
    Senior Member PaulS's Avatar
    Join Date
    Apr 2015
    Location
    Netherlands
    Posts
    518
    You're right. I opened a separate thread.

    Paul

  11. #11
    Senior Member
    Join Date
    May 2019
    Posts
    114
    Thanks Paul!

Tags for this Thread

Posting Permissions

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