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

Thread: PT8211 and Teensy 4

  1. #1
    Member
    Join Date
    Mar 2019
    Location
    Sweden
    Posts
    27

    PT8211 and Teensy 4

    Hi
    Thanks for an amazing product.
    I have made a small midi bass synth using T4 and 25L12835F flash and PT8211 as audio output.

    My problems two:
    1. Using PT8211 create a lot of computer noise on the output.
    when I instead use TDA1311A (compatible) the noise is gone.
    I have followed all the rules of design for my PC board.
    Has anybody had the same experience with PT8211.

    2. My synth is mono so I only need one channel of the DAC so I use L, but I'm forced to connect the same source for both channels as input.
    If I don't my code hangs. This was not the case when I used T3.2 instead.

    include <Audio.h>
    #include <Wire.h>
    #include <SerialFlash.h>
    #include <SPI.h>
    #include <Bounce2.h>
    #include <MIDI.h>

    MIDI_CREATE_INSTANCE(HardwareSerial, Serial1, MIDI);


    // Create the Audio components. These should be created in the
    // order data flows, inputs/sources -> processing -> outputs
    //
    // basstämma
    AudioPlaySerialflashRaw bas[2];
    AudioEffectEnvelope env[2];

    // ackordskomp 3-4 stämmor samtidigt
    AudioPlaySerialflashRaw acc[4];
    AudioMixer4 mix0;

    AudioMixer4 mix1;
    AudioMixer4 mix2;
    AudioOutputPT8211 ptout;

    // basen
    AudioConnection c0(bas[0], 0, env[0], 0);
    AudioConnection c1(bas[1], 0, env[1], 0);

    // kompet in i mixer 0
    AudioConnection c2(acc[0], 0, mix0, 0);
    AudioConnection c3(acc[1], 0, mix0, 1);
    AudioConnection c4(acc[2], 0, mix0, 2);
    AudioConnection c5(acc[3], 0, mix0, 3);

    // mixa ihop bas och komp
    AudioConnection c10(env[0], 0, mix1, 0);
    AudioConnection c11(env[1], 0, mix1, 1);
    AudioConnection c12(mix0, 0, mix1, 2);

    // output to PT8211 dac (both L och R)
    AudioConnection c20(mix1, 0, ptout, 0);
    AudioConnection c21(mix1, 0, ptout, 1);


    I'm using Arduino 1.8.12 and Teensy Loader 1.53 on Ubuntu

    /Tomas

  2. #2
    Senior Member
    Join Date
    Jul 2020
    Posts
    1,039
    I have followed all the rules of design for my PC board.
    Such as a separate Vdd from the Teensy?

  3. #3
    Senior Member manicksan's Avatar
    Join Date
    Jun 2020
    Location
    Sweden
    Posts
    281
    I had similar problem
    if you connect the PT8211 VCC to the teensy 3v3 instead of the direct 5VUSB the noise is alot better
    but not completely gone if you turn the volume up.

  4. #4
    Senior Member manicksan's Avatar
    Join Date
    Jun 2020
    Location
    Sweden
    Posts
    281
    Do you know that you can connect the PT8211 to the second I2S port
    (using AudioOutputPT8211_2 this is available in the design tool as pt8211_2)

    which is PIN-PIN compatible without any overlapping routing
    also this makes the lines very short except the VDD but there should be a
    decoupling capacitor between VDD and GND so that should not be any problem

    Click image for larger version. 

Name:	teensy4andPT8211.jpg 
Views:	40 
Size:	73.2 KB 
ID:	22372

  5. #5
    Member
    Join Date
    Mar 2019
    Location
    Sweden
    Posts
    27
    I have used the recomended layout:

    BCK: 21
    WS: 20
    DIN: 9

    Click image for larger version. 

