Hi,
I am using INA260 with my customized design, I am trying to read the current value under different condition(with cable or without cable - USB-C), but i am not observing any change in current variation its always -15536, Data sheet says Current register are in 2s complement value with convertion to decimal i am not able to read correct consistent value. Need your support on how to read the value correctly.
init function looks like below
config = INA260_CONFIG_AVGRANGE_4 |
INA260_CONFIG_BVOLTAGETIME_8244US |
INA260_CONFIG_SCURRENTTIME_8244US |
INA260_CONFIG_MODE_SVOLT_CONTINUOUS;
mask_data_var=MASK_ENABLE_DATA;
thresh_curr_var=CURRENT_THRESHOLD;
uint8_t config_data[2],mask_data[2],thresh_current[2];
config_data[0]=config>>8 ;
config_data[1]=config;
mask_data[0]=mask_data_var>>8;
mask_data[1]=mask_data_var;
thresh_current[0]=thresh_curr_var>>8;
thresh_current[1]=thresh_curr_var;
I2C_USBINA260_Initialize(&myfrontINA260,F_INA260_ADDR);
ret = I2C_DEVICE_SequentialRead(&myfrontINA260,value,size, (uint8_t)INA260_REG_CONFIG);
ret=I2C_DEVICE_SequentialWrite(&myfrontINA260,config_data,size,(uint8_t)INA260_REG_CONFIG);
// if(ret == I2C_MESSAGE_COMPLETE)
ret = I2C_DEVICE_SequentialRead(&myfrontINA260,value,size, (uint8_t)INA260_REG_CONFIG);
ret=I2C_DEVICE_SequentialWrite(&myfrontINA260,mask_data,size,MASK_ENABLE_REGISTER);
// if(ret == I2C_MESSAGE_COMPLETE)
ret=I2C_DEVICE_SequentialWrite(&myfrontINA260,thresh_current,size,ALERT_LIMIT_REGISTER);
I2C_USBINA260_Initialize(&myrearINA260,R_INA260_ADDR);
// ret = I2C_DEVICE_SequentialRead(&myrearINA260,value,size, (uint8_t)INA260_REG_CONFIG);
if(ret == I2C_MESSAGE_COMPLETE)
ret=I2C_DEVICE_SequentialWrite(&myrearINA260,config_data,size,(uint8_t)INA260_REG_CONFIG);
// if(ret == I2C_MESSAGE_COMPLETE)
ret=I2C_DEVICE_SequentialWrite(&myrearINA260,mask_data,size,MASK_ENABLE_REGISTER);
// if(ret == I2C_MESSAGE_COMPLETE)
ret=I2C_DEVICE_SequentialWrite(&myrearINA260,thresh_current,size,ALERT_LIMIT_REGISTER);
Thank you,
Arun