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.

TPS65721: Interrupt Operation

Part Number: TPS65721
Other Parts Discussed in Thread: BQ27426, MSP430FR5869

I have a project using the MSP430FR5869 paired with the TPS65721 and BQ27426.  I'm trying to use the ACTIVE and PGOOD interrupts detect when external power is applied or removed so I can update an icon on an attached display.  My program does this:

(1) During initialization, mask all interrupts in IRMASK0, IRMASK1, IRMASK2 except M_CH_ACTIVE and M_CH_PGOOD, and then clear any pending interrupts by reading IR0, IR1, IR2 registers.

(2) When the TPS65721's INT pin goes low, an interrupt in my program sets a flag and does nothing else.

(3) In my program's main loop, if the flag is set, read the CHGSTATUS register, check the CH_PGOOD and CH_ACTIVE flags, then reset the INT pin by reading IR0, IR1, IR2 registers.

Is this the intended implementation of the interrupt pin and registers?  In particular, when should the IR registers be read/reset?

Thanks,

Adam J.

  • Hello Adam,

    I've assigned this post to the appropriate applications engineer, he will respond to your questions.

    Regards,
    Karl
  • Adam,

      Basically, yes your routine is the correct implementation. If a fault occurs, you get an interrupt, you go read the IRQ registers to determine the fault and respond appropriately.

      A few pointers:

    1) It's best not to process code in an interrupt, so setting a flag and then process your interrupt in your code loop is good practice. However, make sure that your loop gives priority to reading the IRQ registers. You may have a severe fault condition, and if you don't respond in a timely manor, you may allow damage that could otherwise be averted.

    2) If you receive an interrupt and read the registers, the interrupt status and potentially the error information could be lost if your unit goes through a reset. The good news is that you are using a Flash based controller. You can write the IRQ register data into memory so that if you reset, you will have a record of the event. If you time stamp the event, you would know that you had a failure, and when. Then when you restart or wake up from a reset, you can read these memory locations to know you are waking up from a fault condition and you can go back and check the IRQ registers to see if the fault still exists.

    3) It's a good idea to check the status of your PMIC once in a while to make sure everything is good. Don't wait on an interrupt to check the registers. As part of your loop add a maintenance check on external hardware. Maybe you can catch, temperatures rising or higher than normal voltages and do something about it.

    4) if you don't have the means to do something about hazardous conditions, ie.turn something off, or disconnect something, shut down charging, log data about the error or sound a beeper or buzzer, then serving an INT wont get you much. 

    Good luck and let me know if you have any other questions.  

  • Gordon,

    Thanks for so much information!  Two more questions:

    (1) In best practice, what IRQ bits should be periodically checked for fault conditions?

    (2) How often do you recommend a periodic status check be done?

    Thanks,

    Adam J.

  • I would greatly appreciate a response to the above two questions.

    Thanks!

    Adam J.
  • Adam,
    my apologies, I did not see your questions come in.

    It's best to monitor IRO, IR1 and IR2 registers. These registers will provide you with status information.

    As for as periodic status checks, it really up to you. You will receive an INT (Interrupt) when there is a problem. The term no news is good news goes a long way here. You can assume that all is well if you don't get an INT. Typically I will verify the registers after boot up, and once I have achieved normal operations, I don't check them. Make sure you always have the INT pin looking for an interrupt from the TPS65721. If you go to a low power mode or Sleep mode, it would be a good idea to check them when you wake up.

    I hope this helps. Let me know if you have anything more.

  • Are there specific bits in the IR0, IR1, IR2 registers that are important to check?

  • Adam,
    All of the bits in these registers tell you what's going on in the part. It's up to you to decide what is important to you. Are you looking for status information that tells you what the part is up to? if so then IRO bits B0-B3, IR1 bits B2-B7 and IR2 bits B1-7.

    If you are only looking for a fault then IRO bits B5-B7, IR1 bits B1-B0. Read the data sheet and understand what the registers are trying to tell you. Then you can decide what you want from the part.

    There is no magic monitoring method. The real question is what are you going to do with this information. Shut something down, if the PMIC doesn't shut you down first? Then look for a fault or reason that you got the interrupt. You might have a few milli-seconds after an interrupt to save information in memory before the energy in the capacitors is gone after a shutdown.
    Maybe you want to report the status to a user, then you might want to tell them everything is good. What if you only want to turn on an indicator to say it's charging. Then you look at the resisters and make sure it's charging and everything is good before turning on the light. You might want to verify that the power is good on the rails before doing a task.

    It's all up to you. Good luck :-)