INA228: Do we need to manually clear the conversion complete flag in Diagnostic Flags and Alert (DIAG_ALRT) Register?

Part Number: INA228
Other Parts Discussed in Thread: INA226

Tool/software:

Hello, I would like to understand conversion complete flag behavior in INA228.

We have configured the INA228 in continuous mode and enabled the conversion complete event. So, whenever the ADC complete, the ALERT pin will give us trigger that data is ready and CNVRF flag in DIAG_ALRT register. Do we need to clear the CNVRF flag in DIAG_ALRT register or it will clears automatically by reading the current/ voltage registers? I am assuming that it will gets clear by reading current/ voltage register. Please correct me if I am missing anything. Thanks in advance for your support and help.

Best Regards,

Ankit

  • Hello Ankit,

    So, the behavior of the ALERT pin will actually change depending on if you have the ALATCH bit in DIAG_ALRT enabled or not.

    If you do not have ALATCH enabled, then the conversion ready flag will clear automatically after being sent:

    So in this case, it will clear whether or not you have read anything.

    If you do have ALATCH enabled, then the conversion ready will hold the ALERT pin down until cleared:

    So in this condition, you will need to read from the take an extra step to clear the flag. Since you are in continuous conversion mode, you wouldn't want to write to the ADC_CONFIG register because that would restart the conversion. reading the result register will not clear the flag in this case.

    Regards,

    Mitch

  • Hi Mitch,
    Thanks for your response and detailed explanation.

    In our scenario we are using the continuous mode and in the DIAG_ALRT register we are just enabling the CNVR bit and all other bits are at reset state including ALATCH=0. After receiving the first alert from the INA228, when I read the DIAG_ALRT register for the status of different flags and I found that "MATHOF" bit sets to "1". So, the value of DIAG_ALRT register is 0x100. I would like to understand the why this MATHOF gets set. Thanks in advance for your help and support.

    Best Regards,

    Ankit

  • Hey Ankit,

    When the MATHOF bit gets tripped, it indicates that current and power data may be invalid. The most likely cause of this is that the SHUNT_CAL value is not properly set with your max current. For example, if you read a current higher than the SHUNT_CAL was calculated for. (or similar situation). 

    Regards,

    Mitch

  • Hello Mitch,

    Thanks for your response. With the valid shunt value I am not getting an error now.

    I was evaluating the ALERT pin of INA228 and I observed that pin is not getting pull high until I am not reading back DIAG_ALRT register. When I am reading the DIAG_ALRT register it provide 0x4003 value to me. I am writing which configuration I am using for INA228, please find them below:

    CONFIG(0x00): TEMPCOMP = 1, RSTACC = 1, rest all zero

    ADC_CONFIG(0x01): MODE = 0x0A, rest all zero

    SHUNT_CAL(0x02): 0x1000

    SHUNT_TEMPCO(0x03): 0x000F

    DIAG_ALRT(0x0B): CNVR=1, APOL=0, ALATCH=0, rest all zero

    I have configured the INA228 pins as external interrupt to my MCU. So, for that I am getting interrupt once. After receiving first interrupt not getting interrupt any of the time and I have also observed the alert line on the logic analyzer which stays low after interrupt received.

    Please let me know some solution to the my problem. Thanks in advance for your help and support.

    Best Regards,

    Ankit

  • Hi Mitch,

    One more followup question related to alert functionality of INA228. Currently, we are using the INA228 with our MCU on I2C interface. I would like to confirm you with that, do we able to get alert from INA228 with I2C interface? As I mentioned in above thread, able to receive alert only once then ALERT pin stays low level only and it does not pull high until removal of Vin. From the datasheet point of view I suspect that alert would not work with I2C as it suppose to design to work with SMBus. For the reference, I am attaching the snap.

    Could you please confirm the same? Thanks in advance for your help and support.

    Best Regards,

    Ankit

  • Ankit,

    Thank you for your patience. Mitch is out of the office today but will reply when he returns on Tuesday.

    Louis

  • Hello Ankit,

    That feature will work with I2C or SMBus. It is designed in to be compatible with SMBus protocol, but the INA228 does not know if you are using SMBus or I2C, so if you send the Alert Response code, then our device will respond accordingly.

    Regards,

    Mitch

  • Hi Mitch,

    Thanks for your reply and giving us possible solution. I tried this with the I2C as out MCU(NXP K32L2A41) does not support SMBus in the master mode but it only support SMBus in slave mode. According to SMBus frame sequence for alert response address I tried to send it but with the I2C but I am getting NACK after sending alert response secondary device address (0001 100) with the read but set high.

    I would like to ask that do we need to use the master for normal I2C transaction and slave mode to send alert response address. Please let me know your opinion how to send alert response address correctly over I2C.

    I also understood that alert line stays low until it will not respond to the alert response address. Is it mean that do we need to share the alert response over the alert pin?

    Please correct me if you find my understanding is wrong? Thanks in advance for your support and help.

    Best Regards,

    Ankit

  • Ankit,

    Thank you for your patience. Mitch is currently out of the office but will reply as soon as he returns Friday.

    Thanks,

    Louis

  • Hey Ankit,

    Here is a timing diagram for the SMBus ALERT that you may find helpful. I got this from the INA226 datasheet, but it should work the same for this device as well:

    I recommend using a scope to confirm that your MCU is sending what is expected. You should be able to send this with normal master mode in the MCU.

    This is what the INA228 datasheet says about the alert line:

    Hopefully this helps, let me know if you have any further questions.

    Regards,

    Mitch