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

Thread: Teensy 4.0 Audio Toolkit and Shield - An Open Source Audio IO Project in Kicad

  1. #1
    Senior Member
    Join Date
    Jun 2018
    Posts
    134

    Teensy 4.0 Audio Toolkit and Shield - An Open Source Audio IO Project in Kicad

    Hello Friends,

    I hope you find this helpful. The project is incomplete - but I spent a lot of time organizing my thoughts on this. I'm excited to get feedback from the community.

    Click image for larger version. 

Name:	Teensy_4.0_Audio_Toolkit_Shield_image_1.jpg 
Views:	56 
Size:	56.4 KB 
ID:	19643
    Click image for larger version. 

Name:	Teensy_4.0_Audio_Toolkit_Shield_image_2.jpg 
Views:	64 
Size:	106.4 KB 
ID:	19644

    The Teensy 4.0 Audio Toolkit and Shield is part of an open source project for learning about, designing, and prototyping custom Audio PCBs using the Teensy Audio Library. This kit exposes key features of the Teensy commonly used for audio including USB Host Input, MIDI In, Midi Out, Midi Through, SPDIF, and Toslink. The board also includes an SD Memory Card reader, RAM/Memory, and a Power Supply. Plus, the schematic points out the key pins for connecting your own audio chips to the Teensy. This project is just exposing the hardware. Some functions may require additional work on the Teensy Audio Library or your custom code. Project files are in the repo, and completed boards will eventually come available after feedback/review. Use at your own risk.

    Teensy Audio Toolkit and Shield's Key Features
    • Open Source CC BY-NC-SA 4.0
    • Stackable Design To easily integrate with other stackable modules including DAC, ADC, Codec, Bluetooth, etc.
    • Starting Point for Custom IO Panels All inputs/outputs are only exposed as header pins. Use of a custom daughterboard, dongle, or soldering directly to the Audio Toolkit Mainboard to expose the desired jacks or ports.
    • SD Card Reader - via DM3D-SF Hirose Electric Co Ltd.
    • Memory via W25Q128JV, W25Q128FV, or 23LC1024 RAM.
    • USB Host via standard pinout USB Header and USB A connector and includes a TPS2055A current limiter chip.
    • SPDIF Input and Output via header, Coax, or Toslink.
    • MIDI In, Out, and Through via header, DIN 5, or 3.5mm 3-pin Mini MIDI and includes an optocoupler (6N137) and a logic gate (74LS00) for proper termination.
    • Power Supply 1 Amp regulator for both 5V and 3.3V rails (LM2940) with an input voltage range of 6 V to 26 V.
    • Footprints, 3d Models, and Schematics included.
    • Schematic notes and references for SAI1 and SAI2 connectivity to the Teensy.
    • More features to come?


    Schematic:

    Click image for larger version. 

Name:	Teensy_4.0_Audio_Toolkit_Shield_Schematic_1.jpg 
Views:	101 
Size:	57.4 KB 
ID:	19642

    Github Repository:

    https://github.com/JayShoe/TEENSY_4.0_AUDIO_TOOLKIT

  2. #2
    Senior Member
    Join Date
    Jun 2018
    Posts
    134
    PS - It dawned on me to expose the SAI pins on this device, so I did. This should make breadboarding audio modules much easier.

    Updated...

    Click image for larger version. 

Name:	TEENSY_4.0_AUDIO_TOOLKIT_SAI.jpg 
Views:	9 
Size:	129.7 KB 
ID:	19645

    Click image for larger version. 

