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.

INA233: CALIBRATION and LOAD issue

Part Number: INA233
Other Parts Discussed in Thread: MSP430FR4133

Greetings!

Problem #1: I'm trying to calibrate INA233 with equations from data sheet useing stm24f4

    R = 0.002f;
    max_curr = 10;
    Current_LSB = max_curr / powl(2, 15);
    CAL = 0.00512f / (Current_LSB * R);
    m = 1 / Current_LSB;
    CAL_LSB = CAL;
    CUR_LSB [2] =  CAL_LSB;
    CUR_LSB [1] =  CAL_LSB>>8;

The problem is that stm24 send 3 bytes 0xD4, 0x20, 0xC4 to calibrate IC, when i check this section it's send back 0x20 and 0x44.

Problem #2: even taking into account the incorrect calibration, the current values are incorrectly returned: the small currents are inflated and the high currents are underestimated

  • Hello Aleksandr,

    Thanks for your interest in our INA233.
    Did you verify that CUR_LSB[2] and CUR_LSB[1] contain the values you expect them to have? As for the bytes you send, I did not see any that correspond to a slave address. Did you first send the slave address with the read or write bit low? Another thing to note, you are supposed to transmit the least significant byte first which would mean 0xC4 should go before 0x20.
    After you setup the MFR_CALIBRATION register, can you read it and confirm that contains the correct value. If you get something that does not make sense can you provide us with some scope shots of your transmit and receive bit patterns?

    I suspect problem 2 is still related to problem 1 and we can revisit that after problem 1 is fixed and you still get incorrect values.
  • Hi!

    All you wrote is tru for my code after i correct the order of the bytes, but it's still returned the current values incorrectly.

    HAL_I2C_Master_Transmit(&hi2c2, 0x80, CUR_LSB, 3, 1000);   // set INA233 MFR_CALIBRATION register for current measurement
      HAL_I2C_Master_Transmit(&hi2c2, 0x82, CUR_LSB, 3, 1000);   // set INA233 MFR_CALIBRATION register for current measurement
      HAL_I2C_Master_Transmit(&hi2c2, 0x84, CUR_LSB, 3, 1000);   // set INA233 MFR_CALIBRATION register for current measurement
      HAL_I2C_Master_Transmit(&hi2c2, 0x86, CUR_LSB, 3, 1000);   // set INA233 MFR_CALIBRATION register for current measurement
      HAL_I2C_Master_Transmit(&hi2c2, 0x88, CUR_LSB, 3, 1000);   // set INA233 MFR_CALIBRATION register for current measurement
      HAL_I2C_Master_Transmit(&hi2c2, 0x8A, CUR_LSB, 3, 1000);   // set INA233 MFR_CALIBRATION register for current measurement
      HAL_I2C_Master_Transmit(&hi2c2, 0x8C, CUR_LSB, 3, 1000);   // set INA233 MFR_CALIBRATION register for current measurement
      HAL_I2C_Mem_Read(&hi2c2, 0x80, CUR_LSB[0], 1, CUR_LSB_check, 2, 100);

  • Hello Aleksandr,

    So this could be due to an incorrect address being transmitted. The reason I say this is some microcontrollers handle the address information slightly different than the data information. For example, with our microcontrollers we will have one line of code that relates to the address and another line of code that corresponds to whether the Read and Write bit is high or low. Below I will give an example.

    Say A1= GND, A2=GND, Slave Address=1000000.

    To write to this slave address with the MSP430FR4133, I would need to use the following two lines:

    UCB0I2CSA = 0x0040; // Slave address. While 0x80 would be correct including the R/W bit, the microcontroller rotates left by 1 to include
    //R/W bit defined in separate control register
    UCB0CTLW0 |= UCTR; //sets bit in control register that ensures a write occurs.

    So I would check if this is your issue. An oscilloscope shot of your bit stream might be quite helpful in determining if this is your issue.
  • Hello Aleksandr,

    Any updates on your debug? Were you able to rule out the cause I suggested above?
  • Hello!

    Sorry for left you unanswered. I found out that the other sensors are working right. Only first one is still sending wrong information about current and associated with it, although it's sending correct informatio about Vout.

  • Hello Aleksandr,

    So if I understand correctly, you have multiple INA233s on board and only 1 is not working correctly.  I am glad to know you got the others working.  It sounds as though that first sensor is broken.  I would recommend replacing that one and monitoring your inputs with an oscilloscope probe a startup or power on.  That way we can know if there are any transients that could potentially cause other future device failures.