ZHCAE13A May 2024 – July 2024 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(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);
}
}