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.

PCM9211 Configuration issue

Other Parts Discussed in Thread: PCM9211, MSP430G2452, MSP430F5325

Hello Sir,

                 I want to make a ADC with the help of PCM9211 .Here the input would be an Analog Stereo pair and the output would be S/PDIF  signal which we will collect from MPO 0/1. I have configured the PCM 9211 registers as

Register Add        Value                                                            

0x42   ---------------- 0x02

0x31   ----------------  0x16                 

0x48   ---------------- 0x00

0x49   ---------------- 0x00

0x60   ---------------- 0x22

0x78   ---------------- 0xFE

0x61   ---------------- 0x10

0x35   ---------------- 0x0C

0x6b   ---------------- 0x22

The strategy is to activate the ADC in I2S Mode and we have selected 48KHz as our sampling rate.The I2S output of the ADC would be given as the Source signals(Data,LR Clock,Bit Clock) to DIT.The output of the DIT would be connected to RECOUT0 and RECOUT1  and then it would be routed to MPO 0/1.
I am using PCM9211 EVM-U as my initial development board and controlling the registers with the help of  Codec Control Software.
The problem is that,I am not able to perform this task at all.Please suggest me the way by which we can perform this task with the help of PCM9211 IC.

Regards,

CB Vats

Application Engineer

