This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

PCM5122 - basic I2C configuration in C

Other Parts Discussed in Thread: PCM5122, TLV320AIC3254

HI,

I have  a question regarding PCM5122 and its configuration settings; I would like to configure this DAC via I2C, and I'd like to program the MCU to configure it and stream data to it via I2S, in C.

Apparently, I am unable to figure out exactly how to do this. This page/register index mechanic has totally confused me and I am not managing to find my way around the datasheet at all.

One of the things I can't seem to understand is what exactly are the registers' addresses I need, and, after that, in which order should I send the configuration data.

If you could explain to me how to determine the addresses of the registers I require, i.e. what should I send via I2C:

i) right after sending the chip address

(in my case, 0b1001100[R/W], since my ADDR1 and ADDR2 pins are connected to the ground), and

ii) just before sending the configuration data,

that would be really great.

Even better, if you could share some code snippet in C, containing basic configuration for the chip via I2C, along with brief explanations of what configuration parameters are used, that would be super great.

Thanks in advance!

Regards,
Marko

  • Hi Marko,

    There is an explanation of the I2C interface starting on page 72 of the data sheet. There is also a layout of the register map shortly after on page 75. The PCM5122 is a DAC with an internal DSP to implement signal flow with biquads and volume control. There are multiple signal flows available in the ROM code to be chosen from, this choice is made by the value written in register 43 (decimal). If choosing the default signal flow, the biquads require coefficients, to shape the signal to your audio needs. This allows you to modify the audio signal to your liking. This is done through PurePath Studio, a graphical coding interface. Access to PPS can be requested through our website.

    To see an example of code for a microcontroller we have an app note about using an MSP430 to program an TLV320AIC3254. While the I2C communication will be similar the registers between the TLV320AIC3254 and the PCM5122 is not the same. The app not is here: www.ti.com/.../slaa605a.pdf

    Justin
  • Hi Justin,

    Thank you very much for you response!

    I am still processing it and not quite sure I understand it, yet. That note is somewhat confusing to me.
    I2C is nicely explained in the datasheet and I have used it before, so no problem there. As I said, the main issue for me is to understand what exactly I need to send via I2C.

    To make things as transparent as possible, here is a very literal question: let's say I'd like to mute the left DAC channel... now, the way to do this is to set the RQML bit in the Page 0 / Register 3

    Like I said before, this page/register convention is something I haven't faced before.

    So, I have a chip, which has its both ADDR pins grounded; the steps I would undertake, in achieving my goal via I2C interface, are:

    1) I would firstly send the START condition;
    2) followed by the chip address: 1001100 (binary);
    3) followed by the register address;
    4) followed by config data: 00010000 (binary);
    5) followed by the STOP condition.

    Please feel free to correct me on any of the points above, if you should find them incorrect!

    The question, of course, is what is the needed register address in this case?
    Or, in general, how do I transform the given information (Page A / register B) into an actual address?

    Much obliged!

    Regards,
    Marko