Forum Rule: Always post complete source code & details to reproduce any issue!
Page 1 of 5 1 2 3 ... LastLast
Results 1 to 25 of 111

Thread: Quad channel output on Teensy 3.6

  1. #1
    Junior Member
    Join Date
    Oct 2016
    Posts
    11

    Quad channel output on Teensy 3.6

    Hey everyone,

    Hopefully this is a quick question (sorry if it's also a stupid question).

    I got my first 3.2 working with quad-channel output last week, and I'm looking to wire up my 3.6 to do the same. I saw a number of threads confirming that the 3.6 / 3.2 were fully compatible, and judging by the pinouts found here: https://www.pjrc.com/teensy/pinout.html , it seems like the only change to this guide that has been referenced: https://www.sparkfun.com/news/2055 would be to connect the inner pad near pin 15 on the channel 3 & 4 board to pin 18 (SDA1) on the teensy 3.6.

    Just wanted to check my understanding before I go ahead and modify another two audio adapters. I'd appreciate any insight.

    Thanks a ton.

  2. #2
    Senior Member
    Join Date
    Jul 2014
    Posts
    1,759
    Quote Originally Posted by CanopyR&D View Post
    Hey everyone,

    Hopefully this is a quick question (sorry if it's also a stupid question).

    I got my first 3.2 working with quad-channel output last week, and I'm looking to wire up my 3.6 to do the same. I saw a number of threads confirming that the 3.6 / 3.2 were fully compatible, and judging by the pinouts found here: https://www.pjrc.com/teensy/pinout.html , it seems like the only change to this guide that has been referenced: https://www.sparkfun.com/news/2055 would be to connect the inner pad near pin 15 on the channel 3 & 4 board to pin 18 (SDA1) on the teensy 3.6.

    Just wanted to check my understanding before I go ahead and modify another two audio adapters. I'd appreciate any insight.

    Thanks a ton.
    txd0 is on digital pin3 (physical pin 5) and digPin 22 (phyPin44)
    txd1 is on digital pin26 (physical pin 18) and on digPin 15 (phyPin37)

    digpin 3 and 15 are on same location for teensy 3.2 and 3.6
    but have more easy choices on T3.6

    not so for rxd1 which was on t3.2 on backside pad and is now on outside pin so for quad input T3.6 is easier to implement

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    17,876
    So far nobody (as far as I know) has tested quad channel input on Teensy 3.6.

    I'm sure it can work with minor tweaking in the code, since RXD1 may be on a different pin than Teensy 3.2.

  4. #4
    Senior Member
    Join Date
    Jul 2014
    Posts
    1,759
    Quote Originally Posted by PaulStoffregen View Post
    So far nobody (as far as I know) has tested quad channel input on Teensy 3.6.

    I'm sure it can work with minor tweaking in the code, since RXD1 may be on a different pin than Teensy 3.2.
    I only can confirm that the 4-chan I2S input works on T3.6 with the same I2S code I used on T3.2 (except for RXD1 pin change)
    I have not tried with AudioCard but with custom Audioboard and I don't use I2S output

  5. #5
    Junior Member
    Join Date
    Oct 2016
    Posts
    11
    Paul, I went ahead with WMXZ's advice and tested it out last night. Working like a charm so far! Not sure when or if additional issues may arise due to the difference you mentioned, but playback seems perfect on 3.6.

    WMXZ, thanks for your help regarding this.

    Edit - just noticed you were mentioning input, not output. I'll try this tonight and post back with an update.

  6. #6
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    17,876
    For quad channel input, connect the 2 incoming data signals to pin 13 (same as with Teensy 3.2) and pin 38 (rather than pin 30 as with Teensy 3.2).

    Then edit input_i2s_quad.cpp. Find this line:

    Code:
            CORE_PIN30_CONFIG = PORT_PCR_MUX(4); // pin 30, PTC11, I2S0_RXD1
    Change it to this:

    Code:
            CORE_PIN38_CONFIG = PORT_PCR_MUX(4); // pin 38, PTC11, I2S0_RXD1
    I'm pretty sure this will make it work. Please let me know? If so, I'll put this change into the library for the 1.35 release.

  7. #7
    Senior Member
    Join Date
    Jul 2014
    Posts
    1,759
    Quote Originally Posted by PaulStoffregen View Post
    For quad channel input, connect the 2 incoming data signals to pin 13 (same as with Teensy 3.2) and pin 38 (rather than pin 30 as with Teensy 3.2).

    Then edit input_i2s_quad.cpp. Find this line:

    Code:
            CORE_PIN30_CONFIG = PORT_PCR_MUX(4); // pin 30, PTC11, I2S0_RXD1
    Change it to this:

    Code:
            CORE_PIN38_CONFIG = PORT_PCR_MUX(4); // pin 38, PTC11, I2S0_RXD1
    I'm pretty sure this will make it work. Please let me know? If so, I'll put this change into the library for the 1.35 release.
    Yes, this is what I did with my code (for T3.2 and T3.6)
    Code:
    #ifdef __MK20DX256__
    		CORE_PIN30_CONFIG = PORT_PCR_MUX(4); // pin 30, PTC11,I2S0_RXD1
    #endif
    #ifdef __MK66FX1M0__
    		CORE_PIN38_CONFIG = PORT_PCR_MUX(4); // pin 38, PTC11,I2S0_RXD1
    #endif
    Obviously one should add T3.5

  8. #8
    Junior Member
    Join Date
    Oct 2016
    Posts
    11
    Paul, no such luck as of last night using Arduino 1.8 & Teensy 1.35 beta. Playback from the SD card on both boards simultaneously works, but the input (running the quadPassThrough example) doesn't produce any sound. I've verified that the signal is reaching the boards just fine, just no output. The basic StereoPassThrough example also produced no sound. I know during my first experience with the 3.6 and the passThroughStereo example, the CPU speed turned out to be the issue. Not sure if that had been fixed, but I didn't try at any speeds other than 180 on either example. If I get another moment today, I'll mess with the speeds, otherwise it'll be an exciting project for the weekend!

  9. #9
    Junior Member
    Join Date
    Oct 2016
    Posts
    11
    Update! All is working when running at 72Mhz with the recommended changes. In fact, it worked up until 120Mhz, breaking at 144Mhz. I remember this was a known issue, but I can't seem to find the thread mentioning it, or any fix for it. For now, I'm extremely happy just to have it working as it is. Paul and WMXZ, thank you both a ton for your help in the matter.

  10. #10
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    17,876
    Quote Originally Posted by CanopyR&D View Post
    Update! All is working when running at 72Mhz with the recommended changes. In fact, it worked up until 120Mhz, breaking at 144Mhz. I remember this was a known issue, but I can't seem to find the thread mentioning it, or any fix for it.
    Please give these a try. Does this make it work up to 180 MHz?
    Attached Files Attached Files

  11. #11
    Junior Member
    Join Date
    Oct 2016
    Posts
    11
    Paul; Yes, with those the audio passthrough example works perfect at 180Mhz (and all the way up to 240Mhz!). Thanks a ton for all your help in this matter!

  12. #12
    Junior Member
    Join Date
    May 2016
    Posts
    8
    What hurdles might there be to processing 6 channels of audio instead of 4?

  13. #13
    Senior Member
    Join Date
    Jul 2014
    Posts
    1,759
    Quote Originally Posted by semegraph View Post
    What hurdles might there be to processing 6 channels of audio instead of 4?
    Different protocol.
    on Teensy there are 2 data ports.

    I2S SAI supports 2 channel/data port.
    I2S TDM supports more channel/data port.

    Actual audio SW is for I2S SAI, therefore limited to 4 channels

  14. #14
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    17,876
    Without tough driver-level programming, you could get 6 channels if you use the quad I2S and the two DAC pins. Those DAC pins are only 12 bits, so this may or may not be an option depending on your needs for sound quality.

    In theory, TDM can give more channels, but so far nobody has done this. It's very difficult. I'd be really surprised if anyone other than Frank gets it working. TDM is on a long list of stuff I'd love to do it I had a *lot* more time... but I just don't. Odds are slim I'll work on TDM anytime soon.

  15. #15
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,438
    TDM: If there are inexpensive boards I buy one. Any hints ? (available in Germany please, or cheap from China. )
    At the moment, my teensy-c64-emu-project has priority for me, but after that, maybe, i take a look.
    I did not had much time the last two weeks, unfortunately, and the progress is not like i'd want..
    Last edited by Frank B; 04-01-2017 at 07:18 PM.

  16. #16
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    17,876
    Quote Originally Posted by Frank B View Post
    TDM: If there are inexpensive boards I buy one. Any hints ?
    I created one just now and sent it in to OSH Park. It uses the CS42448 chip. Will send you one when they're made.

    Click image for larger version. 

Name:	cs.jpg 
Views:	203 
Size:	127.9 KB 
ID:	10184

  17. #17
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,438
    Wow great. Can you please send me a schematic, I think I must then know which pin is connected where.

  18. #18
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    17,876
    There is no schematic. I just put all the parts into the layout and quickly connected them.

    The schematic is basically the same filtering caps as shown in figure 1 on page 9 of the datasheet (including FILT+_ADC, FILT+_DAC, and VQ). The 2 analog power pins are connected to VIN (+5V) through a ferrite bead, and then it's the identical circuit from the datasheet. The 2 digital power pins connect to 3.3V, with the same caps as shown in the datasheet, and VLS & VLC connect to 3.3V.

    All input pins have the circuit shown in figure 28 on page 55, and all output pins have the circuit shown in figure 31 on page 57. AIN1-, AIN2-, AIN3-, AIN4- have 4.7uF capacitors to ground. All other analog signal negative pins are left floating.

    The only custom thing I did was a CAT811T reset chip which drives pin 3, and a pair of resistors (both pullup & pulldown) connect to pin 1 so the I2C address can be configured between 2 values, and that ferrite between Teensy's +5V and the filter caps for the analog power. Everything else is directly from the CS42448 datasheet.

    The data connections are:

    MCLK (Teensy pin 11) to MCLK (CS42448 pin 10)
    BCLK (Teensy pin 9) to ADC_SCLK & DAC_SCLK (CS42448 pins 9 and 18)
    LRCLK (Teensy pin 23) to ADC_LRCLK & DAC_LRCLK (CS42448 pins 5 and 19)
    TX (Teensy pin 22) to DAC_SDIN1 (CS42448 pin 17)
    RX (Teensy pin 13) to ADC_SDOUT1 (CS42448 pin 13)
    SDA (Teensy pin 18) to SDA (CS42448 pin 64)
    SCL (Teensy pin 19) to SDA (CS42448 pin 63)

    These pins on the CS42448 are connected to ground: AD1/CDIN, DAC_SDIN4, DAC_SDIN3, DAC_SDIN2, AUX_SCLK, AUX_SDIN. Other unused pins are left floating.

    I didn't do anything special with the ground. I tried to route the digital ground directly down the center of the PCB and the rest of the ground wires that fan out to the left and right are analog ground. They meet at a couple points near the top side of the chip. This wasn't meant to be a super high signal quality design... just something ok with the simplest single-ended passive filters for testing. Maybe someone else will make a better PCB with active filters using the full differential signals, but this quick & simple board should at least let us experiment with the software side and still get reasonably decent signals.

  19. #19
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,438
    Paul, are any additional parts needed ? I'd like to order them now, so that they are here when i need them..

  20. #20
    @paul can't wait till there will be support for the CS42448 chips, they look promosing (audio channels, bit rate and sample rate wise) for a surround sound decoder or multi output effect pedal.

    maybe i will change the FX shield i want from 2 sgtl5000 to the CS42448 and add some extra ins and outs.

  21. #21
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    17,876
    Quote Originally Posted by Frank B View Post
    Paul, are any additional parts needed ? I'd like to order them now, so that they are here when i need them..
    Here's the only other documentation I have so far...

    Click image for larger version. 

Name:	cs42448_test_placement.png 
Views:	228 
Size:	81.5 KB 
ID:	10255

  22. #22
    Junior Member
    Join Date
    Feb 2017
    Posts
    11
    Sorry - trying to interpret the conversation you all had in January in this thread regarding how to connect two audio boards to the Teensy 3.6.

    Were those updated library files you were discussing included in the later releases of teensyduino?

    If so, is the only update to the quad channel output setup guide shown here https://www.sparkfun.com/news/2055 to connect the pad near pin 13 on the audio board to pin 38 on the teensy 3.6 for i2s output?

    I.E. Click image for larger version. 

Name:	4_Channel_Audio_Teensy-03.jpg 
Views:	260 
Size:	146.1 KB 
ID:	10283
    Last edited by apt2b; 04-13-2017 at 06:16 AM.

  23. #23
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    17,876
    Quote Originally Posted by apt2b View Post
    Were those updated library files you were discussing included in the later releases of teensyduino?
    Yes, Teensyduino 1.36 has the audio lib with Teensy 3.6 quad channel support.

    If so, is the only update to the quad channel output setup guide shown here https://www.sparkfun.com/news/2055 to connect the pad near pin 13 on the audio board to pin 38 on the teensy 3.6 for i2s output?
    Yes, that's right.

    Don't forget to remove the capacitors normally connected to pin 15 from both boards.

  24. #24
    Junior Member
    Join Date
    Feb 2017
    Posts
    11
    Understood, thanks.

  25. #25
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    17,876
    I'm working with the CS42448 chip today. Committed first init code to github.

    Click image for larger version. 

Name:	DSC_0347_web.jpg 
Views:	193 
Size:	163.2 KB 
ID:	10308

    One thing I've learned so far... the CS42448 runs *hot*!!

Posting Permissions

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