Dual channel 16bit dac PT8211

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.
 
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:
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 :D
 
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".

scope1.jpgscope2.jpg

Thanks in advance

R.
 
Last edited:
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).
 
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.
 
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 :).

Teensy_Pt8211_schem.jpg
Photo on 06-06-16 at 11.47.jpg
 
Looks like you're using AGND (analog ground).

Use regular GND, since I2S is digital signals. AGND is only meant for analog signal stuff.
 
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.
 
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.
 
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:confused::rolleyes:
-Ben
 
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". :(
 
Is still out of stock? :-(

I had the same experience. I had to get them from another reseller and use an smd adaptor.
 
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:
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.
 
Mine arrived today, 40 pcs for about 25ct (€uro-cents) a piece.
@Frank B, I can mail you some if you are interested.
 
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.
 
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
 
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 |[U][I][B] I2S_RCR4_FSE |[/B][/I][/U] 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:
Back
Top