Name:	TEENSY_4.0_AUDIO_TOOLKIT_SAI_UPDATE.jpg 
Views:	23 
Size:	71.1 KB 
ID:	19646

  3. #3
    Senior Member
    Join Date
    Jun 2018
    Posts
    134
    Note to self...

    - Add I2C Expansion header, add pull up resistors with pull-up enable jumper.
    - Add resistor to MCLK, as recommended.
    - Finish connecting all labels to jacks and headers.
    - Figure out a plan for removing rats nest from the jacks not on the board for easier routing. Possibly I can "disable" the connections in the schematic by disconnecting labels, maybe in a row for simplicity to reconnect.
    - Figure out Power input logic for not frying the Teensy when the on-board LDO`s are in use. Power enable/disable jumper, maybe?

  4. #4
    Senior Member
    Join Date
    Jun 2018
    Posts
    134
    Update

    - Localized Symbols, Footprints, and 3d models so it should be easier to download.
    - Fixed up MIDI schematic. There still may be errors...
    - Create a "Disable Ratsnest" which is just some global labels that get "disconnected" in the schematic to separate the headers and jacks from the Shield for easier routing.
    - Moved jacks to a new sheet, updated and fixed them up.
    - Added Master Clock header with resistors.
    - Added I2C pull ups.
    - Modified the Teensy footprint to include wide pads and removed the headers. The idea here is to solder short wires from the Audio Toolkit Shield to any DAC/ADC/ETC for easier breadboarding and prototyping of different modules but without having to route out each pin to a header.

    Images
    Click image for larger version. 

Name:	Teensy_4.0_Audio_Toolkit_Shield_image_1.jpg 
Views:	16 
Size:	88.0 KB 
ID:	19675
    Click image for larger version. 

Name:	Teensy_4.0_Audio_Toolkit_Shield_image_1_back.jpg 
Views:	9 
Size:	60.5 KB 
ID:	19676
    Click image for larger version. 

Name:	Teensy_4.0_Audio_Toolkit_Shield_image_2.jpg 
Views:	14 
Size:	55.9 KB 
ID:	19678

    Schematic
    https://github.com/JayShoe/TEENSY_4....0SCHEMATIC.pdf

    PCB
    https://github.com/JayShoe/TEENSY_4....%20-%20PCB.pdf

    Feedback

    This project is in its early stages... I got some feedback on facebook from a few users (regarding some mistakes on the schematic). Any feedback? I'm having fun nonetheless (and learning a ton) but I'm curious if there is anyone else who sees what I'm trying to do. :-)

  5. #5
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    3,873
    It would be helpful if you had pin labels on that long row of double pins for breakout on the PCB.

  6. #6
    Senior Member
    Join Date
    Jun 2018
    Posts
    134
    Hello MichaelMeissner,

    Great idea! I haven't finalized the order of those pins until I start routing the tracks. I'll organize them logically. But the idea is that the long header row can be used in sections. A "standard" USB header (including the "key"), all the midi pins, power input (6-26v), power outputs, etc. You can stack an IO board on top (which I do plan on designing), or you can lead to each individualized IO with ribbons.

    Maybe something like this?

    Click image for larger version. 

Name:	Teensy_4.0_Audio_Toolkit_Shield_image_1.jpg 
Views:	26 
Size:	90.3 KB 
ID:	19682

    Click image for larger version. 

Name:	Teensy_4.0_Audio_Toolkit_Shield_image_1_back.jpg 
Views:	18 
Size:	80.1 KB 
ID:	19683

  7. #7
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    3,873
    In general, you should have at least the pin number on the top side for both pins (unless they are the same). Having the longer name underneath is fine, but it means people will have to turn over the pcb when using jumper wires. I.e. after the board has been populated, I should not have to go to a separate document to figure out which pin is which. Nor should I need to turn the board over. I always seem to make at least one mistake when I'm counting down the pin numbers.

    For the USB stuff, you need an extra ground pin to match the USB cables (USB has 2 different grounds, but the Teensy only has one). You might want to add stuff like the Teensy 3.6 does and some of the 4.0 breakout shields, of whether to pass 5v from the Teensy or not.

    I don't know midi or S/PDIF, but I suspect in general, you would want more ground pins, and whether you want 3.3v, 5v, or 12v, I don't know. Having power rails and/or places where the power pins are makes it a lot easier to add different parts over time. If space is an issue, consider having a daughter card that takes the densely packed pins, and moves them into more friendly pin setups. For example, if there is a standard cable for S/PDIF, use that pinout, instead of creating your own.

  8. #8
    Senior Member
    Join Date
    Jun 2018
    Posts
    134
    Quote Originally Posted by MichaelMeissner View Post
    In general, you should have at least the pin number on the top side for both pins (unless they are the same).
    Noted. The Teensy pin numbers frustrate me a little. Only because matching the Pins from the pinout to my kicad footprint is a pain. I wind up confusing pin numbers from Teensy pin numbers, etc. I actually just fixed a major glitch in my Teensy Audio Footprint just before it went out to the fab house.

    Quote Originally Posted by MichaelMeissner View Post
    I should not have to go to a separate document to figure out which pin is which.
    I'm trying to condense the board down, so I don't have a ton of space. I'll make sure to include the pin numbers. Note, one entire row of that massive 02x header are all GND. I skipped adding it to the silkscreen because I couldn't fit it really.... I'll come up with a way to label the entire row as GND with a line.

    Quote Originally Posted by MichaelMeissner View Post
    For the USB stuff, you need an extra ground pin to match the USB cables (USB has 2 different grounds, but the Teensy only has one). You might want to add stuff like the Teensy 3.6 does and some of the 4.0 breakout shields, of whether to pass 5v from the Teensy or not.
    This I have to follow up on next time I get a chance. If you have any links to schematics that show what you are talking about please send them to me. I plan on reviewing the breakout boards a little more to see what mistakes I can find in my design to fix.

    Quote Originally Posted by MichaelMeissner View Post
    I don't know midi or S/PDIF, but I suspect in general, you would want more ground pins
    I included them in the main header.

    Quote Originally Posted by MichaelMeissner View Post
    if there is a standard cable for S/PDIF, use that pinout, instead of creating your own.
    Actually this was a challenge that I came to originally. What i decided to do was have a "standard header" for each connection type. For example, MIDI has one pin header. Then I have the larger pin header, and it includes the exact copy of the pins inside the larger header.

    Click image for larger version. 

Name:	midi_header.jpg 
Views:	7 
Size:	61.6 KB 
ID:	19739

    Click image for larger version. 

Name:	audio_toolkit_io_header.jpg 
Views:	9 
Size:	96.6 KB 
ID:	19740

    The only real standard I knew about was the USB. So that is why I have a pin near the USB headers that has no connection. It's a "key" pin that is often included on the standard cables... So it's in the large IO Header that way too... I'm open to figuring out any other standards. I am all about them. When in doubt though, I include a Pin, GND, Pin, GND, etc.

    By doing this, we can either connect using standard header cables (USB for example), or you can stack on top of it. Like you are saying... Once we figure out the holy grail of input/output daughter cards we can share it on oshpark and you can pretty easily populate it and stack it on top. I'll be leading my IO's with ribbon cables, however.

    Here is an image of a daughter card and box for the Analog side of things. This is a custom daughter card that will lead into my DAC/ADC boards. But the Audio Toolkit can get the same treatment. MIDI, ADAT, SD Card Slot, USB Slot, etc. For my use-case, i would prefer them on daughter cards with ribbons or custom header/cables using crimpers.

    Click image for larger version. 

Name:	IMG_20200416_0938296992.jpg 
Views:	21 
Size:	85.5 KB 
ID:	19743

  9. #9
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    3,873

    Cool

    Quote Originally Posted by JayShoe View Post
    Noted. The Teensy pin numbers frustrate me a little. Only because matching the Pins from the pinout to my kicad footprint is a pain. I wind up confusing pin numbers from Teensy pin numbers, etc. I actually just fixed a major glitch in my Teensy Audio Footprint just before it went out to the fab house.
    Yep, though by now, I have the major pins memorized. My issue tends to be counting down a row of pins, sooner or later, I will use pin 9 when I want to use pin 10.

    Note, I am by no means an expert. I did hook up a Teensy 3.6 with the cable, and hooked up a mouse, and the example program did show the mouse changes.

    Quote Originally Posted by JayShoe View Post
    I'm trying to condense the board down, so I don't have a ton of space. I'll make sure to include the pin numbers. Note, one entire row of that massive 02x header are all GND. I skipped adding it to the silkscreen because I couldn't fit it really.... I'll come up with a way to label the entire row as GND with a line.
    Sure there are always tradeoffs. Sometimes you can do it, and sometimes not.

    Quote Originally Posted by JayShoe View Post
    This I have to follow up on next time I get a chance. If you have any links to schematics that show what you are talking about please send them to me. I plan on reviewing the breakout boards a little more to see what mistakes I can find in my design to fix.
    Look at the backside of the Teensy 3.6 pinout card:


    And then look at the USB page on the non-official wiki site about USB host:


    The cable that PJRC sells is used to connect USB cables in motherboards:


    As I recall, blackketter's thread about his Teensy 4.0 breakout board had a lot of description for the USB breakout:

  10. #10
    Senior Member
    Join Date
    Jun 2018
    Posts
    134
    I feel bad, that we took over that other thread regarding pins. It was my mistake, for posting that question there. This information is helpful here...

    Quote Originally Posted by MichaelMeissner View Post
    It is helpful to look at the Audio Shield for the Teensy (https://www.pjrc.com/store/teensy3_audio.html) which covers the pinouts. Note, the Audio connections for Teensy 4 (using the revision D of the audio shield) is completely different from the Teensy 3.1, 3.2, 3.5, and 3.6 boards:

    The pins for Teensy 3.1, 3.2, 3.5, and 3.6 are:
    GND -- Ground pin used for the SPI devices
    Pin 6 -- SPI CS pin if you solder a flash memory chip on to the Audio board
    Pin 7 -- Alternate SPI MOSI pin (used for flash memory and SD card)
    Pin 9 -- I2S BCLK pin
    Pin 10 -- SPI CS pin for the SD card reader on the Audio board
    Pin 11 -- I2S MCLK pin
    Pin 12 -- Standard SPI MISO pin (used for flash memory and SD card)
    Pin 13 -- I2S DOUT pin (data from audio device to Teensy)
    Pin 14 -- Alternate SPI CLK pin (used for flash memory and SD card)
    Pin 15 -- Pin for analog pot on the audio shield (not needed on other chips)
    Pin 18 -- I2C SDA pin (used to control the SGTL5000 chip on the audio shield)
    Pin 19 -- I2C SCL pin (used to control the SGTL5000 chip on the audio shield)
    Pin 22 -- I2S DIN pin (data from the Teensy to the audio device)
    Pin 23 -- I2S LRCLK pin
    3.3v -- Power
    AGND -- Analog ground pin used for I2S


    Revision C of the audio shield added a 100 ohm resistor between MCLK and pin 11.

    Pins 18/19 have 2.2K ohm pull-up resistors between each of the pins and 3.3v to make I2C work correctly.

    Revision D of the audio shield has this pinout:
    GND (next to pin 0), connected to the audio shield SPI devices
    Pin 6 -- SPI CS pin if you solder a flash memory chip on to the Audio board
    Pin 7 -- I2S DIN (data from the Teensy to the audio device)
    Pin 8 -- I2S DOUT (data from the audio device to the Teensy)
    Pin 10 -- SPI CS pin for the SD card reader on the Audio board
    Pin 11 -- Standard SPI MOSI pin for the flash memory chip and SD reader
    Pin 12 -- Standard SPI MISO pin for the flash memory chip and SD reader
    Pin 13 -- Standard SPI CLK pin for the flash memory chip and SD reader
    Pin 15 -- Pin for analog pot on the audio shield (not needed on other chips)
    Pin 18 -- I2C SDA pin (used to control the SGTL5000 chip on the audio shield)
    Pin 19 -- I2C SCL pin (used to control the SGTL5000 chip on the audio shield)
    Pin 20 -- I2S LRCLK pin
    Pin 21 -- I2S BCLK pin
    Pin 23 -- I2S MCLK pin
    3.3v -- Power
    GND -- Ground pin between VIN and 3.3v pins is used for I2S grounding.


    Like the revision C board, there is a 100 ohm resistor between MCLK and pin 23.

    Like the revision C board, there are 2 2.2K ohm pull-up resistors for pins 18/19.


    So my question on that other thread was regarding the Audio over Ethernet protocol.



    Quote Originally Posted by palmerr View Post
    I already have Teensy Library Ethernet Audio working (without AVB).

    https://github.com/palmerr23/EtherAudio

    [...]


    https://github.com/palmerr23/audio

    I want to incorporate whatever connections I need to expose Ethernet in this audio kit and I'm trying to figure out how it can be hooked up without effecting my existing pins on my project. I can hook up my SPI lines to 13 (SCK), 22 (MOSI), 11 (MOSI), 12 (MISO) without hitting any of my already used pins. I wonder if that will work... And if so, I need to now research how to hook it up.

    Click image for larger version. 

Name:	audio_toolkit_teensy_pins.jpg 
Views:	8 
Size:	259.8 KB 
ID:	19754



    On a side note, I added a PWM fan to the audio toolkit. Some DACs and ADCs can run hot. I need to figure out what pin I should send the Signal line to as well.


    Click image for larger version. 

Name:	audio_toolkit_Spi_Fan.jpg 
Views:	8 
Size:	80.5 KB 
ID:	19755



    Quote Originally Posted by MichaelMeissner View Post
    It is helpful to look at the Audio Shield for the Teensy (https://www.pjrc.com/store/teensy3_audio.html)
    Pin 10 -- SPI CS pin for the SD card reader on the Audio board
    Pin 11 -- Standard SPI MOSI pin for the flash memory chip and SD reader
    Pin 12 -- Standard SPI MISO pin for the flash memory chip and SD reader
    Pin 13 -- Standard SPI CLK pin for the flash memory chip and SD reader
    Mine is actually connected to pins 45-52 that require the flex PCB or cable to wire up...


    Quote Originally Posted by MichaelMeissner View Post
    Like the revision C board, there is a 100 ohm resistor between MCLK and pin 23.

    Actually, I have read some places that you might need the resistor on all clock lines... So I included that option in the pads.

    Click image for larger version. 

Name:	audio_toolkit_resistor_on_clocks.jpg 
Views:	8 
Size:	42.7 KB 
ID:	19756

  11. #11
    Hi JayShoe, this looks great. do you have the spdif working on T4? I am interested in getting ADAT up and running. I am sat here with all the bits but I think its beyond my coding abilities

Posting Permissions

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