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

Thread: Dual channel 16bit dac PT8211

  1. #1
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,438

    Dual channel 16bit dac PT8211

    Hi,

    Has anyone used this component ? Is the soundquality ok ?
    The price is amazing, only cents!

  2. #2
    Junior Member
    Join Date
    Jan 2016
    Posts
    6
    hey

    i hope this answer is still relevant for you... i bought the pt8211 chip and used it in a synthesizer project. it works without any problems i cannot tell you much about the noise ratio or frequency response though, since i used pc speakers to test it.

    you can use the "teensy-i2s" library (a small project later used for the audio library) or the audio library's i2s output for the data communication.

  3. #3
    Junior Member
    Join Date
    May 2016
    Posts
    7
    Hello everybody!

    Looking at the datasheet the PT8211 use the i2s protocol, but the object in the audio library has different pin configuration. How BCLK,MCLK,TX,LRCLK relate to SCK, WS and SD? How did you connected them together?

    Thanks!
    R.
    Last edited by Ruben; 05-27-2016 at 10:47 AM.

  4. #4
    Junior Member
    Join Date
    Jan 2016
    Posts
    6
    Quote Originally Posted by Ruben View Post
    Hello everybody!

    Looking at the datasheet the PT8211 use the i2s protocol, but the object in the audio library has different pin configuration. How BCLK,MCLK,TX,LRCLK relate to SCK, WS and SD? How did you connected them together?

    Thanks!
    R.
    inside "i2s.h" you can select which pins are used, i used I2S_TX_PIN_PATTERN_1.

    iirc BCLK == SCK, TX = SD, LRCLK == WS MCLK is not needed.

    this is the code to transmit the bits:

    Code:
    	
    I2STx0.begin(I2S_CLOCK_32K_INTERNAL,[](int16_t* buffer){
    	int16_t val = play();
    	buffer[0] = val;
    	buffer[1] = val;
    });
    I2STx0.start();
    buffer[0] and buffer[1] have the same value, because my synth is mono

  5. #5
    Junior Member
    Join Date
    May 2016
    Posts
    7
    Thanks for the quick reply
    I'll be trying it out in the afternoon.
    R.

  6. #6
    Junior Member
    Join Date
    May 2016
    Posts
    7
    I test it out, and seem to work, but I'm getting a very distorted sine wave by using this simple patch.

    ///
    #include <Audio.h>
    #include <Wire.h>
    #include <SPI.h>
    #include <SD.h>
    #include <SerialFlash.h>

    // GUItool: begin automatically generated code
    AudioSynthWaveformSine sine1; //xy=192,220
    AudioOutputI2S i2s1; //xy=390,220
    AudioConnection patchCord1(sine1, 0, i2s1, 0);
    AudioConnection patchCord2(sine1, 0, i2s1, 1);
    // GUItool: end automatically generated code

    void setup() {
    AudioMemory(1);
    sine1.amplitude(0.5);
    sine1.frequency(100);

    }

    void loop() {
    }

    These are few pictures from the scope. Changing the amplitude value of the sine wave result in different shapes. At minus gain is almost a square wave, and by increasing the gain it get folded. Any suggestion on what could be wrong?
    The "i2s.h" file where is supposed to be located? In the Audio library I found only "output_i2s.h".

    Click image for larger version. 

Name:	scope1.jpg 
Views:	121 
Size:	125.5 KB 
ID:	7313Click image for larger version. 

Name:	scope2.jpg 
Views:	106 
Size:	135.3 KB 
ID:	7314

    Thanks in advance

    R.
    Last edited by Ruben; 06-06-2016 at 04:25 PM.

  7. #7
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    17,458
    I've ordered 10 PT8211 chips from Futurlec.

    I'm assuming you've used the connections from msg #4, but it would really help me to quickly reproduce this problem if you'd post clear photos or diagrams of how you've connected all 8 pins. Please attach the photo to your message (not dropbox).

  8. #8
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    1,586
    That distortion problem might be a coding issue. The PT8211 data sheet says that the I2S data has to be shifted in twos-complement format which I understand as signed int16_t. I don't know how the I2S object of the audio library does output its audio data, but if it were unsigned uint16_t, that would explain the "phenomenon" described above.

  9. #9
    Junior Member
    Join Date
    May 2016
    Posts
    7
    Hello Paul,

    Your assumption is correct, I followed the suggestion from Tly.
    Here an image of the schematic and a pic of teensy.
    I don't know enough about the audio library to comment on Theremingenieur but thanks for helping :-).

    Click image for larger version. 

Name:	Teensy_Pt8211_schem.jpg 
Views:	302 
Size:	112.0 KB 
ID:	7310
    Click image for larger version. 