Comcon Technologies Limited

  • Hi, CB,

    I have asked my colleague to look into this and get back to you.

    -d2

  • Sir 

    Don Dapkus

    M also facing the same problem in PCM9211 and SBAC109 , 
    kindly suggest some another proper way or alternative.

    thanks n regards:-

    Sonu verma 

  • Hi Don,

                    I am writing this to just remind you about the issue.We are in very much of Urgency.Please help me out as soon as possible.

    Regards,

    CB Vats

  • Hi CB,

    I'm checking with this, and will give you the reply soon.

    Thanks.

  • Hi CB,

    It seems that there are problems in your configuration. Please find the sample script in attachment and I have verified this with our EVM board.

    #System RST Control
    #w 80 40 00
    w 80 40 33
    w 80 40 C0
    
    #XTI Source, Clock (SCK/BCK/LRCK) Frequency Setting
    w 80 31 1A
    w 80 33 22
    w 80 20 00
    w 80 24 00
    #ADC clock source is chosen by REG42
    w 80 26 81
    
    #XTI Source, Secondary Bit/LR Clock (SBCK/SLRCK) Frequency Setting
    w 80 33 22
    
    #----------------------------
    #MainOut chose ADC DOUT, ADC CLK source is XTI
    #w 80 42 02
    #ADC CLK source is AUXIN1, as in existing EVM, TAS1020 BCLK. LRCK MCLK is conent to MPIOC,which can be used as AUXIN1, and PCM9210 ADC work in slave mode, need external clock. The TAS1020 clock on MPIOC is just it needed.
    w 80 42 04
    #--------------------------
    
    #ADC I/F salve mode
    w 80 48 00 
    > 00
    
    #ADC L-ch, Digital ATT control, ADC R-ch, Digital ATT control
    w 80 46 D7 
    > D7
    
    #-------------------Start DIT settings-------------------
    #REG 60h DIT System Clock Source Select, DIT Bit clock, LR Clock, Data Source Select, here chose AUXIN1
    w 80 60 42
    
    #REG 60h DIT System Clock Control(here is 256 Fs), DIT DSD input enable(here is disable), DIT Audio I/F Format Setting(here is I2S)
    w 80 61 10
    
    #REG 62h DIT Output Audio Data Mute Control(no mute), DIT Output Validity Flag Control(Valid)
    w 80 62 00
    #---------------------End DIT settings------------------
    
    #----------------------------
    #REG. 78h, MPO1, MPO0 Function Assign Setting. MPIO0 1 both output DIT
    w 80 78 DD
    #--------------------------
    
    #MPIOC-->AUXIN1
    w 80 6E 0F
    w 80 6F 40
    #-------------end----------------
    
    #main out source
    w 80 6B 22
    r 80 6B 01

    The sample script uses 44.1kHz sample rate which sourced from TAS1020(default firmware is 44.1kHz) as same as DIT section. If you want to change other samples, you need to provide the suitable clocks on MPIO_Cx port which also source as DIT clock.

    MPO0/1 should be configured as TXOUT.

    Thanks.

  • Hi Jacky,

                      Thanks for your Reply.The Script sent by you helped me a lot in Identifying the Wrong Register Settings set by me earlier.


    I am Using Audio Precision APx585 Audio Analyzer to give the Analog Stereo Input Data to the EVM Board and collecting the S/PDIF Signal in my Analyzer.I am giving the Analog Signal of 0dbu as an input to the EVM Board and Collecting the o/p S/PDIF Signal in the Digital Analyzer  .The Analyzer is Locking on 44.1 Khz Sampling Rate,but it is not showing any incoming data.Please help me out in overcoming this issue.

    If you want any further Clarification about the issue then feel free to write it to me.

    Regards,

    CB Vats 

  • Hi CB,

    What's the W9 Jumper setting on your EVM board? Have you removed it from the board?

    Try to increase the analog input level to see if there is still no signals output.

    Thanks.

  • Hello Jack,

                         I tried to check and analyze the digital output with increased ANALOG input level upto 7V.But still I am not getting any data on my analyzer .The Analyzer is still locking on 44.1 KHz.

    No,I have not removed W9 jumper from EVM Board.If it is Required to remove W9 jumper in order to make the test ?

    One more thing I did is I tried to run the ADC by selecting the XTI as ADC Clock source.I made the value of 42h as 0x02 ,value of 60h as 0x22 and rest all register's values same as what U sent .So at that time I was expecting the Analyzer to lock on 48KHz but it is still locking on 44.1 KHz only.
    Please Clarify me this situation as I want to use XTI as the clock source to the ADC.

    Also please assist me that how may I be able to have data in the Digital Signal coming out from MPO 0/1 .

    Thanks and Regards,

    CB Vats 

  • Hello Jack,

                         Now I am able to perform the ADC Operation with the help of EVM Board. I am getting data in my analyzer and also I am able to vary the Sampling rate According to my choice and the Analyzer is Locking on the same Sampling Rate.I am using XTI as my ADC Clock Source. Thanks a lot for your support.

    I have few queries as follows:

    1. What is the Full Scale Voltage of the ADC of PCM9211? If there is any way to Increase the Full scale Voltage of the ADC?

    2.Now I will try to Implement this Operation(Analog Input-S/PDIF Output Conversion) on Our Hardware Board.We are using MSP430 Micro controller to configure the PCM9211 Registers. I would be using XTI as my Clock Source in the ADC of PCM9211 which is 24.5760 MHz. How I would be able to Implement 44.1 KHz Sampling rate with this Clock Source or what would be the another ways to Implement 44.1 KHz Sampling Rate in My Board?

    Your Suggestions would be Highly Appreciated.

    Thanks & Regards,

    CB Vats 

  • Hi CB,

    Good job!

    "1. What is the Full Scale Voltage of the ADC of PCM9211? If there is any way to Increase the Full scale Voltage of the ADC?"

    Single-ended voltage input(full scale voltage) for ADC of PCM9211 is 3 Vp-p, if you want to increase the full scale voltage, you can use some resister divider on the ADC input to achieve this.

    "2.Now I will try to Implement this Operation(Analog Input-S/PDIF Output Conversion) on Our Hardware Board.We are using MSP430 Micro controller to configure the PCM9211 Registers. I would be using XTI as my Clock Source in the ADC of PCM9211 which is 24.5760 MHz. How I would be able to Implement 44.1 KHz Sampling rate with this Clock Source or what would be the another ways to Implement 44.1 KHz Sampling Rate in My Board?"

    The system clock for the ADC of the PCM9211 must be either 256fS or 512fS, where fS s the audio sampling rate for the ADC (16 kHz to 96 kHz). For 44.1kHz sample rate, that means XTI clock is either 11.2896 MHz or 22.5792 MHz.

    Thanks.

  •  Hi Jacky,

    1st of all thanks for all your valuable replies...!

    PCM9211 working fine using above script, but for now i'm trying to control this PCM9211 board through MSP430 using I2C protocol. for this i modified a example code  MSP430F530x_uscib0_i2c_08 provided with CCS5.2 .

    what all m doing here is, I'm treating register location and there values of PCM9211  as same thing , n feeding sequentially

    e.g reg. loc then data

    reg. loc then data.

    but now again PCM9211 in not configured, n not getting where m doing mistake again.

    in my code P3.0 n P3.1 is configured as SDA,  SCL line, 10k external pullup is also used.

    m pasting my code here...

    //******************************************************************************
    // MSP430F530x Demo - USCI_B0 I2C Master TX multiple bytes to PCM9211 Slave
    //
    // Description: This demo connects MSP430's via the I2C bus. The master
    // transmits to the slave. This is the MASTER CODE. It cntinuously
    // transmits an array of data and demonstrates how to implement an I2C
    // master transmitter sending multiple bytes using the USCI_B0 TX interrupt.
    // ACLK = n/a, MCLK = SMCLK = BRCLK = default DCO = ~1.045MHz */

    #include <msp430.h>

    unsigned char *PTxData;                         // Pointer to TX data
    unsigned char TXByteCtr;

    const unsigned char TxData[ ] =             // Table of data to transmit,  reg loc. then value
    {
    0x40,0x33,
    0x40,0xc0,
    0x31,0x1A,
    0x33,0x22,
    0x20,0x00,
    0x24,0x00,
    0x26,0x81,
    0x33,0x22,
    0x42,0x02,
    0X48,0X00,
    0x49,0x00,
    0x46,0xD7,
    0x47,0xD7,
    0x60,0x22,
    0x61,0x10,
    0x62,0x00,
    0x78,0xDD,
    0x6E,0x0F,
    0x6F,0x40,
    0x6B,0x22
    };

    int main(void)
    {
    unsigned int i;

    WDTCTL = WDTPW | WDTHOLD;                                  // Stop WDT
    P3SEL |= 0x03;                                                                   // Assign I2C pins to USCI_B0
    UCB0CTL1 |= UCSWRST;                                              // Enable SW reset
    UCB0CTL0 = UCMST | UCMODE_3 | UCSYNC;        // I2C Master, synchronous mode
    UCB0CTL1 = UCSSEL_2 | UCSWRST;                        // Use SMCLK, keep SW reset
    UCB0BR0 = 12;                                                                 // fSCL = SMCLK/12 = ~100kHz
    UCB0BR1 = 0;
    UCB0I2CSA = 0x80;                                                        // Slave Address is 048h
    UCB0CTL1 &= ~UCSWRST;                                         // Clear SW reset, resume operation
    UCB0IE |= UCTXIE;                                                          // Enable TX interrupt

    while (1)
    {
    for(i=0;i<10;i++);                                                                // Delay required between transaction
    PTxData = (unsigned char *)TxData;                              // TX array start address
                                                                                                      // transmit operation.
    TXByteCtr = sizeof TxData;                                               // Load TX byte counter

    UCB0CTL1 |= UCTR | UCTXSTT;                                   // I2C TX, start condition

    __bis_SR_register(LPM0_bits | GIE);                            // Enter LPM0, enable interrupts
    __no_operation();                                                               // Remain in LPM0 until all data
    // is TX'd
    while (UCB0CTL1 & UCTXSTP);                                      // Ensure stop condition got sent
    }
    }


    #pragma vector = USCI_B0_VECTOR
    __interrupt void USCI_B0_ISR(void)
    {
    switch(__even_in_range(UCB0IV,12))
    {
    case 0: break;                                                           // Vector 0: No interrupts
    case 2: break;                                                            // Vector 2: ALIFG
    case 4: break;                                                           // Vector 4: NACKIFG
    case 6: break;                                                           // Vector 6: STTIFG
    case 8: break;                                                          // Vector 8: STPIFG
    case 10: break;                                                       // Vector 10: RXIFG
    case 12:                                                                    // Vector 12: TXIFG
    if (TXByteCtr)                                                           // Check TX byte counter
    {
    UCB0TXBUF = *PTxData++;                                    // Load TX buffer
    TXByteCtr--;                                                              // Decrement TX byte counter
    }
    else
    {
    UCB0CTL1 |= UCTXSTP;                                    // I2C stop condition
    UCB0IFG &= ~UCTXIFG;                                     // Clear USCI_B0 TX int flag
    __bic_SR_register_on_exit(LPM0_bits);            // Exit LPM0
    }
    default: break;
    }
    }

     

    please assist as soon as possible whats going wrong, way of treating register address and there values or something else....

    looking for your valuable reply

    regards:-

    Sonu Verma 

  • Hi Sonu,

    I have no MSP430F5xx on my hand, I just make a simple MSP430G2452 code try to write the register and then read back to see if it is correct and it works fine.

    The code compiled with IAR 6.4.1, just for your reference. For more MSP430 coding technical questions, you can refer to our MSP430 forum on e2e.

    3225.MSP430G2452_PCM9211.zip

    Thanks.

  •  Hi Jacky,

    thanks a ton for your codes, i modified them for my MSP430F5325 and I2C is working as per my scope (I meant for data n clock lines) but 

    theres nothing to read in "reg_value" register using below line.

    reg_value = I2C_Read(PCM9211_address, 0x31);

    // subroutine for reading register value.... 

    unsigned char I2C_Read(char addr, char reg_addr)
    {
    unsigned char retval=0x00;

    addr <<=1;
    addr &= 0xFE; //LSB to 0 for write

    I2C_Start();
    I2C_TX_Byte(addr);
    I2C_TX_Byte(reg_addr);
    I2C_Restart();
    addr |= 0x01; //LSB to 1 for read
    I2C_TX_Byte(addr);
    retval = I2C_RX_Byte(1);
    I2C_Stop();

    return retval;
    }

    what could be the problem here....??

    thanks n regards

    Sonu Verma

  • hi Jacky,

    I'm attaching the codes what i modified for reading the PCM9211 from the code u given to me, 

    and my question is why m getting "0" or "." on reg_value....

    whats going wrong.

    kindly open the links for codes:-

    https://drive.google.com/folderview?id=0BwnPNNS5mK_1aW4wUG5KZ0VoZ2c&usp=sharing

    thanks and regards

    Sonu Verma

  • Hi Sonu,

    You can try to write multi-times to one register, and then read back to verify if the i2c code works fine.

    You have not written any value to register 0x22, so you can't except the value you want to read back.

    Thanks.

  • Hi Jacky,

    thanks for your contribution, its all working fine, actually there's some issue in MCU pin i used, i changed the pin now its working fine.

    now i'm working on designing my own pcb of PCM9211 and MCU, as ADC device. 

    if you suggest me basic circuit requirement of PCM9211, i ll be very thankful

    once again thanks a lot for all valueable contribution

    Regards:-

    Sonu Verma

  • Hi Sonu,

    Good to know that you made it to work finally. Actually you can just refer to our EVM board's schematic, page2 which is the basic configuration for PCM9211, you can just remove I2S related circuits and keep optical Out/Error indicators/Analog In/Crystal/I2C circuits and necessary power supply.

    The schematic you can find it in the User's Guide: http://www.ti.com/lit/ug/sbau174/sbau174.pdf

    Thanks.

  • Hi Jacky,


    i have few question about PCM9211,
     
    i just made a pcb of PCM9211 and its basic circuitry.
    m using 3.6v and 5v  as Vcc Respectively. 
    i designed:- 
    1. Analog line in
    2. Error pin to 3,6v and NPCM pin to gnd 
    3. Free jumper on PIN 3 to 14 on PCM9211
    4. MPO0 and MPO1 are using for taking out SPDIF voltage.
    5. pin no. 17 to 20 and 28 to 34 are again left open
    6. Pin no. 23, 26 and 27 are grounded 
    7. Pin no. 24 n 25 are using as I2C (with 4.7k register)
    8. Pin n. 35 and 37 (COAX input) are left open
    9. All other pins are used as per the schmatic of PCM9211-EVM
    Vcc, Gnd, Crystal circuit working fine.
    m giving ( 0dBu 1Khz analog signal from APx ) on Analog line in
    but there's no digital output on MPO0 and MPO1, 
    code working fine for EVM , so there's maybe no. of  issue in my design of PCM9211.
    its all about simple ADC.
    please specify where m doing wrong.
    Regards:-
    SonuVerma
  • Hi Sonu,

    Can you provide your schematic and PCB layout for me?

    Thanks.

  • Hi Jacky,

    I guess Error Located, i guess the reason of error is MCLK, which is provided to EVM board via TAS but in my design as i mention in previous post, there is no connection between msp's MCLK and PCM9211 mclk pin (which is necessarily connected ??) 
    m doing wrong here, if u assist in this area it would be highly appreciable.
    need of MCLK ? or how to generate MCLK via DCO of MSP or what is the value of MCLK frequency needed.    

    Regards:-
    SonuVerma
  • Hi Sonu,

    You can use the XTAL(PCM9211) to provide the clocks for PCM9211, thus PCM9211 ADC works in Master mode, if you want it in Slave mode, you must provide MCLK.

    For MSP430 to generate the MCLK, you need a special crystal(e.g. 24.576MHz) on XTAL1 or XTAL2, configured them as MCLK/SMCLK for MSP430, then output them on dedicated GPIO, you can refer to MSP430 example codes to achieve this.

    Thanks.

  • Hi Jacky,
    M bit confuse now would i check for signal on Dout or  MPIO0/1...
    what all i want is to make a ADC with the help of PCM9211 no matter ADC is working Slave or master mode.

    Here the input would be an Analog Stereo pair and the output would be S/PDIF signal which we will collect from MPO 0/1. I have configured the PCM 9211 registers as given below... 

    Reg. Address           Value

    0X40                             0X33

    0X40                             0XC0

    0X31                             0X1A

    0X33                             0X22

    0X20                             0X00

    0X24                             0X00

    0X26                             0X81

    0X33                            0X22

    0X42                             0X02

    0X48                             0X00

    0X49                             0X00

    0X46                             0XD7

    0x47                              0xD7

    0X60                             0X22

    0X61                             0X10

    0X62                             0X00

    0X78                             0XDD

    0X6E                             0X0F

    0X6F                             0X40

    0X6B                             0X22 

    after applying this register setting on my PCM9211 board, m getting nothing on MPIO0/1, would i check digital out some where else...
    and how to debug the same. m using 24.576 MHz crystal with PCM9211.
    as m experienced in MCU side but for now i have to handle the Audio Side too.
    so please tell if m doing wrong in register values or sequence of filing registers of PCM9211. or could be some hardware problem why these no output on MPIO0/1??

    Regards:
    Sonu Verma

     

  • Hi Sonu,

    Your configuration code is correct, it maybe seems that there are some issues in your schematic and hardware board. Here I have attached a reference schematic which I modified from EVM and I have run your code with the GUI, it works fine. Can you double check your schematic and hardware board with my schematic?

    Also, you can use our EVM board I2C line connected to your board to verify your I2C code works normally.

    6204.PCM9211 Schematic.zip

    Thanks.

  • Hi Jacky,

    its working now but for same configuration as above. (testing it on APx)
    there is a frequency change between analog n digital signal.
    input is 3dBu 1KHz analog and digital output frequency is 917.48Hz only 
    why this frequency change occurring...?

    i tried modifying reg 31 and 33H in several diffent ways using

    Table 3. ADC Clock Requirements of PCM9211 datasheet but there's nothing positive.
    using external crystal of 24.576MHz and its working fine, i checked it on frequency meter.

    Regards:-
    Sonu Verma 

  • Hi Sonu,

    I don't think this is related to the register settings, I have test it using AP SYS-2722, the frequency is very accurate with our EVM board. See below results:

    Have you followed the schematic I drawn to you? Do you have any filters on the ADC input channels? Have you measured the frequency on ADC input pins?

    Thanks.