Forum Rule: Always post complete source code & details to reproduce any issue!
Page 2 of 2 FirstFirst 1 2
Results 26 to 37 of 37

Thread: Teensy 4 PCM5242 Audio Shield - Stereo Balanced/Single Ended DAC Module

  1. #26
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    3,745
    I did have a thought experiment, wondering besides USB/ethernet what would be the most sound outputs/inputs you could put on a Teensy 4.1, while still using the SPI ports, etc. My thought is:

    • I2S1 with 5 data pins (6-9, and 32) along with the control pins (23, 21, 20);
    • I2S2 with 2 data pins (2, 5) along with the control pins (3, 4, 33);
    • S/PDIF (pins 14, 15);
    • Midi on hardware serial1 (pins 0, 1);
    • Midi on hardware serial3 (pins 14, 15) if you aren't using S/PDIF;
    • Midi on hardware serial6 (pins 24, 25);
    • Midi on hardware serial7 (pins 28, 29);
    • Midi on hardware serial8 (pins 34, 35);
    • Flash chip to hold sounds (underneath pads 49-54); (and)
    • Micro-SD card to hold sounds (built-in).


    Obviously whether the Teensy could control all of those pins, both in terms of enough CPU cycles and power levels, I don't know.

  2. #27
    Senior Member
    Join Date
    Dec 2014
    Posts
    304
    Just play chip tunes using PWM.
    Turn off interrupts and control the PWM directly for each pin, manually.
    MUSIC ON ALL THE PINS!

    Also, I thought S/PDIF used the same hardware as IIS, so you couldn't actually use both at the same time?

  3. #28
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    3,745
    Quote Originally Posted by jwatte View Post
    Just play chip tunes using PWM.
    Turn off interrupts and control the PWM directly for each pin, manually.
    MUSIC ON ALL THE PINS!

    Also, I thought S/PDIF used the same hardware as IIS, so you couldn't actually use both at the same time?
    Most pins, not all pins. It looks like on the Teensy 4.1, there are 15 pins that are not PWM capable (16, 17, 20, 21, 26, 27, 30, 31, 32, 34, 35, 38, 39, 40, and 41 in the outer row pins). In addition, there are only so many timers, so you likely couldn't use all of them for independent melodies. Obviously, they might not produce great sound compared to the other methods (I2S, S/PDIF, etc.).

    There is TDM, but it looks like TDM uses the I2S hardware.

    According to the latest design tool beta (https://www.pjrc.com/teensy/gui2) there are 3 S/PDIF library outputs created by FrankB:
    • SPDIF: Uses I2S1 pin 7 for output on Teensy 4.x and 22 on Teensy 3.x (i.e. you cannot use I2S1);
    • SPDIF2: Uses I2S2 pin 2 on Teensy 4.x (i.e. you cannot use I2S2); (and)
    • SPDIF3: Uses Teensy 4.x hardware for S/PDIF (pin 14) and uses neither I2S1 nor I2S2.


    For S/PDIF inputs the choices are:
    • SPDIF3: Uses Teensy 4.x hardware for S/PDIF input (pin 15); (and)
    • SPDIF_async: Uses Teensy 4.x hardware for S/PDIF input (pin 15) as well.


    I am only quoting the gui that Paul is working on. Obviously FrankB can weigh in on the pluses and minuses. If you go to the 1062 datasheet, it looks like the hardware stuff for S/PDIF starts on page 2021.

    It looks like there is a third SAI-3 section in the hardware (SAI-1 is I2S1, SAI-2 is I2S2). I imagine there was not enough room to bring out the pins for SAI-3.

    If you are just playing pre-recorded songs, another possibility is to use something like the DFPlayer that either has flash memory or a micro-SD card to play from:


    A few years ago, I played around with the Adafruit Audio FX boards. They are kind of bulky, but if you wanted something that you could add buttons to play pre-defined sounds, they worked. But I likely would just go with the DFPlayer these days if I didn't want to program a Teensy.
    Last edited by MichaelMeissner; 05-25-2020 at 10:21 PM.

  4. #29
    Senior Member
    Join Date
    Dec 2014
    Posts
    304
    Oh, that's sweet! I was going by the old documentation that says SPDIF shares hardware with I2S.

  5. #30
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    3,745
    Quote Originally Posted by jwatte View Post
    Oh, that's sweet! I was going by the old documentation that says SPDIF shares hardware with I2S.
    It looks like it went into Teensydunio 1.52 that was just released. Fortunately, Paul is now working on improving the documentation, so hopefully things will be better soon.

  6. #31
    Maybe a MCP100-315 or -475 could handle the reset independently from the teensy...

  7. #32
    Quote Originally Posted by JayShoe View Post
    mhelin,

    Still not convinced that it will be helpful. But it's interesting nonetheless and was easy to add. I added 4 pins, corresponding to the 4 data lines required for clocks and data.
    Is a 1 x .05 mm solder pad big enough?

    Jay
    Those GPIO pins can be used for other purposes as well, it depends on the software (configration). The TI solution is like the AD's miniDSP. Problem is getting the (right) PurePath software:
    http://www.ti.com/tool/PUREPATHCONSOLE

    You can also use the older PurePath Studio workflow if the PPC3 doesn't work for you.
    See https://e2e.ti.com/support/audio/f/6...%20user:151472
    You can download the 5242 framework for PurePath Studio from there, there's the link to zip file.

    Then you have to figure out how get the generated source and binary files into Teensy and use it to program the DSP(s). Some implementation examples for MSP430 can be found here:

    https://e2e.ti.com/cfs-file/__key/co...66/slac640.zip
    Documentation (pdf) here: http://www.ti.com/lit/an/slaa605a/sl...arch=Search-EN
    Last edited by mhelin; 05-26-2020 at 10:47 AM.

  8. #33
    Quote Originally Posted by MichaelMeissner View Post
    Obviously for Teensy 4.0, you don't have access to OUT1B (for 1st I2S bus) and MCLK2 (for 2nd I2S bus) or to the USB host support unless you either solder wires to the pads or use one of the breakout boards.
    Correct. I've left a 2.54 stack-able header compatible through-hole in my custom "Audio Footprint" that would allow the MC2 and O1B to be passed along to any sub-board. But to get it to that pin there is extra work... Soldered jumper cables, or otherwise.

    Quote Originally Posted by MichaelMeissner View Post
    Note, since you mentioned USB Host and Ethernet, you probably want to include those pins on your board, so if you stack your devices, the user can bring these pins out to the top of the stack.
    I would only use a T4.1 if I wanted Ethernet.

    Quote Originally Posted by MichaelMeissner View Post
    It would be nice to your users if you also brought out the Program pin, On/Off pin, and Vbat pins, so that they can be accessed without de-stacking your boards.
    I would probably just use the T4.1 and stack the audio modules underneath. Or if someone wanted to stack on top, then can also stack in a breakout board to expose that stuff in another way. I'm kinda hoping to keep my modules audio focused only.


    Quote Originally Posted by MichaelMeissner View Post
    For S/PDIF inputs the choices are:
    SPDIF3: Uses Teensy 4.x hardware for S/PDIF input (pin 15); (and)
    SPDIF_async: Uses Teensy 4.x hardware for S/PDIF input (pin 15) as well.
    Oh yeah, I need to add that to my list. I definitely need to keep pin 15 open. I know FrankB committed SPDIF input, but if/when SPDIF Out is available it will be on Pin 14. So those two pins are also out - I would include them as a "digital audio" pin.

    Quote Originally Posted by jpk View Post
    Maybe a MCP100-315 or -475 could handle the reset independently from the teensy...
    That's a neat part. I was wondering if anything like that existed, or if the reset pin was more easily handled other than running a wire to the MCU. I guess it's not that bad to run to the MCU, easier than a circuit right? :-) It's already done on my design.

    I'm going to go review the datasheet now, make a quick determination if I can fit it on my board, and see if it's worth it. The board is pretty much ready to go, and I'm itching to get it working, but this is a nice idea. If I use it I'll have a jumper for it to connect to pin 22 - in case this circuit doesn't work at first go - or if it's left in the traces but and not populated in the final design.

    Pin 22 is now officially the "RESET" pin for this project. Lol. Thanks for all the help!

  9. #34
    Quote Originally Posted by jpk View Post
    Maybe a MCP100-315 or -475 could handle the reset independently from the teensy...

    These parts monitor the level of the VDD (voltage source). The TLV320ADC6140 has IOVDD and AVDD power supply options. My design has options for single supply, or a separate AVDD power supply, which in some cases may increase the quality of the sound. I need to wait for both AVDD and IOVDD supplies to reach 3.3v, so there is a need for 2 supply monitors (MCP100T-315I_TT). It fit appropriately on the board, and looks neat - clean traces and shouldn't negatively impact sound. I've also installed a jumper to optionally control the SHDNZ (RESET) pin with pin 22 of the Teensy - but these reset monitors might be easier and actually better since when we add modules we will also add to potential startup times, creating timing issues (maybe).


    jpk, Have you used these before? My question is this. If I connect the two RST pins to the ADC "SHDNZ" (aka RESET) pin, will it work? The ADC will be enabled only when both monitors pull high ("active low"). Do I need a pull-up resistor anywhere?

    Click image for larger version. 

