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.

MSP430FR2633: Problem with I2C Data Line

Part Number: MSP430FR2633
Other Parts Discussed in Thread: HDC2010

I'm using the Driver Library's I2C Master Tx Single example to transmit on our I2C bus.  I have modified the example to remove the clock initializations (as they're already confirmed correct in the CAPT_BSP), and switch the GPIO_setAsPeripheralModuleFunctionInputPin() to the correct port for the 2633.  I have also added a call to EUSCI_B_I2C_isBusBusy() before the transmit The call to EUSCI_B_I2C_masterSendSingleByte() is not returning.

Looking at the bus, I am seeing clocks when the transfer is initiated.  However, SDA is staying low so we're not getting a start condition and not seeing any data.

I've confirmed our pullups are placed (3.3k) and ohmed out he connection to one of the slaves.

Code:

    WDT_A_hold(WDT_A_BASE);

    // //Set Ratio and Desired MCLK Frequency  and initialize DCO
    // CS_initFLLSettle(
    //     CS_SMCLK_DESIRED_FREQUENCY_IN_KHZ,
    //     CS_SMCLK_FLLREF_RATIO
    //     );
    //
    // //Set SMCLK = DCO with frequency divider of 1
    // CS_initClockSignal(
    // 		CS_SMCLK,
    // 		CS_DCOCLKDIV_SELECT,
    // 		CS_CLOCK_DIVIDER_1
    // 		);
    //
    // //Set MCLK = DCO with frequency divider of 1
    // CS_initClockSignal(
    // 		CS_MCLK,
    // 		CS_DCOCLKDIV_SELECT,
    // 		CS_CLOCK_DIVIDER_1
    // 		);
    //
    // Configure Pins for I2C
    /*
    * Select Port 5
    * Set Pin 2, 3 to input with function, (UCB0SIMO/UCB0SDA, UCB0SOMI/UCB0SCL).
    */
    GPIO_setAsPeripheralModuleFunctionInputPin(
        GPIO_PORT_P1,
        GPIO_PIN2 + GPIO_PIN3,
        GPIO_PRIMARY_MODULE_FUNCTION
    );

    /*
     * Disable the GPIO power-on default high-impedance mode to activate
     * previously configured port settings
     */
    PMM_unlockLPM5();

    //Initialize transmit data packet
    transmitData = 0x01;

    //Initialize Master
    EUSCI_B_I2C_initMasterParam param = {0};
    param.selectClockSource = EUSCI_B_I2C_CLOCKSOURCE_SMCLK;
    param.i2cClk = CS_getSMCLK();
    param.dataRate = EUSCI_B_I2C_SET_DATA_RATE_400KBPS;
    param.byteCounterThreshold = 1;
    param.autoSTOPGeneration = EUSCI_B_I2C_NO_AUTO_STOP;
    EUSCI_B_I2C_initMaster(EUSCI_B0_BASE, &param);

    //Specify slave address
    EUSCI_B_I2C_setSlaveAddress(EUSCI_B0_BASE,
        HW_ENV_SLAVE_ADDR
        );

    //Set in transmit mode
    EUSCI_B_I2C_setMode(EUSCI_B0_BASE,
        EUSCI_B_I2C_TRANSMIT_MODE
        );

    //Enable I2C Module to start operations
    EUSCI_B_I2C_enable(EUSCI_B0_BASE);

    while (1)
    {
        while (EUSCI_B_I2C_isBusBusy(EUSCI_B0_BASE)) ;

        //Send single byte data.
        EUSCI_B_I2C_masterSendSingleByte(EUSCI_B0_BASE,
            transmitData
            );

        //Delay until transmission completes
        while (EUSCI_B_I2C_isBusBusy(EUSCI_B0_BASE)) ;

        //Delay between each transaction
        __delay_cycles(50);

        //Increment transmit data counter
        transmitData++;
    }

  • Hi Jason,

    Based on your timing diagram, I see you are missing the slave "ACK" (ninth clock bit held low by slave), so I'm guessing that you don't have a "slave" device connected to the bus and if so, do you know what it's slave address is?

  • The one that I am trying to address with this test is a TI HDC2010.  It's ADDR signal is tied to ground so I expect its address to be 0x40.  You are absolutely correct that I had made an error on the address.  I had been using the correct address but reverted to the address in the example, which is incorrect.  Compounding the issue was that there was a problem with the test point on which I was measuring SDA.  I switched to reading SDA at another point (after correcting the address) and confirmed correct functionality.  Thanks.

**Attention** This is a public forum