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.

CCS/TMS570LS1227: Interrupt-based polling for TMP468 temperature sensor

Part Number: TMS570LS1227
Other Parts Discussed in Thread: HALCOGEN, TMP468

Tool/software: Code Composer Studio

Hello everyone, 

I'm struggling with setting up a TMS570LS1227PGE to act as a master receiver over i2c for a TI TMP48 () temperature sensor. It would be much appreciated if someone could walk me through the HalCoGen setup and CCS code to read this sensor. 

I've spent a fair amount of time trying to interface with the sensor myself, below is my code:

 while(1){

    /* wait until MST bit gets cleared, this takes
         * few cycles after Bus Busy is cleared */
        //while(i2cIsMasterReady(i2cREG1) != true);

        /* Configure address of Slave to talk to */
        i2cSetSlaveAdd(i2cREG1, Slave_Address);

        /* Set direction to Transmitter */
        /* Note: Optional - It is done in Init */
        i2cSetDirection(i2cREG1, I2C_TRANSMITTER);

        /* Configure Data count */
        /* Slave address + Word address write operation before reading */
        i2cSetCount(i2cREG1, Receive_data_setup);

        /* Set mode as Master */
        i2cSetMode(i2cREG1, I2C_MASTER);

        /* Set Stop after programmed Count */
        i2cSetStop(i2cREG1);

        /* Transmit Start Condition */
        i2cSetStart(i2cREG1);

        /* Send the Word Address */
        i2cSend(i2cREG1, 1 , Slave_Word_address);

        /* Wait until Bus Busy is cleared */
        while(i2cIsBusBusy(i2cREG1) == true);

        /* Wait until Stop is detected */
        while(i2cIsStopDetected(i2cREG1) == 0);

        /* Clear the Stop condition */
        i2cClearSCD(i2cREG1);

        /*****************************************/
        //// Start receving the data From Slave
        /*****************************************/

        /* wait until MST bit gets cleared, this takes
         * few cycles after Bus Busy is cleared */
        while(i2cIsMasterReady(i2cREG1) != true);

        /* Configure address of Slave to talk to */
        i2cSetSlaveAdd(i2cREG1, Slave_Address);

        /* Set direction to receiver */
        i2cSetDirection(i2cREG1, I2C_RECEIVER);

        /* Configure Data count */
        /* Note: Optional - It is done in Init, unless user want to change */
        i2cSetCount(i2cREG1, DATA_COUNT);

        /* Set mode as Master */
        i2cSetMode(i2cREG1, I2C_MASTER);

        /* Set Stop after programmed Count */
        i2cSetStop(i2cREG1);

        /* Transmit Start Condition */
        i2cSetStart(i2cREG1);

        /* Tranmit DATA_COUNT number of data in Polling mode */
        i2cReceive(i2cREG1, DATA_COUNT, RX_Data_Master);

        /* Wait until Bus Busy is cleared */
        while(i2cIsBusBusy(i2cREG1) == true);

        /* Wait until Stop is detected */
        while(i2cIsStopDetected(i2cREG1) == 0);

        /* Clear the Stop condition */
        i2cClearSCD(i2cREG1);

        asm(" nop");
        asm(" nop");
        asm(" nop");

        vTaskDelay(10000);
}

In HCG, I've enabled all of the i2c interrupts, the i2c pinmux, the i2c VIM channel, and the i2c driver.

Any help, either advice or code is very appreciated. 

Thank you!