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

Thread: Teensy 4.0 + Audio Adapter + WS2818Serial

  1. #1
    Junior Member
    Join Date
    Jun 2020
    Location
    Italy
    Posts
    2

    Teensy 4.0 + Audio Adapter + WS2818Serial

    Hi,

    I'm building an LED project with Teensy 4.0 and Audio Adapter Board rev. D, using Audio and WS2812Serial libraries.
    I would like to keep 4 serial ports free for using them with the WS2812Serial library (only those from header pins, so 1, 8, 14, 17 and 20).
    Given I cannot use pin 20 because Audio Adapter Board needs it, I have to solve the conflict on pin 8, which is needed for sending audio data to the Teensy, but I understand it can be remapped cutting the trace at pin 8 and re-soldering to another pin.

    I guess the natural replacement for pin 8 (audio IN1) is pin 5 (audio IN2).
    Is there a way for configuring the Audio lib to use that pin instead of the default one for receiving audio data?

    Thanks,
    Luca

  2. #2
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    3,743
    You do have 2 additional serial ports if you are able to solder wires to the pads underneath the Teensy 4.0. I have found if I just solder wires directly to the pads, over time they come off.

    if you upgrade to the Teensy 4.1, it has 3 extra serial ports on the external pins.

    I recall Paul has said the latest OctoWS2811 library for Teensy 4.0 and 4.1 now allows you to pick which pins are used. Unfortunately the documentation does not seem to have been updated.

    There are some breakout boards that bring out the bottom pins of the Teensy 4.0. I tend to prefer the Trainer4Edu/FRDM4236 board, but if you want to solder in the micro SD adapter, it can be tricky. One advantage of the Trainer4Edu board is it has the same pinout as the Teensy 4.1 for pins 24-33. Pins 34-39 in the Teensy 4.0 are for the micro-SD card, while in the Teensy 4.1, the micro SD card pins are only in the micro SD card, and pins 34-41 are new pins:


    I put a list of other Teensy 4.0 breakout boards in the unofficial wiki:


    Now in terms of audio pins. You CANNOT use pin 5 (IN2) for pin 8 (IN1). This is because the Teensy 4.x has two separate I2S ports. However, the audio adapter only uses the standard I2S1 port. If you were using a different I2S device that connected via wires, you could use the second I2S port. For reference, the pins used by I2S1 are:
    • Power/ground pins
    • Pin 23: MCLK1
    • Pin 21: BCLK1 (conflicts with RX5)
    • Pin 20: LRCLK1 (conflicts with TX5)
    • Pin 7: IN1 (conflicts with TX2)
    • Pin 8: OUT1A (conflicts with RX2)
    • Pad 32: OUT1B (underneath the Teensy 4.0, can be used for other signals, but it isn't used by the audio adapter)
    • Pin 9: OUT1C (can be used for other signals, but it isn't used by the audio adapter)
    • Pin 6: OUT1D (can be used for other signals, but it isn't used by the audio adapter).


    Note, the audio adapter also uses the main I2C bus, which is a separate bus:
    • Pin 19: SCL
    • Pin 18: SDA


    If you want to use the I2S2 bus, the pins are:
    • Power/ground pins
    • Pad 33: MCLK2 (underneath the Teensy 4.0, normal pin in 4.1)
    • Pin 4: BCLK2
    • Pin 3: LRCLK2
    • Pin 5: IN2
    • Pin 2: OUT2


    The simplest approach is probably to upgrade to the Teensy 4.1, which has 8 serial ports that can be used (though like the Teensy 4.0, Serial2 and Serial5 cannot be used if you use the audio adapter).

    If you use one of the breakout boards, many of them take a few weeks to make and ship. For example, I put my last OSH park order in on May 22nd. They shipped it via US post office from Oregon on June 1st, and I picked it up in Massachusetts on June 5th. If you are ordering from OSH park, you can add Teensy 4.0's to the order for $18.

    If you are just interested in playing sounds but not actually doing any fancy processing, there are other options on the Teensy 4.x:
    • Use an external I2S output board and use I2S2 instead of I2S1. The I2S output boards that I've used typically do not need MCLK connected, so you can use I2S2 without having to solder to pad 33.
    • Use S/PDIF output and a S/PDIF to analog converter. You can use S/PDIF with I2S2, and you could use all 5 serial ports. If you use the native S/PDIF, you would not be able to use pins 14-15 (i.e. Serial3).
    • Use MQS (pins 10, 12) to output analog sound and use an amplifier. The problem with this is you lose the main SPI bus (pins 11, 12, 13).
    • Use something like the DFPlayer to emit sound. These are fairly cheap little cards that have a micro SD card, and you control it via either a serial port or possibly separate pins.


    Some I2S outputs include:
    Last edited by MichaelMeissner; 06-15-2020 at 04:28 PM.

  3. #3
    Junior Member
    Join Date
    Jun 2020
    Location
    Italy
    Posts
    2
    Hi Michael,

    Thank you very much for your extensive answer!

    I was thinking about Teensy 4.1, but that wouldn't fit as space is limited and orientation is constrained to make room for the usb cable, which I'm exposing in the rear panel, to be able to reprogram without opening the box.
    Ditto for breakout boards.

    Actually, I would only need the ADC section of the Audio Adapter, to be able to synchronize visual effects with incoming audio, sorry for not having mentioned that.

    Native S/PDIF input (pin 15) would be fine and maybe that wouldn't conflict with TX3 (pin 14), would it?
    But... does Teensy Audio library support S/PDIF input? It doesn't look like that, reading here https://www.pjrc.com/teensy/td_libs_Audio.html.
    I will explore this possibility...

    Yes, I thought about OctoWS2811 too, but I need FastLED library too and haven't found how to configure it library with non-standard OctoWS2811 configuration (i.e. pins other than 2, 14, 7, 8, 6, 20, 21, 5, to avoid conflicts with the Audio Adapter).

    Anyway, I'll read your long post once more and try to squeeze some more information out of it.
    At the end, it might be simpler to try to re-engineer the board for fitting a Teensy 4.1 in the available space, maybe with the help of an L-shaped USB cable...

    Thanks again.
    Luca

Posting Permissions

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