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.

how to send I2C slave address

Other Parts Discussed in Thread: CC2541

How to you specify the address of the I2C slave? I read the User's Guide section of I2C, and it references the slave address a few times but never specifies how to set the address.

  • Hello Peter,

    You would first define it:

    #define SLAVE_ADDRESS 0x30

    Then set it:

    I2CADDR = (SLAVE_ADDRESS << 1)

    For a complete example, look at the i2c demo found in the swrc257.zip file.  http://www.ti.com/lit/zip/swrc257

    Thanks,

  • You have to load I2CDATA buffer with the address and R/W bit

    The I2C interrupt flag is set by the start condition (not mentioned by the User's Guide). It has to be cleared to send the address in I2CDATA. This seems to be different from what is stated on page 175 and 176 of the User's Guide.

    I2CADDR is used for setting the slave address of the CC2541. I wanted to address another slave on my PCB. Thanks for looking into it though

  • Here is a part of what is found in the documention.

    20.1.4.1 Slave Mode


    Initially, the I2C module is configured in receiver mode by setting the I2CCFG.ENS1 bit to receive the I
    address. Afterwards, transmit and receive operations are controlled automatically, depending on the R/W
    bit received, together with the slave address.


    The I2C slave address is programmed with the I2CADDR.ADDR bits. The value of the I2CADDR.GC bit
    determines whether the slave responds to a general call.

    ...

  • Sorry for the confusion, Here are the details:

    I want to communicate with a slave on the same I2C bus lines. The CC2541 will be the master. You have to send out a 7 bit address to specify the slave you are talking to. My original question was how to send out that address to the slave. I figured it out and am upset the solution wasn't in the documentation

    I2CADDR doesn't help because it sets the CC2541's slave address. That's only relevant  when the CC2541 is the slave. In my case the CC2541 is a master.

  • Now I see what where your confusion was.

    Unfortunately, the documentation doesn't tell you how i2c works, it only details how to configure the registers to make it work.  There was probably a note somewhere that stated you will have to look at the I2C protocol documentation for I2C fundamentals.  The rest is in the software, which you figured out.

    Thanks,