Without wiced_bt_stack_init(), this project can switch to SDS mode.
With wiced_bt_stack_init(), this project will switch to SDS mode and restart immediately!
Is the same application is used in WICED?
"Without wiced_bt_stack_init(), this project can switch to SDS mode"
I doubt it's due to the configured advertising interval in wiced_bt_cfg.c. Now the duration is configured to infinite. So the device might not be going to low power state properly.
Generally, WICED_SLEEP_ALLOWED_WITH_SHUTDOWN value is returned by the sleep_permit_handler, the device will enter to Timed-Wake or HIDOff mode. In HID Off everything is OFF and the SRAM is not retained. The only wakeup source is an LHL GPIO interrupt. The device starts executing from reset after wakeup.
Are you sure that the device goes to the sleep mode? Please share if you have any device side trace.
Also, Could you please share a buildable project ? I couldn't test the app by programming it because I got some compile errors.
Thank you so much for your reply!
"microCAM.rar" is "WICED-studio" project. When client device write "SLEEP_SERVER", it can switch into SDS mode, then "WAKEUP_SERVER" can wake it up.
"GATT_server.rar" is modified from "microCAM.rar" for "ModusToolbox". But it can not switch into SDS mode.
"GATT_server.rar" problem has confused me for a long time.
Not sure whether you were able to solve the issue or not.
When I tried GATT_Server code which you have attached in the latest BTSDKv2.8, I couldn't see a restart behavior. Could you please also check with the latest BTSDK? But I saw many Sleep configuration parameters are commented out from the code, which is wrong. Please set the parameters correctly.