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.

INA780-INA781EVM: C library

Part Number: INA780-INA781EVM
Other Parts Discussed in Thread: TI-SCB, INA781, INA780, SYSCONFIG

Hello, 

It there any possibility that you can provide me the library in C for this sensor ? I have some difficulties with the Communication. I am not an expert in code writing. 

Thank you 

Adrian 

  • Hello Valued Engineer,

    Thanks for your post.

    Have you tried using the TI-SCB board along with our GUI?

    If you want C code, our SysConfig software available on the device's product page (see below) will direct you to our ASC Studio where you can select which device (INA780 or INA781) and it will generate C files based upon desired device settings.

    Here is a generic link that will take you to the software and you can choose what your device is. Choose your desired Configuration and Alert parameters and this will update the C files automatically. Note there are helper functions at the bottom of the devce.c and device.h such as functions to get energy for example.

    https://dev.ti.com/sysconfig/index.html#/config/?args=--product%20%2Fmnt%2Ftirex-content%2Fascstudio_1_0_12%2F.metadata%2Fproduct.json%20--device%20Other

    Sincerely,

    Peter

  • Hello Peter, 

    The issue that i have is that i am unable to read the correct bus voltage and just some random values.

    The die temp and the current measurement are working just fine.  

    this is the function to read the VBUS : 

    int32_t INA781_Measure_VBUS(void)

    {

    uint8_t vdata[3];

    //uint8_t data;

    //HAL_I2C_Mem_Write(INA781_I2C, INA781_ADDRESS, VBUS, I2C_MEMADD_SIZE_8BIT, &data, sizeof(data), HAL_MAX_DELAY);

    HAL_I2C_Mem_Read(INA781_I2C, INA781_ADDRESS, VBUS, I2C_MEMADD_SIZE_8BIT, vdata, sizeof(vdata), HAL_MAX_DELAY);

    BusVoltageRaw = ((((int32_t)vdata[0]<<24) | ((int32_t)vdata[1]<<16) | ((int32_t)(vdata[2]&0xF0))<<8) >> 12);

    busVoltage = (float)BusVoltageRaw * 192.3125;

    return busVoltage;

    }

    Maybe you can give me a hand with this!

     

    Thank you

    Adrian