sdk app.c user_init_normal 函数如下, 没有改下,最后一行ty_ble_start_adv(); 为广播开启
Code: Select all
void user_init_normal(void)
{
//random number generator must be initiated here( in the beginning of user_init_nromal)
//when deepSleep retention wakeUp, no need initialize again
random_generator_init(); //this is must
/*****************************************************************************************
Note: battery check must do before any flash write/erase operation, cause flash write/erase
under a low or unstable power supply will lead to error flash operation
Some module initialization may involve flash write/erase, include: OTA initialization,
SMP initialization, ..
So these initialization must be done after battery check
*****************************************************************************************/
#if (BATT_CHECK_ENABLE) //battery check must do before OTA relative operation
u8 battery_check_returnVaule = 0;
if(analog_read(USED_DEEP_ANA_REG) & LOW_BATT_FLG){
do{
battery_check_returnVaule = app_battery_power_check(VBAT_ALRAM_THRES_MV + 200); //2.2 V
}while(battery_check_returnVaule);
}
else{
do{
battery_check_returnVaule = app_battery_power_check(VBAT_ALRAM_THRES_MV); //2.0 V
}while(battery_check_returnVaule);
}
#endif
////////////////// BLE stack initialization ////////////////////////////////////
ty_ble_init();
///////////////////// USER application initialization ///////////////////
#if (BLE_MODULE_PM_ENABLE)
blc_ll_initPowerManagement_module(); //pm module: optional
blc_pm_setDeepsleepRetentionType(DEEPSLEEP_MODE_RET_SRAM_LOW32K);
#if (PM_DEEPSLEEP_RETENTION_ENABLE)
bls_pm_setSuspendMask (SUSPEND_ADV | DEEPSLEEP_RETENTION_ADV | SUSPEND_CONN | DEEPSLEEP_RETENTION_CONN);
blc_pm_setDeepsleepRetentionThreshold(95, 95);
blc_pm_setDeepsleepRetentionEarlyWakeupTiming(250);
#else
bls_pm_setSuspendMask (SUSPEND_ADV | SUSPEND_CONN);
#endif
bls_pm_registerFuncBeforeSuspend( &app_suspend_enter );
#else
bls_pm_setSuspendMask (SUSPEND_DISABLE);
#endif
blt_soft_timer_init();
ty_system_init(0);
tuya_ble_sdk_demo_init();
#if TUYA_BLE_SDK_TEST
tuya_ble_sdk_test_init();
#endif
// ty_system_wdt_init();
ty_ble_start_adv(); //开启蓝牙广播
}
ty_system_enter_sleep()函数内容如下,就是要进入深度睡眠的
Code: Select all
uint32_t ty_system_enter_sleep(void)
{
g_system_sleep = true;
cpu_sleep_wakeup(DEEPSLEEP_MODE_RET_SRAM_LOW32K, PM_WAKEUP_PAD, 0);
return 0;
}
但是执行了ty_system_enter_sleep();函数后, 指针并没有指向0; 电流监测有3300uA,
另:有开启本地串口日志;
app_module_busy 函数直接 return 0 也没能进入睡眠,是还有其它因素影响吗?