Name:	Photo on 06-06-16 at 11.47.jpg 
Views:	183 
Size:	199.6 KB 
ID:	7311

  10. #10
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    17,458
    Looks like you're using AGND (analog ground).

    Use regular GND, since I2S is digital signals. AGND is only meant for analog signal stuff.

  11. #11
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    1,586
    Just discovered your scope pictures on dropbox. These folded waveforms show clearly a sign/overflow error. The data sheet states "The DIN data must be the 2’s complementary format and the MSB (Most Significant Bit) must be the first.". Looks like you are sending unsigned PCM while the DAC is expecting signed PCM.

  12. #12
    Junior Member
    Join Date
    May 2016
    Posts
    7
    Thanks for the info Paul.
    I don't remember clearly which GND I used for the first tests, but changing it to GND instead of AGND doesn't resolve the issue.

    Many thanks Theremingenieur.
    This is something hardcoded into "output_i2s.h" right? I'll have a look into it.

  13. #13
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    17,458
    Quote Originally Posted by Ruben View Post
    AudioMemory(1);
    Don't be so stingy with memory, at least give the audio lib a few buffers to work with!

  14. #14
    Senior Member Ben's Avatar
    Join Date
    Jul 2013
    Location
    Germany
    Posts
    401
    I2S signals change the L/R-Clock (WS) before the LSB is pushed out, bus this IC seems to expect the L/R-Clock to change after the LSB. So when fed with an I2S signal the DAC treats each LSB as the following sample's MSB... it think
    -Ben

  15. #15
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    17,458
    I got an email from Futurlec, saying "the PT8211 is out of stock and we have not been able to receive this part to complete your order".

  16. #16
    Junior Member
    Join Date
    May 2016
    Posts
    7
    Is still out of stock? :-(

    I had the same experience. I had to get them from another reseller and use an smd adaptor.

  17. #17
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    17,458
    Anywhere know where I can buy a PT8211 for testing?

    If it's not in stock anywhere, I'm going to assume it's gone obsolete and of course no more follow will happen (at least from me).


    EDIT: I ordered some from a random Ebay seller in Hong Kong....
    Last edited by PaulStoffregen; 06-16-2016 at 01:10 PM.

  18. #18
    Junior Member
    Join Date
    May 2016
    Posts
    7
    I wrote an email to Princeton Technology and they suggested me to get them from their Taiwan reseller, so I did the same, I ordered some from an Ebay seller in Hong Kong.

  19. #19
    Senior Member Ben's Avatar
    Join Date
    Jul 2013
    Location
    Germany
    Posts
    401
    Mine arrived today, 40 pcs for about 25ct (€uro-cents) a piece.
    @Frank B, I can mail you some if you are interested.

  20. #20
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,438
    Hm, yes, would be interesting.
    Do you have breakout-board ? No problem if not, but would be easier :-)
    I can send you some parts in return.

  21. #21
    Senior Member Ben's Avatar
    Join Date
    Jul 2013
    Location
    Germany
    Posts
    401
    No breakouts, sorry. PM me your address.

  22. #22
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    17,458
    The 10 pieces I ordered just arrived.

  23. #23
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,438
    @Ben which package are they ? SOP ?

    Do you suggest an own voltage-regulator ?
    Which OP-Amps ?

  24. #24
    Senior Member Ben's Avatar
    Join Date
    Jul 2013
    Location
    Germany
    Posts
    401
    SO8, 1.27mm pitch.
    Regarding Vreg and op amps, filters: Definitely worth a try, but let's get it running first, Vusb will do for first experiments. I fear the 3.3V supplied by Teensy will be a bit on the low side, so maybe a dedicated low-dropout-regulator that supplies 4.5-ish volts would be better. The DAC has a common supply for it's digital and analog section, so expect no miracles... I think I have a design for a 20kHz 3rd order reconstruction filter somewhere, I'll post what I find.

    -Ben

  25. #25
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,438
    Looking at the Datasheet (https://www.futurlec.com/Datasheet/Others/PT8211.pdf) I have the impression that one (the only?) problem might be the Frame-Sync-Early in the existing I2S Code.

    Code:
    I2S0_RCR4 = I2S_RCR4_FRSZ(1) | I2S_RCR4_SYWD(15) | I2S_RCR4_MF | I2S_RCR4_FSE | I2S_RCR4_FSP | I2S_RCR4_FSD;
    Perhaps worth a try to remove that bit. Since i have no hardware, currently, i can't verify this..
    #
    Edit: Oops, wrong line. It should be removed from TCR4, of course.. The receiver-code can be removed completely

    Last edited by Frank B; 07-04-2016 at 05:25 PM.

Posting Permissions

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