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.

TWL6032: Can registers be changed during hardware charging?

Part Number: TWL6032

If the PMIC is in hardware charging mode where it's using the default values in the EEPROM, can registers be changed (and used) while remaining in hardware charging mode? In particular I'd like to modify VBAT_FULLCHRG.

On a somewhat related note, can charging continue during the switch between the transition from hardware to software charging? 

  • Hi Robert,

    I've assigned this thread to the relevant device expert.

    Best Regards,
    Rick S.
  • Hi Robert,

    Yes, the values in the registers can be changed once device is in ON state. They are reset each time AC/USB power is lost (to ensure the previous AC/USB settings are not used incorrectly), so they will need to be set each time a AC/USB source is plugged in.

    It doesn't really transition from hardware to software; the difference between AUTOCHARGE = 0 (software) and AUTOCHARGE = 1 (hardware) is that AUTOCHARGE = 0 requires the host processor to micromanage the PMIC for all of the steps in the charging; the PMIC makes no decisions. AUTOCHARGE = 1 means that the PMIC will act more autonomously, starting charging on its own. The host processor can still micromanage, it's just not required. Figure 407 doesn't really make it clear that the processor can still influence the PMIC.
  • Thanks Kevin.

    Would explicitly stopping and restarting USB charging also reset the registers?

    Also do you mind if I email you directly (I've got your info) or would it be preferred that we communicate via E2E?

    Robert

  • Hi Robert,

    Sorry for the delay.

    I'm not sure what you mean by starting / restarting USB charging. For example, are you writing EN_CHARGER bit = 1 and then EN_CHARGER bit = 0 to disable and then writing to 1 again to re-enable? I tried on my EVM and did not see any registers being reset but I don't have a battery here so it may not be behaving exactly like it would in your system.

    Have you tried reproducing on the TWL6032EVM?

    My preference is for E2E; otherwise the communication has to be routed through our field team.
  • Currently we are writing 0 to CONTROLLER_CTRL1 to disable charging, read the battery voltage, and then continue charging by invoking the normal function to start USB charging. This resets the PMIC registers to default values and I've confirmed that the registers stay intact if 0 is never written to CONTROLLER_CTRL1. 

    The code to start USB charging however only executes if not charging, so my experiment also bypasses a number of i2c write commands:

    CHARGERUSB_VICHRG

    CHARGERUSB_CINLIMI

    CHARGERUSB_INT_MASK

    CHARGERUSB_CTRL2

    CONTROLLER_CTRL1

    Is it possible that one of the above commands is causing the PMIC registers to reset?

    I don't have an eval board to try this with.

    Thanks.

  • Hi Robert,

    I don't think I am seeing the same thing on the EVM that you are observing on your board.

    With the following steps I don't see a reset:
    1. Power on PACK+ to 3.7 V
    2. Press pushbutton
    3. Plug in External USB
    4. See 87 mA of charging current (I'm not enumerating so my CIN_LIMIT is 100 mA)
    5. Change DLIN from 01 to 11 and LDO1_CFG_STATE to 0x01 (so that I can confirm it doesn't reset)
    6. Read CONTROLLER_CTRL1 = 0x00
    7. Write CONTROLLER_CTRL1 = 0x00
    8. See Charger turns off, VSYS stays at 3.7 V, same as battery
    9. Write CONTROLLER_CTRL1 = 0x30
    10. Read DLIN and LDO1_CFG_STATE and confirm that they are 0b11 and 0x01 respectively, no reset occurs.
  • Thanks Kevin for checking on your EVM. I'm doing exactly the same thing: write 0x00 to CONTROLLER_CTRL1 to turn off charging, check battery voltage, then 0x30 to turn charging back on. When this happens my PMIC values are reset. Did you ever do any code review with the original authors of our code or is that out of the scope of your support?

  • Kevin,

    Can you try your test with the EVM again but manipulate CHARGERUSB_VOREG and CHARGERUSB_CTRL1 since these are the 2 in particular that are resetting? VBATMIN_HI_THRESHOLD for example doesn't seem to get reset.

    Thanks

  • Hi Robert,

    I can confirm that CHARGERUSB_VOREG is reset but CHARGERUSB_CTRL1 seems to stay the same for me, at least when I set HZ_MODE for example.

    Would setting HZ_MODE instead of disabling the charger work for this case? I can confirm that going into and out of HZ_MODE does not reset CHARGERUSB_VOREG.

    Regarding software review, it was historically handled by the processor team but due to the age of this processor it is likely not still being supported by them. I can look over the charger related software if you can provide something low level to me (I'm an analog engineer) but hopefully the above can work instead.

  • Kevin,

    I'm also an analog engineer hence the request for code review lol (programmed lots in high school and college but that was a long time ago). But perhaps HZ_MODE will work if it's equivalent to adding a big series resistor to the battery path. I'll try it tomorrow.

    Thanks!

  • Kevin,

    Can you confirm which pin goes high Z when invoking HZ_MODE? Is it CHRG_VBAT?

    Thanks.

  • Hi Robert,

    HZ_MODE disables Q2 in Figure 4-6 to OFF, disconnecting VBUS from the circuit. This will make VSYS = VBAT; which may or may not be what you are looking for. If your VBAT is not able to stay above VSYSMIN_LO then the part will shut off for example.

    Disabling the linear charger (EN_LINCH) was the only way I saw to disable S1 (connection between battery and VSYS) and toggling this bit causes the VOREG register reset. Generally, the following are:

    CHRGUSB_VICHRG_PC;

    CONTROLLER_CTRL1 (5);

    CONTROLLER_WDG (6 downto 0);

    CHRGUSB_CTRL2 (7 downto 5);

    CHRGUSB_VOREG (5 downto 0);

    CHRGUSB_VICHRG (3 downto 0);

    If setting EN_CHARGER to 0 instead, it resets the above plus:

    CHRGUSB_VSYSREG;

    CONTROLLER_CTRL1 (4 downto 3);

    CHRGUSB_CTRL1(4);

    CHRGUSB_CTRL3(0);

    CHRGUSB_CTRL3(1);

    CHRGUSB_CTRL3(2);

    CHRGUSB_CTRL3(6);

    CHRGUSB_CINLIMIT (5 downto 0);

    ANTCOLAPSE_CTRL1;

    Hopefully that helps.

  • Kevin,

    HZ_MODE has solved my issue of resetting PMIC registers. I'm now able to terminate the charge properly allowing the battery to charge higher than 4.08V. It's OK that VSYS=VBAT when HZ_MODE=1 since that's the behavior I was getting previously when setting CHARGERUSB_CTRL1 to 0x0.

    Is the GAS GAUGE the standard way to measure charge capacity/progress? The code currently reports zero for charge current, which perhaps is the reason the original authors are using battery voltage instead.

    Robert

  • Hi Robert,

    Good to hear the HZ_MODE worked for you.

    I've just sent you the App note we have describing how the Gas Gauging is supposed to work. I have not had to work with the gauging before; but if you come up with questions I can try to work through them with you.