I have an ZigBee End Device which should wake up when the button is pressed.
The problem is, that when the button is pressed it takes sometimes up to 6 seconds before the device is active. I have checked it on the scope.
I have the following code:
in app_cfg.h
#define BUTTON1 GPIO_PD2 //P16 pin 24
#define PD2_FUNC AS_GPIO
#define PD2_OUTPUT_ENABLE 0
#define PD2_INPUT_ENABLE 1
#define PULL_WAKEUP_SRC_PD2 PM_PIN_PULLUP_1M //PM_PIN_PULLUP_10K
#define PM_WAKEUP_LEVEL PM_WAKEUP_LEVEL_LOW
in app_main.c
#if PM_ENABLE
/**
* @brief Definition for wakeup source and level for PM
*/
drv_pm_pinCfg_t g_sensorPmCfg[] = { {BUTTON1, PM_WAKEUP_LEVEL} };
#endif
void app_task(void){
app_key_handler();
...
if(bdb_isIdle()){
report_handler();
#if PM_ENABLE
drv_pm_lowPowerEnter();
#endif
}
void user_init(bool isRetention){
#if PM_ENABLE
drv_pm_wakeupPinConfig(g_sensorPmCfg, sizeof(g_sensorPmCfg)/sizeof(drv_pm_pinCfg_t));
#endif
...
}
I had the same code before with the door sensor and it has been working fine.
When I disable PM there is no delay, so it is definitely something to do with sleep mode.
I enter the correct code but it tells me it is incorrect. I have tried multiple of times. I can't make a post
Could you fix this. It is annoying.
|