Ping

1. GR551x系列不支持寄存器方式查询复位原因,SDK ≥V1.7.0版本提供如下接口判断是否看门狗复位。但是这个标志在platform_init里面被ll_pwr_clear_wakeup_event(LL_PWR_WKUP_EVENT_ALL)清除了,导致不能判断是否是aon wdt复位,因此需要在清除前保存标志。
/**
* @brief Indicate if the AON WDT Reboot Event Flag is set or not.
* @note This bit is set by hardware when the counter has reached alarm value.
* It can be cleared by writing 0 to this bit.
*
* \rst
* +----------------------+-----------------------------------+
* | Register | BitsName |
* +======================+===================================+
* | SLP_EVENT | SLP_EVENT_WDT |
* +----------------------+-----------------------------------+
* \endrst
*
* @retval State of bit (1 or 0).
*/
__STATIC_INLINE uint32_t ll_aon_wdt_is_active_flag_reboot(void)
{
return (uint32_t)(READ_BITS(AON->SLP_EVENT, AON_SLP_EVENT_WDT_REBOOT) == AON_SLP_EVENT_WDT_REBOOT);
}使用示例如下:
uint32_t wdt_is_active = 0;
void platform_init(void)
{
wdt_is_active = ll_aon_wdt_is_active_flag_reboot();
/* if BLE not fully power off, reset and power off it manually */
if((AON->PWR_RET01 & AON_PWR_REG01_PWR_EN_PD_COMM_TIMER) || \
(AON->PWR_RET01 & AON_PWR_REG01_PWR_EN_PD_COMM_CORE))
......
}2. GR5525/GR5526/GR5332支持寄存器方式查询复位状态,以GR5525为例,参考datasheet 3.4.5.1章节介绍。

目前SDK还未提供对应的API查询复位原因,可以参考如下方法接口:
uint8_t sys_device_reset_season(void)
{
uint8_t reset_season = AON_CTL->DBG_REG_RST_SRC & 0x0F;
if (reset_season)
{
AON_CTL->DBG_REG_RST_SRC = (1 << 24) | (1 << 25) | (1 << 31);
while (AON_CTL->DBG_REG_RST_SRC & (1 << 30));
delay_us(100);
}
AON_CTL->DBG_REG_RST_SRC = (1 << 24) | (1 << 31);
while ((AON_CTL->DBG_REG_RST_SRC & (1 << 30)) || !(AON_CTL->DBG_REG_RST_SRC & ( 1 << 16)));
delay_us(100);
return reset_season;
}PS:GR533x复位原因寄存器参考datasheet 3.4.5.1章节;GR5526x复位原因寄存器参考datasheet 5.5章节介绍。
199***559
测试失败
Mounch
void platform_init(void);请问一下, 是在什么时机被调用的呢?
Ping

1. GR533x操作方法参考: GR533x如何记录和分析复位原因 ,为了防止寄存器被代码清除,建议在gr_soc.c 的soc_init函数里的 platform_init() 之前调用上述复位原因记录函数,把复位原因记录到全局变量。然后在用户main函数里面,可以对复位原因全局变量进行打印输出或存储等,便于后续分析。
2. GR5525/GR5526的部分复位原因存在记录不准问题,包含GR5526的System partial reset,GR5525的System partial reset和System reset(调用系统复位函数NVIC_Systemreset接口);
3. 请勿使用NVIC_SystemReset()函数进行复位,该接口存在复位不完全的问题,需要用SDK封装的hal_nvic_sysytem_reset()接口进行复位,该接口采用AON WDT方式复位;

打开微信,使用“扫一扫”即可关注