Post Go back to editing

Request for Support with AD1934WBSTZ DAC for Graduation Project

Category: Software
Product Number: AD1934

Request for Support with AD1934WBSTZ DAC for Graduation Project

Dear Analog Devices Support Team,

I am currently working on a graduation project where I am using the AD1934WBSTZ DAC chip as a key component. However, I am encountering difficulties understanding the datasheet and developing the necessary firmware due to my limited experience with DSP processing and audio technology.

To help me successfully complete my project, I am reaching out to inquire if Analog Devices provides any drivers or example software code for the AD1934WBSTZ. Having access to these resources would greatly aid me in overcoming the challenges I am facing and ensure I meet my project deadlines.

I would be immensely grateful for any assistance or guidance you can provide. Thank you in advance for your support.

  • Hello YounesBou,

    Thanks for using one of our parts for your project. We need a lot more information and since you are mentioning "drivers" we may not have a lot for you. Here are my questions:

    What hardware platform and DSP are you using? Arduino? SigmaDSP/SigmaStudio? SHARK? 

    What are the serial format details you plan to use? TDM?, I2S? Sampling rate? 

    What master clocks are available to use? Keep in mind they must be synchronous with the serial port clocks. In other words, the serial port LRCLK and BCLK must be divided down from the master clock. 

    Answering all of these questions will actually tell you how to setup all the registers for the part. This part does not have many registers so it is not that difficult to learn and the registers all default to zero. 

    Oh!, This reminds me to ask. Do you plan on running the part in standalone mode or will you be controlling it via some sort of controller?

    Dave T

  • Hello Dave Thib,

    Thanks for your response!

    I will use the default mode of the DAC when reset. I am using a crystal oscillator of 12.288 MHz (256x sample frequency of 48 kHz) connected to the XO and XI pins of the DAC. I will use the I2S format, but I find it difficult to write the firmware for the DAC due to my lack of knowledge regarding the I2S data protocol and audio technology.

    How does the DAC work if, for example, I send the value 0xFFFFFF? I understand that this should result in an output of 2.48V from the DAC, and if I send 0x000000, I should expect an output of 0.26V, correct?

    If you have any example code on how to generate a sine wave signal with an amplitude of 0.5V with a frequency of 50 hz and how to implement that using the STM32F466 microcontroller, I would greatly appreciate it. While I understand the SPI configuration settings, I am struggling with implementing the firmware to generate sine wave signals using the DAC.

    Best regards,

    Younes Boulmani

  • Hello Younes,

    There are a few things to unravel here. 

    You should watch my video on my YouTube channel about 2's compliment. This DAC is an audio DAC that operates with a 2's compliment number. An input to the DAC of 0xFFFFFF will not result in a fill scale output. Quite the opposite. A full scale positive is 0x7FFFFF and a full scale negative is 800000. I explain it all in the video. 

    (74) Twos Compliment - YouTube

    I really should do another video that talks about what are in these posts. But, I have so many other videos to make first. 

    There are a number of posts that explain what you should see for DC output of the DAC. 

    OFFSET VOLTAGE AT AD1938 CODEC DAC OUTPUT - Q&A - SigmaDSP Processors & SigmaStudio Dev. Tool - EngineerZone (

    Here is another one:

    AD1938 voltage range - Q&A - Audio - EngineerZone (

    It seems like there is a newer one with some more detail if I can find it...

    I think this is it:

    AD1938 output coding - Q&A - Audio - EngineerZone (

    This last link also links to another post discussing differential output levels. 

    Based on how you want to run the DAC. 256x fs for the master clock, plus run it in I2S mode. You should just run this part in standalone mode. See table 11 in the datasheet:

    This way you do not have to send any register writes. It will just power up in the correct mode. 

    Just ground all the pins in the table. I have no idea what hardware you are using which will obviously dictate if you can do this. 

    I do not have any examples using the controller you mentioned. I just use a SigmaDSP to drive the DAC. That is super easy. Then just control the DSP using a controller. But this entering into another set of things to know. 

    Dave T

  • Hello Dave,

    Thank you for your response!

    I misunderstood the concept earlier. So, if you send 0x000000, the output voltage is 1.5V. And if you send 0x7FFFFF, you reach the maximum positive voltage of 1.5 + 1.24 = 2.74V. As I understand it, the output voltage of the DAC can be calculated as follows:

    Vout=Vmin+(16777216Digital Value(−8388608))×2.48V

    where Vmin = 1.5 - 1.24 = 0.26V.

    And the digital value can be calculated as:

    Digital Value=16777216×(VmaxVminVoutVmin)8388608

    where Vout is the desired voltage for the sample, and VmaxVmin=2.48.

    I have now implemented my code to calculate the digital value based on the desired VoutV_{out}Vout using the above formula.

    I will receive my PCB tomorrow and have created the following hardware schematic:

    I have added an external crystal of 256x 48 kHz (12.288 MHz) connected to the XI and XO pins with 0-ohm resistors. However, I am unsure if I have connected it correctly. I intentionally added 0-ohm resistors so I can desolder them and use the LRCLK clock, which I have connected to my microcontroller's I2S_WS clock line. I have also added two loop filters with 0-ohm resistors: one for the MCLK clock and one for the LRCLK. Each loop filter can be desoldered depending on the clock configuration. I am wondering if my schematic is correct and if I have not forgotten anything or made any mistakes.

    I want to thank you in advance for all your help and the informative video regarding two's complement.

    Best regards,

  • Apologies I accidentally misstated the formulas:

    The formula is as follows:

    Vout=Vmin+((Digital Value(−8388608)/16777216)×2.48V

    where Vmin=1.5−1.24=0.26 V.

    Digital Value=16777216×((VoutVmin)/(VmaxVmin​))8388608

    where Vout is the desired voltage for the sample, and VmaxVmin=2.76-0.26=2.48.