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.

I2C master and slave

Other Parts Discussed in Thread: MSP430FR5969

Hello Experts, 
I am new to programming world. 
I am trying to establish I2C communication between two MSP430 boards. 
My question is- Where can I find the I2C master address and slave address ? 
I want a message to send from Master to slave and then slave will reply back to master. 

  • On the RM48 the address is programmed into the I2COAR register. I will transfer your question to the MSP430 forum.
  • Is it like each microcontroller in the world has separate I2C address ?
    I want to understand that if I am using 3 same microcontrollers and multiple sensors, and if 2 micrcontrollers in Master mode are configured, then how the sensors will differentiate between two master microcontrollers ?
  • Microcontrollers have a configurable address (or even multiple addresses for MCUs with the eUSCI module). This is set in the own address register (I2COA).

    However, the only address in an I²C transaction is the slave address; the I2COA register is used only when the MCU is in slave mode. A master does not need an address.

  • Hi Clemens
    Thank you for your reply,
    If the master don't need an address then if we have a slave and 2 same master microcontrollers. Then in this case, how the communication will take place, assuming all are connected using I2C protocol.
    I want that only one microcontroller should read the data Tx by slave and not the other master microcontroller.
  • Hi Ankush!

    The one that is the master and requests the data knows that it is requesting it. The other microcontroller simply does not react on activity on the line if it didn't initiated it. Of course both should never be active at the same time.

    Dennis
  • In a multi-master system, it is possible that multiple masters try to be active at the same time. This is handled automatically by the hardware; the one that loses arbitration gets UCALIFG.
  • Hello Clemens and Dennis,
    I have a small question in case where we have two same boards, lets say MSP430FR5969 connected to each other in I2C, one in master and other in slave.
    Is it possible to transmit information by slave without request of Master ?
    If no, then I have a case like,
    a acclerometer is interfaced with MSP430 in I2C protocol. MSP as master and sensor as slave. And I need to blink a LED once I move the acclerometer. So acclerometer is moved occasionally and based on that, the LED is blinked. So how this will work ?
  • Only a master can initiate a transaction.

    However, it is possible to have multiple masters.

    A slave-only device cannot initiate a transaction. Some accelerometers have a separate interrupt signal.

**Attention** This is a public forum