Name:	MCP100T-315I-TT_SCHEAMTIC2.png 
Views:	8 
Size:	9.6 KB 
ID:	20332

  10. #35
    Quote Originally Posted by JayShoe View Post
    My question is this. If I connect the two RST pins to the ADC "SHDNZ" (aka RESET) pin, will it work? The ADC will be enabled only when both monitors pull high ("active low"). Do I need a pull-up resistor anywhere?
    I found my answer in TI's documentation called Voltage Supervisor and Reset ICs: Tips, Tricks and Basics. In order to have an "AND" operation with two supervisors I needed to have an "open drain" style device. I found the cheapest one I could find, that should do the trick just fine.

    I chose a TLV803SDBZR . It looks like this.

    Click image for larger version. 

Name:	TLV803SDBZR_Scheamtic.png 
Views:	3 
Size:	21.8 KB 
ID:	20341

    It monitors for 2.93V with a Fixed Delay Time of 200 ms. The TLV320ADC6140 datasheet shows the minimum operating voltage when running on a 3.3v rail to be 3.0v. Since my Reset Power Supervisor circuit runs on 2.93v, I think I need to install a resistor between VDD and the input of the Supervisor chip. I have to calculate what value the resistor should be to make the input pin < 2.93 when VDD > 3.0v. Or I just rely on the fact that 200 ms is plenty of time to get from 2.93 to 3.0 v.

    While this reset circuitry does make a much more robust circuit, MCU control over pin 22 definitely would have been easier. It's more robust because if there were many of these on a project (8 boards for 32 inputs) i can see it taking different times to power all 8 boards up. At the same time, I suppose just putting a long delay on the reset pin at startup (600ms?) would also solve the issue. After working through all of this, wondering if it's worth it. :-) Wondering if it stays in, or comes out. :-)

  11. #36
    R2 and R3 need to bring 3.0v down to ~< 2.9.

    Click image for larger version. 

Name:	TLV803SDBZR_Scheamtic_2.png 
Views:	4 
Size:	12.2 KB 
ID:	20343

  12. #37
    Quote Originally Posted by JayShoe View Post
    )jpk, Have you used these before?
    Yes, it helps me saving pins and code. I reset a DOGM204 display with it (through a voltage divider) and also Teensies 3.5/3.6 powered from DC-DC supplies. Without the MCP100s I couldn't get them boot up from those supplies...

Posting Permissions

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