Define GPIO when entering sleep mode

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.xmece.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
4 posts / 0 new
Last post
gme_johannes
Offline
Last seen:1 week 1 day ago
加入:2017-12-22 10:09
Define GPIO when entering sleep mode

I am working on the (old) IoT project with SDK 5.160.1.19 (with modified hardware/FW).

I have a blue LED which blinks when it is advertising, pretty much the original code of the IoT project.
Sometimes the LED will stay turned on when the device goes to sleep. I assume it can happen whenwrbl_env.led_tmr_state = 1in this moment. After shaking the sensor (motion wakeup) the LED continues to blink as it should.

I have noticed that there are three callback options when going to sleep:

.app_before_sleep = NULL,
.app_validate_sleep = NULL,
.app_going_to_sleep = NULL,

Which of them should I utilized to make sure the regarding GPIO is in the correct state?
Or is there a different way altogether to achieve this result?

问候
Johannes

Device:
PM_Dialog
Offline
Last seen:3 days 6 hours ago
工作人员
加入:2018-02-08 11:03
Hi gme_johannes,

Hi gme_johannes,

If I am able to understand what you mean from your post, that you would like to accomplish is to blink the LED while the device is in active mode and since the DA14580 goes into sleep the LED should be switched off? And after the wake-up that LED should be in blinking mode. Could you please clarify it in order to provide you the correct steps?

Thanks, PM_Dialog

gme_johannes
Offline
Last seen:1 week 1 day ago
加入:2017-12-22 10:09
Hi PM_Dialog,

Hi PM_Dialog,

want I want to make sure is that the LED, which is blinking in my case (advertisement blinking of the IoT sensor), does not get stuck in the ON state when the device enters sleep mode.
I observe that it sometimes seems to happen (statistically, with a duty factor of 10%, in 10% of the cases...)

问候Johannes

PS: I accidentally set your answer to "Accepted answer"

PM_Dialog
Offline
Last seen:3 days 6 hours ago
工作人员
加入:2018-02-08 11:03
Hi gme_johannes,

Hi gme_johannes,

When the timeout occurs without connection, the function user_app_on_adv_undirect_complete() sets the device in a low power mode, where the CPU is in Sleep mode and the accelerometer in low power anymotion detection mode. If a motion is detected, then the CPU wakes up and starts advertising. This function is called after expiration of the advertising timer. So, a possible solution would be to switch off the LED into the user_app_on_adv_undirect_complete() callback function.

Thanks, PM_Dialog