Name:	20201110_111643.jpg 
Views:	52 
Size:	122.3 KB 
ID:	22377
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	TDA1311.jpg 
Views:	52 
Size:	24.0 KB 
ID:	22376  

  6. #6
    Senior Member
    Join Date
    Jul 2020
    Posts
    1,039
    I'd treat the Vdd on the PT8211 as an analog supply, use a separate supply for it from the digital ones (perhaps a 3.3V LDO regulator
    from the 5V?). At the very least it needs the filtering circuit from the datasheet, 10 ohms / 47µF+100nF, and an inductor wouldn't be
    a bad idea in both the supply and ground to separate out analog from digital at RF.

    USB 5V from a computer or laptop is usually pretty noisy from DC to daylight - a separate USB hub supply might be cleaner, especially
    in the audio band. Ground noise may be an issue too, which is one reason most high performance ADC/DACs have separate analog
    supply and ground.

  7. #7
    Member
    Join Date
    Mar 2019
    Location
    Sweden
    Posts
    27
    I have already tested using a Powerbank for 5V but no difference.
    The noise is more like a distortion of the sound.
    I suspect that it comes from the software lib. As I said the TDA1311 chip works perfectly with no distortion.
    Also my problem with connection to the pt8211 output indicates software problems.

  8. #8
    Senior Member PaulS's Avatar
    Join Date
    Apr 2015
    Location
    Netherlands
    Posts
    550
    You noticed that the TDA1311A part requires a power supply of 4-5.5V? See the datasheet:TDA1311A.pdf.
    It may not properly handle 3V3 input signals.

    Paul

  9. #9
    Senior Member
    Join Date
    Jul 2020
    Posts
    1,039
    Quote Originally Posted by kets View Post
    I have already tested using a Powerbank for 5V but no difference.
    The noise is more like a distortion of the sound.
    I suspect that it comes from the software lib. As I said the TDA1311 chip works perfectly with no distortion.
    Also my problem with connection to the pt8211 output indicates software problems.
    If its distortion rather than noise, its not noise and we've been chasing our tails a bit!

    Have you seen this thread? https://forum.pjrc.com/threads/29284...c-PT8211/page3

  10. #10
    Member
    Join Date
    Mar 2019
    Location
    Sweden
    Posts
    27
    TDA1311A:
    I missed that when I used them. Strangely enough they works perfectly at 3.3V.
    I don't know if it just the ones I have.
    Last edited by kets; 11-11-2020 at 08:46 AM.

  11. #11
    Member
    Join Date
    Mar 2019
    Location
    Sweden
    Posts
    27

    Sound input and output from my midi bass box

    I have recorded output from the box to compare with input file.

    2_36 is the input
    2_36_D is the distorted output

    /Tomas
    Attached Files Attached Files

  12. #12
    Senior Member PaulS's Avatar
    Join Date
    Apr 2015
    Location
    Netherlands
    Posts
    550
    Hi Tomas,
    I listened to your sound samples and there is indeed some distortion added to the original sample. Perhaps caused by the envelope function? Or a clipping mixer?
    You may want to post your complete code because importing the code from message #1 into the Audio Design Tool did not show all connections and we need to know how the parameters are set for the different audio blocks.

    Paul

  13. #13
    Member
    Join Date
    Mar 2019
    Location
    Sweden
    Posts
    27
    It's not the Envelope function. I suspected that and removed it but no difference.
    here is a testcode that gives the same result. (It loops my bass notes)

    #include <Audio.h>
    #include <SPI.h>

    // Create the Audio components. These should be created in the
    // order data flows, inputs/sources -> processing -> outputs
    //
    AudioPlaySerialflashRaw bas0;
    AudioEffectEnvelope env0;

    AudioMixer4 mix1;
    AudioOutputPT8211 ptout;

    // Create Audio connections between the components
    //
    //AudioConnection c1(bas0, 0, env0, 0);
    AudioConnection c2(bas0, 0, mix1, 0);
    AudioConnection c5(mix1, 0, ptout, 0);
    AudioConnection c6(mix1, 0, ptout, 1);

    // SPI flash
    #define MOSI 11 // kets
    #define MISO 12
    #define SCK 13
    #define CSPIN 10 // kets


    #define LED 6

    void setup() {

    Serial.begin(9600);

    // Audio connections require memory to work. For more
    // detailed information, see the MemoryAndCpuUsage example
    AudioMemory(30);

    //Set up SPI flashminne
    SPI.setMOSI(MOSI);
    SPI.setMISO(MISO);
    SPI.setSCK(SCK);
    if (!SerialFlash.begin(CSPIN)) {
    while (1) {
    Serial.println("Unable to access SPI Flash chip");
    delay(1000);
    }
    }

    //mixer
    mix1.gain(0, 0.5); //bas0


    }

    void loop() {

    char abas[20];
    for(int i = 28; i <= 47; i++) {
    String txtljud = "2_" + String(i) + ".RAW";
    txtljud.toCharArray(abas,20);

    bas0.play(abas);
    env0.noteOn();
    while(bas0.isPlaying()) {
    digitalWrite(LED, HIGH);
    delay(100);
    }
    env0.noteOff();
    digitalWrite(LED, LOW);
    delay(1000);
    }
    }

  14. #14
    Senior Member PaulS's Avatar
    Join Date
    Apr 2015
    Location
    Netherlands
    Posts
    550
    The input and output sound files you sent are in MP3 format.
    Since the AudioPlaySerialflashRaw block requires the data to be RAW 16 bit signed integers in LSB-first format, could there be a problem with converting the MP3 input file to RAW 16 bit format?
    [on the other hand, you said the TDA1311A played well...]
    What happens if you remove the mixer as well?

    Paul

  15. #15
    Member
    Join Date
    Mar 2019
    Location
    Sweden
    Posts
    27
    No I convert from wav-format using sox. Here is the file.
    Attached Files Attached Files

  16. #16
    Member
    Join Date
    Mar 2019
    Location
    Sweden
    Posts
    27
    I have tested to remove mixer also. The same result.
    However if I use the mixer and reduce volume to say 0.05 and play the noise/distortion is almost as loud as my sample.
    This indicates that the pt8211 output is the problem.
    I also need to have bas0 routed to both channels of ptout. If not I get no sound at all.

    /Tomas

  17. #17
    Member
    Join Date
    Mar 2019
    Location
    Sweden
    Posts
    27
    Here is the soundsample when volume is set to 0.05
    Attached Files Attached Files

  18. #18
    Senior Member PaulS's Avatar
    Join Date
    Apr 2015
    Location
    Netherlands
    Posts
    550
    Strange... Perhaps your PT8211 part is just broken?
    I used the PT8211 board from PJRC several times and never had an issue with it. Did you buy the board or just the chip?

    Paul

  19. #19
    Member
    Join Date
    Mar 2019
    Location
    Sweden
    Posts
    27
    They are chips I did buy from Ebay. I have mounted 2 of them on different boards with the same result.
    In that case all of my chips are broken. Or are they very sensitive to solder?

    Tomas

  20. #20
    Member
    Join Date
    Mar 2019
    Location
    Sweden
    Posts
    27
    There are different versions of PT8211.
    Mine is called PT8211-H. It's not branded Ptc (original)

    There is also PT8211-S and plain PT8211 around.

    Question is if that matters?
    Which is on your card from PJRC?

    /Tomas
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	20201111_185728.jpg 
Views:	28 
Size:	115.3 KB 
ID:	22395  

  21. #21
    Senior Member PaulS's Avatar
    Join Date
    Apr 2015
    Location
    Netherlands
    Posts
    550
    This is a close-up of the chip that is on my PJRC PT8211 board:

    Click image for larger version. 

