cancel
Showing results for 
Search instead for 
Did you mean: 

BlueNRG-2 sleep modes questions

Lenoe
Associate II

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.

  1. Is it true that if I'm not disabling LL advertising the application will chose WAKETIMER instead of NOTIMER sleep mode to hold advertising reports? link: https://www.st.com/content/ccc/resource/technical/document/application_note/group0/17/f2/d8/23/03/01/47/a9/DM00263007/files/DM00263007.pdf/jcr:content/translations/en.DM00263007.pdf
  2. How much time application is needed to turn on LL advertising again by using aci_gap_set_discoverable() function?
  3. Is there any collisions possible when I'm using aci_gap_set_non_discoverable() and BlueNRG_Sleep(SLEEPMODE_NOTIMER...) simultaneously?
  4. Is it possible to send single byte faster than this huge 1s delay after all these operations?

2 REPLIES 2
Lenoe
Associate II

Does anyone know the answers? Any information would be useful!

aahme.4
Associate II

how should i configure the SLEEPMODE_WAKETIMER,so that device wakeup at every 2 sec using HAL_VTimerStart_ms.