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.

Multiple I2C slave operation

Other Parts Discussed in Thread: MSP430F5325, PCM1796, PCM9211

Hello all,

Using a I2C code i have to set the various registers of two slaves PCM9211 and PCM1796 via MSP430F5325.
while after setting the registers of both on reading back, registers of PCM9211 are well settled as provided in the code but on another slave PCM1796 registers are settled to 0xFF only .

attaching some basics details of both slave kindly verify what care should be taken while setting PCM1796.

code example is :-

I2C_Write (PCM9211_address, 0x31, 0x1A) ;

I2C_Write(PCM1796_address, 0x12, 0x50) ;

here case of PCM9211 is fine but not working with PCM1796.

one more thing i would i like to share is, i just want the default register setting for the PCM1796. so just by a pulse on reset pin default registers should be loaded on PCM1796 and as code is not accessing PCM1796 registers so i don't know , either default values are loaded or not i just know, still this is PCM1796 is not processing my input data. 

any type of suggestion is highly appreciated and feel free to ask any more detail about the setup.

Regards:-

Sonu Verrma 

  • Sonu Verma said:
    this is PCM1796 is not processing my input data. 

    Does this chip answer at all? Does your code check for UCNACK?

    Sonu Verma said:
    Using a I2C code

    Well, what code are you using? Maybe the problem is there.

    You say "here first 8 bit are data and last 8 bit are register address", so you are writing 0x10 to register 0xff?

    Note that the I2C function doesn't know how the slave interprets the data you are sending. First byte is slave address, but second and third parameter are just bytes and sent in this order. If the slave requires a different order, you have to pass them in a different order.

    The naming "I2C_write (slave_addr, reg_addr, data)" implies that the second parameter is the register address, no matter what slave you have. But in fact, it is nothing more than a generic  "I2C_write (slave_address, data1, data2)". Where the slave decides how to interpret data1 and data2.

    If there were two functions "PCM9211_write_register(address, register, data)" and "PCM1796_write_register(address, register, data)", then the two could add the proper base address (0x40 or 0x4c) to the address parameter (0..3), and call the generic I2C_Send function with reg_addr and data in the proper order.

**Attention** This is a public forum