最近帮客户分析qcc3020的OEM代码发现一个问题:
放入充电盒耳机充满后软件控制进入dormant状态,但此后耳机从充电盒脱离无法唤醒。
从3020的datasheet看到dormant的唤醒条件有:
■ A rising edge on SYS_CTRL
■ A rising edge or a falling edge on VCHG
■ Activity on any PIO[8:1]
■ A timer
■ Digital activity on any LED pad (when configured as digital inputs)
具体的做法是:
power_manager收到charger_manager的CHARGER_MESSAGE_COMPLETED消息后延时一 段时间调用appPowerEnterDormantMode();
有看到appPowerEnterDormantMode()内禁用了充电器appChargerForceDisable(),是否因为它导致了充电脱离无法唤醒耳机?
datasheet上有说明VCHG有电是不能power off的。确实也试过,结果是也是意料中如原厂代码,看到log关机失败:
static bool appPowerDoPowerOff(void)
{
/* Try to power off.*/
PsuConfigure(PSU_ALL, PSU_ENABLE, FALSE);
/* Failed to power off.. */
DEBUG_LOG("Turning off power supplies was ineffective?");
/* No need to disable charger for power down, but if a charger is connected
we want to charge. Check if we failed to power off because charger
detection is not complete */
if (!appChargerDetectionIsPending())
{
/* Fall back to Dormant */
appPowerEnterDormantMode(FALSE);
/* Should never get here...*/
Panic();
}
DEBUG_LOG("Failed to power off because charger detection ongoing. Check charger again later");