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.

CC1312R: HOW TO READ TEMP DATA USING I2C BY FEEDING FROM THE PROCESSOR PIN

Part Number: CC1312R

Hello All,

I am using si7051 temp sensor. I am reading temperature data from this sensor. The code I wrote below is working. This code is fitting when you are feeding sensor from Battery (R38). But now I want to feed from microprosser pin  (V_Temp_MCU)(R39)

 you can see the temp sensor connection below. mcu pin is set to ioid7. 

#define V_Temp_MCU IOID_7

When I am reading sensor using battery over R38. this code is enough for now. But I want to modify the code for feeding from mcu. How can I do that? I am trying to set mcu pin 1 and then 0 . or 0 to 1. But When ;I am checking on debug mode, the code doesnt enter into the if (I2C_transfer(i2c, &i2cTransaction)) section.

Do you have any suggestion for that problem?

void Temperature_Function(UArg arg0, UArg arg1)
{
    uint8_t     txBuffer[1];
    uint8_t     rxBuffer[2];

    I2C_Handle      i2c;
    I2C_Params      i2cParams;
    I2C_Transaction i2cTransaction;
    I2C_init();
    I2C_Params_init(&i2cParams);

    i2cParams.bitRate = I2C_400kHz;
    i2c=I2C_open(CC1312_LAUNCHXL_I2C0, &i2cParams);

    if (i2c == NULL) {
//        Display_printf(display, 0, 0, "Error Initializing I2C\n");
        while (1);
    }
    txBuffer[0] = 0xE3;
    /* Common I2C transaction setup */
    i2cTransaction.writeBuf   = txBuffer;
    i2cTransaction.writeCount = 1;
    i2cTransaction.readBuf    = rxBuffer;
    i2cTransaction.readCount  = 2;
    i2cTransaction.slaveAddress = 0x40;

    while (1)
    {
        if(Temp_Read_Flag)
        {
            Temp_Read_Flag = 0;
            usleep(15); //14 bit temperature conversion needs 10+ms time to complete

            if (I2C_transfer(i2c, &i2cTransaction)) {
            /*
            * Extract degrees C from the received data;
            * see sensor datasheet
            */
            temperature = (rxBuffer[0] << 8) | (rxBuffer[1]);
            temperature = ((float)temperature*175.72)/65536 - 46.85;
            }
        }
    }
}

thank you 

BR

Bekir