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.

MSP430FR2433: I2C - Slave Mode - Read / Write from same register address

Part Number: MSP430FR2433

MSP is i2c slave.

Host processor is i2c master.

Master needs to perform read / write to the same register address when needed.

My issue is that same slave register address (that is transmitted via i2c by master), cannot be used for both read and write operation.

Please suggest a logic that i can use.

Is there any way to get read / write bit value that comes along with the slave address, so that i can implement a logic reading that bit.

  • Hello,

    Thanks for using MSP430. But I don't quite understand what you mean.

    What does the register mean? The peripheral registers of MSP430?

    And why same slave register address cannot be used for both read and write operation?

  • For i2c protocol, generally communication happens when master send slave address followed by "register address".

    This concept ("register address") is what I meant by register.

    Depending on whether it is read or write operation either value is written to or read from the specified register address of that slave.

    In the MSP I2C slave sample codes that i collected, I could understand that whenever MSP receives such register address for eg: 0x01, only i2c read operation is performed. The code design structure is in such a way that i2c write can't be performed if 0x01 is sent by master. For doing i2c write, another register address (command) is used.

    My use case is that, if I get a command like 0x01 from master and if it is write operation, then the next byte obtained from i2c should be stored to a global variable (This is i2c write operation). If again 0x01 command is received in the next i2c communication and if it is i2c read operation, then the value in the global variable should be copied to the Transmit buffer for master to read it.

    Is this possible to be implemented in MSP i2c slave code.

    Please provide some sample codes if there are any.

    Also, is there any way to read the 8th bit of slave address that determines whether i2c operation is read/write.

    Thanks

    Rejath

  • Hi,

    I have implemented this this design reading UCTR bit of UCBxCTLW0 register. Hope this is a dependable method.

**Attention** This is a public forum