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.

MSP432P401R: I2C Wrong Address

Part Number: MSP432P401R

Hello,

I am using the MSP432 for my senior design project. I have it working properly when I am using the launch pad. I am using an I2C communication to the MAX 30101 chip through given address in the spec. In this case it is 0x57. However, when I try to use the MAP_I2C_masterSendMultiByteStart(EUSCI_B3_BASE, reg); function and pass 0x57 to the device, the slave address sent becomes 0x7F. This is making a loop of the FF to be sent through the communication protocol. If any one can help it would be greatly appreciated.

  • Hi Michael,

    You indicate that communications with the MAX 30101 works, but, if you use the MAP_I2C_masterSendMultiByteStart(), it doesn't, correct?

    What do you use when it works?

    Are you using  MAP_I2C_setSlaveAddress(EUSCI_B0_BASE, SLAVE_ADDRESS) to set the address?

  • I use that in my configuration.

    This is my configuration

    static const eUSCI_I2C_MasterConfig i2cConfig =
    {
    EUSCI_B_I2C_CLOCKSOURCE_SMCLK,
    12000000,
    EUSCI_B_I2C_SET_DATA_RATE_400KBPS,
    0,
    EUSCI_B_I2C_NO_AUTO_STOP
    };

    void initI2C(void){
    MAP_GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P6, GPIO_PIN0, 0);
    MAP_GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P6, GPIO_PIN4 | GPIO_PIN5, GPIO_PRIMARY_MODULE_FUNCTION);
    MAP_I2C_initMaster(EUSCI_B1_BASE, &i2cConfig);//Initialize Master
    MAP_I2C_setSlaveAddress(EUSCI_B1_BASE, SLAVE_ADDRESS);//Set slave address of MAX30101
    MAP_I2C_setMode(EUSCI_B1_BASE, EUSCI_B_I2C_TRANSMIT_MODE);
    MAP_I2C_enableModule(EUSCI_B1_BASE); //Enable module
    }

    uint8_t read_seq(uint8_t reg){
    uint_fast16_t status;

    status = MAP_I2C_getInterruptStatus(EUSCI_B1_BASE, EUSCI_B_I2C_NAK_INTERRUPT+EUSCI_B_I2C_STOP_INTERRUPT+EUSCI_B_I2C_TRANSMIT_INTERRUPT0+EUSCI_B_I2C_RECEIVE_INTERRUPT0);
    MAP_I2C_clearInterruptFlag(EUSCI_B1_BASE, status);
    //Tried to get this to work for hours
    //Found solution at e2e.ti.com/.../msp432p401r-in-i2c-master-how-to-send-one-byte-to-slave-repeat-start-and-read-one-byte-by-interrupt-method
    MAP_I2C_masterSendMultiByteStart(EUSCI_B1_BASE, reg);

    while((UCB1IFG & EUSCI_B_IFG_TXIFG) == 0);
    EUSCI_B1->IFG &= ~(EUSCI_B_IFG_TXIFG);

    __delay_cycles(300);

    //clear the TR bit to setup master as receiver
    EUSCI_B1->CTLW0 &= ~(EUSCI_B_CTLW0_TR);
    I2C_masterSendStart(EUSCI_B1_BASE);
    // wait for address to be sent
    // while(!MAP_I2C_masterIsStartSent(EUSCI_B1_BASE));
    while((EUSCI_B1->CTLW0 & EUSCI_B_CTLW0_TXSTT) == 0);
    // set stop immediately to ensure only one byte is read
    EUSCI_B1->CTLW0 |= EUSCI_B_CTLW0_TXSTP;
    // poll RX flag
    while(!(EUSCI_B1->IFG & EUSCI_B_IFG_RXIFG0));
    // Read from Receive buffer
    uint8_t RXData = EUSCI_B1->RXBUF;
    // ensure I2C transaction has completed
    while (MAP_I2C_masterIsStopSent(EUSCI_B1_BASE) == EUSCI_B_I2C_SENDING_STOP);
    return RXData;

    }

  • Hi Michael,

    From your comment above it looks like you have a solution.

    I'll change the status of this posting to RESOLVED, but if this isn’t the case, please click the "This did NOT resolve my issue" button and reply to this thread with more information.
    If this thread locks, please click the "Ask a related question" button and in the new thread describe the current status of your issue and any additional details you may have to assist us in helping to solve your issues.