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.

MSP430G2553 I2C code?

Other Parts Discussed in Thread: MSP430G2553

Hi, I need to use the MSP430G2553 as a slave receiver. My goal is to have the MSP430 only receive information. I have been unable to find any code that, when I put it on the MSP430, allows the Raspberry Pi master to see the MSP430 connected, which makes me assume that the problem is in the MSP430 program. I am not using any pull-up resistors because the Raspberry pi already has 1.8k pull-up resistors on-board for SDA and SCL. I would appreciate just copy-paste code that will provide me with functions like receive_data(). Thank you!

  • Danylo,

    download the code examples for that processor here:

    There are examples for your application, too - look at:

    • msp430g2xx3_uscib0_i2c_05.c                USCI_B0 I2C Slave TX single bytes to MSP430 Master
    • msp430g2xx3_uscib0_i2c_07.c                USCI_B0 I2C Slave RX single bytes from MSP430 Master
    • msp430g2xx3_uscib0_i2c_09.c                USCI_B0 I2C Slave RX multiple bytes from MSP430 Master
    • msp430g2xx3_uscib0_i2c_11.c                USCI_B0 I2C Slave TX multiple bytes to MSP430 Master

    It is 99% copy and paste.

    Dennis

  • Besides the code, note that the MSP USCI module takes a 7 bit slave address, while the RasPI code might ask you for a complete 8-bit start byte (whose upper 7 bits are the slave address and the lower bit is the R/W bit).
    Also, an I2C connection is Open Collector, so you need a pull-up resistor of 10k or less (depends on line length and speed) to VCC on both lines, SCL and SDA. And of course a common GND connection.

**Attention** This is a public forum