Probing the pHAT DAC

I am making a new piece in which a sine wave will be clapped as a binary rhythm and converted in real time into an audio wave form.

We had a few of the pHAT DACs for Raspberry Pi in the studio so I thought I would use one to try and get an idea of how they deal digital information.

I used a Raspberry Pi 3, put on the DAC ran the config file from the link below and it worked pretty much straight away.

https://pinout.xyz/pinout/phat_dac

Then I installed Audacity on the Pi, made a 16 bit 44.1 khz Sine Wave and played it out through the DAC.

dactest1

I then soldered a few connectors onto the DAC so that I could run it into my logic tester and see what data is being outputted by the Pi before it is converted by the DAC.

dactest2

Then I spent ages trying to work out what was going on with the digital output.

dactest3

I still need to do a bit of research but it looks like for each sample it sent is encoded as 2 bytes of information (16bits) in a frame that is 32 bits long. I don’t really know why that would be, but from nosing around on some forums I saw this quote.

The frame is always 32 bits per sample, and there are two samples per frame, so you need 64 clocks to transfer a frame. So BCLK is always 64 times LRCLK. With 48 kHz sampling, BCLK is 3.072 MHz.

With 256x oversampling (modulator clock MCLK at Fs * 256), BCLK is MCLK / 4.

I found that here… and will hopefully get to grips with how DACS work soon.

https://forums.xilinx.com/t5/Welcome-Join/ZYBO-I2S-BCLK/td-p/433246

Leave a Reply