主题中讨论的其他器件:SysConfig、 TPS65224-Q1
工具与软件:
我要使用的 SDK 是 mcu_plus_sdk_am62px_10_00_00_14
我们使用的是一个定制电路板、其中我们连接了2个 I2C、一个是 MCU_I2C0、另一个是 WKUP_I2C0。
请参阅下图以供参考:

我使用的示例是 "PMIC_QA_WATCHDOG_RESET"。
我已修改 PMICApp_wdogQAModeReset。
static int32_t PMICApp_wdogQAModeReset(PMIC_Config pmicConfig)
{
int32_t status = PMIC_ST_SUCCESS;
int32_t retVal = SystemP_FAILURE;
uint16_t numSeqeunces = 0;
uint8_t answerCnt = 0;
bool wdgEnabled = false;
Pmic_CoreHandle_t *coreHandle = pmicConfig.pmicCoreHandle;
Pmic_WdgCfg_t tmpWdgCfg;
status = Pmic_wdgGetEnableState(coreHandle, &wdgEnabled);
status = Pmic_wdgDisable(coreHandle);
if(SystemP_SUCCESS == status)
{
DebugP_log("Watchdog disabled successfully!!\r\n");
}
else
{
DebugP_logError ("Watchdog disable failed!!\r\n");
}
status = Pmic_wdgGetEnableState(coreHandle, &wdgEnabled);
/* if (status == PMIC_ST_SUCCESS && !wdgEnabled)
{
// status = Pmic_wdgEnable(coreHandle);
// DebugP_log("Watchdog enabled successfully!!\r\n");
}*/
if(status == PMIC_ST_SUCCESS)
{
/* Configure watchdog for Q&A mode */
status = Pmic_wdgSetCfg(coreHandle, &gPmicWdgCfg[CONFIG_PMIC0]);
/* Clear all interrupts */
status += Pmic_irqClrErrStatus(coreHandle, PMIC_IRQ_ALL);
}
if(status == PMIC_ST_SUCCESS)
{
DebugP_log("Configure PMIC watchdog in Q&A mode... DONE \r\n");
/* Begin watchdog Q&A sequence */
status = Pmic_wdgBeginSequences(coreHandle, pmicConfig.wdogMode);
if(status == PMIC_ST_SUCCESS)
{
/* Exit Long Window */
for (answerCnt = 4; answerCnt != 0; answerCnt--)
{
status = Pmic_wdgQaSequenceWriteAnswer(coreHandle);
if(status != PMIC_ST_SUCCESS)
{
break;
}
/* This check is not required in the actual application. This is to detect
* watchdog errors if any, when changing the sysconfig watchdog configuration
* during development.
*/
PMICApp_checkForWdgErrors(coreHandle);
}
if(status == PMIC_ST_SUCCESS)
{
DebugP_log("Started watchdog sequence... Sending answers to the PMIC... \r\n");
/* Send watchdog answers for some iterations */
for (numSeqeunces = 40; numSeqeunces != 0; numSeqeunces--)
{
/* Enter Window-1 to write Answer-3, Answer-2, and Answer-1 */
for (answerCnt = 3; answerCnt >= 1; answerCnt--)
{
status = Pmic_wdgQaSequenceWriteAnswer(coreHandle);
if(status != PMIC_ST_SUCCESS)
{
break;
}
/* This check is not required in the actual application. This is to detect
* watchdog errors, if any when changing the sysconfig watchdog configuration
* during development.
*/
PMICApp_checkForWdgErrors(coreHandle);
}
if(status == PMIC_ST_SUCCESS)
{
/* Wait until Window-1 time elapses */
ClockP_usleep(gPmicWdgCfg[CONFIG_PMIC0].win1Duration_us + ClockP_ticksToUsec(1));
/* Enter Window-2; calculate and send last answer byte */
status = Pmic_wdgQaSequenceWriteAnswer(coreHandle);
/* This check is not required in the actual application. This is to detect
* watchdog errors, if any when changing the sysconfig watchdog configuration
* during development.
*/
PMICApp_checkForWdgErrors(coreHandle);
}
if(status != PMIC_ST_SUCCESS)
{
break;
}
}
}
}
}
if(status == PMIC_ST_SUCCESS)
{
DebugP_log("Stopped sending watchdog answers... Waiting for the warm reset to occur... \r\n");
/* Warm reset trigger time depends on threshold value configured in the sysconfig. Waiting for
* watchdog failure to exceed fail and reset threshold values for the warm reset to occur.
*/
ClockP_usleep((gPmicWdgCfg[CONFIG_PMIC0].failThreshold + gPmicWdgCfg[CONFIG_PMIC0].rstThreshold + 1U) * \
(gPmicWdgCfg[CONFIG_PMIC0].win1Duration_us + \
gPmicWdgCfg[CONFIG_PMIC0].win2Duration_us + \
ClockP_ticksToUsec(1)));
/* Warm reset should occur and program should not reach this point. */
DebugP_log("Warm reset is not triggered.. Watchdog reset failed !! \r\n");
/* Set return to long window */
tmpWdgCfg.validParams = PMIC_CFG_WDG_RETLONGWIN_VALID_SHIFT;
tmpWdgCfg.retLongWin = true;
status = Pmic_wdgSetCfg(coreHandle, &tmpWdgCfg);
if(status == PMIC_ST_SUCCESS)
{
/* Wait for current watchdog sequence to end and enter long window */
ClockP_usleep(gPmicWdgCfg[CONFIG_PMIC0].win1Duration_us + \
gPmicWdgCfg[CONFIG_PMIC0].win2Duration_us + \
ClockP_ticksToUsec(1));
/* Set the PWRHOLD, so watchdog remains in long window */
tmpWdgCfg.validParams = PMIC_CFG_WDG_PWRHOLD_VALID_SHIFT;
tmpWdgCfg.pwrHold = true;
status = Pmic_wdgSetCfg(coreHandle, &tmpWdgCfg);
}
}
DebugP_logError("PMIC Q&A watchdog reset mode test... Failed !!\r\n");
return retVal;
}
编译并运行代码后、我将得到以下输出。
正在启动 Q&A 看门狗复位示例!!
根据通信模式为 Q&A 看门狗配置 PMIC GPIO 引脚... 停止更新的
看门狗禁用成功!!
在 Q&A 模式下配置 PMIC 看门狗... 停止更新的
错误:PMICApp_wdogQAmodeReset:337:PMIC Q&A 看门狗复位模式测试... 失败!!
错误:PMIC_QA_WATCHDOG_RESET_MAIN:143:某些测试失败!
没有手表被禁用并且 MCU 在一段时间后被复位。
您能帮助解决这个问题吗?






