CYW20819 Low Power Mode Issue

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
ToKo_4602001
Level 4
Level 4
50 sign-ins 25 replies posted 25 sign-ins

I found that "post_sleep_cback_handler" is not called by BT stack at waking up from LPM at the following condition.

[Condition]

 (1) Have enter CYW20819 into slave state (Inquiry / Page scan enable: ON)

 (2) Permit LPM (Return WICED_SLEEP_ALLOWED_WITHOUT_SHUTDOWN: ePDS)

 (3) A peer device tries to pair --> (Fail: PIN code mismatch, Passkey error)

 (4) A peer device re-tries to pair --> (Success)

 (5) Forbids  LPM (Return WICED_SLEEP_NOT_ALLOWED)

 

With paring operation and WICED_SLEEP_NOT_ALLOWED, CYW20819 must wake up from LPM. But  "post_sleep_cback_handler" is NOT called with "restore_configuration: True".

 

Briefly when re-pairing is performed on LPM state, wake-up callback with "restore_configuration: True" is NOT called.

I re-initialize UART (RTS/CTS) in the callback, so I faced the problem with UART by above issue.

 

Please check this issue.

 

---------------------------------------------

void lpm_init(void){
wiced_result_t ret;
wiced_sleep_config_t lpm_config;

lpm_config.sleep_mode = WICED_SLEEP_MODE_NO_TRANSPORT;
lpm_config.device_wake_mode = WICED_SLEEP_WAKE_ACTIVE_LOW;
lpm_config.device_wake_source = 0;
lpm_config.device_wake_gpio_num = 0;
lpm_config.host_wake_mode = WICED_SLEEP_WAKE_ACTIVE_HIGH;
lpm_config.sleep_permit_handler = lpm_permit_handler;
lpm_config.post_sleep_cback_handler = lpm_post_sleep_callback;

ret = wiced_sleep_configure(&lpm_config);
if(ret != WICED_SUCCESS) while(1);

return;
}

 

void lpm_post_sleep_callback(wiced_bool_t restore_configuration){

if(restore_configuration){
uart_reinit();
wiced_auth_chip_reinit();
}

return;
}

0 Likes
1 Solution
DheerajPK_41
Moderator
Moderator
Moderator
750 replies posted 500 likes received 500 replies posted

Hi,

Could you please share your relevant code/project ?  I would like to know the implementation details and try to reproduce the issue for better understanding.

In ePDS mode, the CYW20819 can wake up either after a programmed period or upon receiving an external event.

Thanks,

-Dheeraj

View solution in original post

0 Likes
3 Replies
DheerajPK_41
Moderator
Moderator
Moderator
750 replies posted 500 likes received 500 replies posted

Hi,

Could you please share your relevant code/project ?  I would like to know the implementation details and try to reproduce the issue for better understanding.

In ePDS mode, the CYW20819 can wake up either after a programmed period or upon receiving an external event.

Thanks,

-Dheeraj

0 Likes

lpm_permit_handler() is here. Simply CYW20819 is permitted to enter into ePDS depending on GPIO status.

----------------------

uint32_t lpm_permit_handler(wiced_sleep_poll_type_t type){
uint32_t ret = WICED_SLEEP_NOT_ALLOWED;
uint32_t running = 0;

if(gpio_in_no_sleep_wake != 0xff){
running = (wiced_hal_gpio_get_pin_input_status(gpio_in_no_sleep_wake) ^ gpio_deepsleep_sw);
}

if(bt_app.bt_status >= STATUS_BT_CONNECTED){
running++;
}

if(!running){
switch(type){
case WICED_SLEEP_POLL_SLEEP_PERMISSION:
ret = WICED_SLEEP_ALLOWED_WITHOUT_SHUTDOWN; //ePDS
break;

case WICED_SLEEP_POLL_TIME_TO_SLEEP:
ret = WICED_SLEEP_MAX_TIME_TO_SLEEP;
break;
}
}

return ret;
}

----------------------

If pairing is performed (Fail --> Success) on the condition that ePDS is permitted, and after that, CYW20819 wake-up internally or by GPIO etc, callback in not generated (and UART hardware flow remains disabled).

Regards,

 

0 Likes
DheerajPK_41
Moderator
Moderator
Moderator
750 replies posted 500 likes received 500 replies posted

please avoid writing more conditions or print statements inside lpm_permit_handler() since it is being called by the stack regularly. I suggest you to check the pin status or other condition outside the lpm_permit_handler() and set a variable which can be checked in the lpm_permit_handler(). 

You can check the low power example from the github. Similar implementation is suggested.

Thanks,

-Dheeraj

0 Likes