Hi dialog
I am working on custom board based on DA1468x i am using command
pm_resume_sleep();
pm_set_sleep_mode(pm_mode_hibernation);
让它冬眠。它进入休眠和唤醒与外部GPIO中断,但唤醒2次后,它不进入休眠。
休眠模式是将设备运送给客户的,这与此逻辑有关吗。当客户在设备上时,那么这段代码是否被禁用?
我的理解正确吗?
Device:
你好,mahmed106,
Can you please indicate where you are using the pm_resume_sleep() and the pm_set_sleep_mode() APIs? In order to put the device in hibernation mode, you should use the pm_set_sleep_mode(pm_mode_hibernation). Be aware that hibernation mode is a special mode to be used for shipping the final product to market without draining the battery. This is what is used for shipping and storing the final product and I would not recommend you the hibernation for development or debugging scopes. So, if your product is not for shipping, g I would suggest you to use the sleep mode as extended sleep into the system_init() and the reason is that when the system wakes up from the hibernation, the system resets and runs from the start. This is not a software reset, it’s like a hardware reset, so the system will run the code from the start and the system_init() will be executed again (every time that the 680 wakes up from the hibernation. Also, the pm_resume_sleep will Restore the sleep mode of the system, which has been blocked via a call to pm_stay_alive()If you could provide more inputs regarding this issue, it would be very helpful.
谢谢,下午好
我知道休眠是为了生产运输的目的,但我想在我的设备中添加一个功能,当电池达到一定电压时将其休眠,然后在连接充电器时将其唤醒,这可以通过GPIO进行检测。
我只想要实现这个的方法。
Thanks
你好,mahmed106,
Can you please indicate where in you code you are using the pm_set_sleep_mode(pm_mode_hibernation)? As you mentioned in your initial post, the device can enter the hibernation mode. But what is happening after the 2 wakes up? Can you please provide me some extra inputs?
谢谢,下午好
我使用pxp_reporter和后进入pxp_reporter task ,, i check the VBAT voltage using ADC and then i use these two commands.
pm_resume_sleep();
pm_set_sleep_mode(pm_mode_hibernation);
我要问的是进入休眠模式需要满足两个条件
1-系统必须进入睡眠模式
2-VBAT必须低于dg\配置电池\低\电平
?
你好,mahmed106,
由于您在设计中使用电池,如果电压下溢,系统将自动进入休眠模式。查看SDK,它是唯一一个监视连接的电池电压水平的地方,位于sys\u power\u mgr.c文件中的apply\u wifi()例程中。请搜索“电压下溢检查”注释。如果电池电压过低(在dg\ U configBATTERY\ U low\级别下),usb\ U charger\ U is\ U battery\ U low()将返回true。为此,如果low\u vbat为真,则当前睡眠模式将更改为休眠。查看FreeRTOSConfig.h文件,configPRE\u STOP\u PROCESSING()宏为空,因此您可以在此处挂接自己的功能。为了声明钩子函数,请检查以下实现:
在custom_config_qspi.h文件中,声明电池电压阈值以及电池类型:
#define dg_configBATTERY_LOW_LEVEL(4000)//将阈值设置为更高的电源
#define dg_configBATTERY_TYPE (BATTERY_TYPE_CUSTOM)
在FreeRTOSConfig.h文件中声明钩子函数。例如:
#define configPRE_STOP_PROCESSING( x ) my_custom_callback_low_battery( x )
在您选择的文件中,例如main.c中,声明钩子函数。
在sys\u power\u mgr.c文件中的apply\u wifi()例程中,相应地修改configPRE\u STOP\u PROCESSING宏:
如果(睡眠周期==0){
// A user definable macro that allows application code to be added.
configPRE_STOP_PROCESSING(pm_current_sleep_mode);//把你选择的论点传过来
}其他{
// A user definable macro that allows application code to be added.
configPRE_SLEEP_PROCESSING( sleep_period );
}
The condition (vbat_level < dg_configBATTERY_LOW_LEVEL) is true and thus, the device enters hibernation mode. Please note that there should not be any charger plugged-in (on VBUS) in order for the device to enter hibernation mode. If you are using the hibernation mode by yourself, if you have BLE activity or any other pending interrupts, the system will not be able to go into hibernation.
谢谢,下午好
Thanks alot dialog.
I ll implement it , if any problem comes i ll reply to this post.
我试过上述方法,但system is not entering sleep.
所以我所做的是,我用了这段代码,每6秒检查一次VBAT,如果VBAT低于建议的电压。它进入睡眠状态。
这个方法的问题是我需要等待2-3秒才能将系统置于休眠状态,否则它将进入休眠状态并重新启动。
g_VBAT_check_counter++;
如果(g\u VBAT\u check\u counter>=10)
{
battery_source bat=ad_battery_open();
raw_vbat=ad_battery_raw_to_mvolt(bat,ad_battery_read(bat));
如果(原始值<=3000)
{
printf(“\nHibernating\n”);
fflush(stdout);
系统看门狗通知(wdog id);
OS_DELAY_MS(2000);//做任何事都可以得到自由
pm_resume_sleep();
pm_set_sleep_mode(pm_mode_hibernation);
}
g_VBAT_check_counter=0;
}
你好,mahmed106,
你能每6秒取下一次电池读数,然后再次测试以上的实现吗?默认情况下,在apply\u wfi()中,电压下溢检查将关闭。您使用的是哪个SDK?
谢谢,下午好
你好,mahmed106,
你能每6秒取下一次电池读数,然后再次测试以上的实现吗?默认情况下,在apply\u wfi()中,电压下溢检查将关闭。
谢谢,下午好
Yes i have tested this and now it is working perfectly.
Thanks dialog
你好,mahmed106,
很高兴所提供的实现正在工作,并感谢您接受我的回答。
谢谢,下午好
我还有一个问题with any approach, DA14681 goes into hibernation and stay in hibernation if it has been in normal for loop of PXP Reporter. Before that loop at startup while entering 1st time in PXP reporter, if i try to make it hibernate, It hibernates and then restarts again. Do know the reason of this,
PXP Reporter与示例FW中的相同。我正在使用该项目作为我的项目的基础项目。
你好,mahmed106,
你能澄清一下你所说的“PXP Reporter的正常循环”是什么意思吗?
谢谢,下午好
在pxp\u任务函数中
对于(;;)
This is the main loop which i am talking about
你好,mahmed106,
I assume the you are putting explicitly the DA14681 and the pm_set_sleep_mode(pm_mode_hibernation) is called out of mail loop. I f yes, can you please indicate where are you using this API? Probably the system cannot hibernate due to a pending interrupt.
谢谢,下午好