ZHCAE13B May 2024 – April 2025 TPS2HCS10-Q1
低功耗模式示例展示了如何将 HCS 高侧开关设置为低功耗模式,然后在发生故障事件时唤醒。要使用此示例,在将代码下载到微控制器之前,在通道 1 上设置一个负载,该负载消耗的电流低于 800mA(我们使用 HCS_gotoSleep 将 LPM 退出电流设置为此值)。下载代码示例之后,将负载电流增加到大于 800mA。这可能导致 LPM 退出,触发 FAULT 引脚,并使微控制器中断或处理此事件。相关的应用程序代码如下所示:
while(1)
{
/* Putting the device into LPM. 800mA exit current on CH1 */
HCS_gotoLPM(man_lpm_exit_curr_ch1_en_800mA_mask,
man_lpm_exit_curr_ch2_en_800mA_mask,
0);
/* Wait for the fault line to trigger low on PB3 */
__WFI();
/* If waking up from the interrupt, then check to make sure a signal was
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(TPS2HCSXX_FLT_STAT_CH1_REG,
¤tValue);
resCode.byte |= HCS_readRegister(TPS2HCSXX_FLT_STAT_CH1_REG,
¤tValue).byte;
if(currentValue & TPS2HCSXX_FLT_STAT_CH1_LPM_WAKE_CH1_MASK)
{
/* Set a breakpoint here for demonstration */
asm ("nop");
}
}