SLVAFT2A May 2024 – July 2024 TPS2HCS10-Q1
The low-power mode example shows how to set the HCS high-side switch into low-power mode and then wake up on a fault event. To use this example, before downloading the code to your microcontroller set a load on channel 1 that consumes less that 800mA of current (what we set the LPM exit current to using HCS_gotoSleep. Once the code example has been downloaded, increase the load current to greater than 800mA. This can cause the LPM to exit, the FAULT pin to trigger, and for the microcontroller to interrupt/handle the event. The relevant application code can be seen below:
while(1)
{
/* Putting the device into LPM. 800mA exit current on CH1 */
HCS_gotoLPM(lpm_exit_curr_ch1_en_2_0x1, lpm_exit_curr_ch2_en_1_0x0);
/* Wait for the fault line to trigger low on PB3 */
__WFI();
/* If we woke up from the interrupt, check to make sure it was a signal
for an LPM wakeup. The idea here is that the user increases the
load current somehow to "force the device" from LPM. */
resCode = HCS_readRegister(TPS2HC10S_FLT_STAT_CH1_REG,
¤tValue);
resCode.byte |= HCS_readRegister(TPS2HC10S_FLT_STAT_CH1_REG,
¤tValue).byte;
if(currentValue & TPS2HC10S_FLT_STAT_CH1_LPM_WAKE_CH1_MASK)
{
/* Set a breakpoint here for demonstration */
asm ("nop");
}
if(resCode.byte != 0)
{
handleError(resCode);
}
}