Name:	S20201111_0002.jpg 
Views:	37 
Size:	169.6 KB 
ID:	22397

    Paul

  22. #22
    Senior Member PaulS's Avatar
    Join Date
    Apr 2015
    Location
    Netherlands
    Posts
    550
    After searching the internet, I'm pretty sure the PT8211-H are not genuine Princeton parts.
    The datasheet Princeton PT8211.pdf only mentions the PT8211-S & PT8211 packages.

    Paul

  23. #23
    Senior Member manicksan's Avatar
    Join Date
    Jun 2020
    Location
    Sweden
    Posts
    281
    You can use the AudioSynthWaveformSineHires to make sure that everything is ok with the source sound.

    I also have PT8211-H from ebay with older datecode so yours is maybe a bad batch.

    There is PT8211 in DIP-8 package from Futurlec.com at only $0.45 + $4 shipping https://www.futurlec.com/Delivery.shtml https://www.futurlec.com/Others/PT8211.shtml


    /Jannik

  24. #24
    Senior Member
    Join Date
    Jul 2020
    Posts
    1,039
    I certainly would never trust any chip bought from eBay these days in the slightest unless I knew
    the reputation of the seller.

    I looked at the spectrum of the signals and the "distorted" one had a higher level of harmonics, extending beyond the clean
    signal well above 1.4kHz, suggesting fairly heavy harmonic and intermodulation distortion (basically like a fuzz-box does).

    If you want a better test signal try something like a 800Hz / 1kHz two tone, and look at the spectral artifacts.

  25. #25
    Senior Member PaulS's Avatar
    Join Date
    Apr 2015
    Location
    Netherlands
    Posts
    550
    Emailed Princeton in Taiwan about the PT8211-H. Their reply:
    Dear Sir:

    Thank you for your interests toward our product. Please be informed that we don’t have PT8211-H. If you have any further question, please feel free to contact us.

    Best regards
    Well, that's confirmed then.
    Paul

Posting Permissions

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