2018-11-01 08:54 AM
Hello, frens!
I'm trying to make a BlueNRG-2 application that can send button state just after waking up.
I use this code to manage sleep/wake states:
if(!APP_FLAG(CONNECTED))
{
if(on_sleep_timer == FALSE)
{
Timer_Restart(&t_sleep);
APP_FLAG_SET(SET_CONNECTABLE);
on_sleep_timer = TRUE;
}
else
{
if(Timer_Expired(&t_sleep))
{
if(on_sleep == FALSE)
while(aci_gap_set_non_discoverable()!= 0x00);
on_sleep = TRUE;
BlueNRG_Sleep(SLEEPMODE_NOTIMER, WAKEUP_IO12, WAKEUP_IOx_HIGH << WAKEUP_IO12_SHIFT_MASK);
}
else
{
on_sleep = FALSE;
}
}
}
As you can see, I'm trying to disable LL advertising on device before putting it in NOTIMER sleep mode. And it comes out like wake-up time for this configuration + time for sending button state to a client device is more than one second (the device is configured to send button state byte every 50ms with notifications).
I know that advertising time-outs and scan time-outs are having presense, but it seems to me that I'm doing something wrong and this big timeout to wake-up (200 us in Datasheet) + enabling advertising + sending button state byte is my mistake.
The device is working with 3,3V. If I only switch off advertising the device is able to receive connection from client pretty soon, also if I only put the device into a sleep mode without disabling advertising, it also comes to wake-up state almost simultaneously.
Client device (also BlueNRG-2) is trying to establish connection with server device by
aci_gap_create_connection(0x0040, 0x0040, PUBLIC_ADDR, bdaddr, PUBLIC_ADDR, 40, 40, 0, 60, 50 , 2000) every 40ms.
2018-11-06 12:22 AM
Does anyone know the answers? Any information would be useful!
2019-01-31 04:41 AM
how should i configure the SLEEPMODE_WAKETIMER,so that device wakeup at every 2 sec using HAL_VTimerStart_ms.