7 Replies Latest reply on Jul 30, 2018 6:16 AM by psyu

    Bless Sleep and Stop Advertising

    dimasidi

      Trying to do this :

       

      CyBle_GappStopAdvertisement();

       

      and than sending pump to deep sleep:

       

      CYBLE_LP_MODE_T sleepMode = CyBle_EnterLPM(CYBLE_BLESS_DEEPSLEEP);

       

      but pump won't go t sleep (sleep state and ble state are not DEPP_SLEEP)

       

      when removing the stop advertising function works well.

       

      How can i work with both functions? 

        • 1. Re: Bless Sleep and Stop Advertising
          psyu

          Hello,

           

          Please share the project we will look and see the issue.

           

          Thanks,

          PSYU.

          • 2. Re: Bless Sleep and Stop Advertising
            dimasidi

            Unfortunately i cannot post my full project here.

             

            i can specify my sleep function :

             

                            CyBle_GappStopAdvertisement();

                                   

                    CyBle_ProcessEvents();                      // service BLE stack events

                    CyBle_EnterLPM(CYBLE_BLESS_DEEPSLEEP);      // put BLESS into lowest power mode

                  

                    intrStatus = CyEnterCriticalSection();      // disable interrupts

                    blessState = CyBle_GetBleSsState();         // get current BLESS state

                    iprintf("BLE_STATE: %d, CPU_STATE: %d");

                    CySysPmDeepSleep();

                    CyExitCriticalSection(intrStatus);          // re-enable interrupts

                   

                    CyBle_ExitLPM();

                   

                    CyBle_GappStartAdvertisement();

                    // SEND SOME STUFF.

             

            Also see CYBLE_EVT_HCI_STATUS.

             

            • 3. Re: Bless Sleep and Stop Advertising
              psyu

              Hello,

               

              The BLESS system can be wakeup from Deep Sleep mode whenever BLE events (advertisement/connection events) are generated. We generally put the BLESS system into Deep Sleep mode between these advertisement/connection events. These events are responsible for waking the BLESS from Deep Sleep and further this BLESS interrupt will wakeup the CPU from Deep Sleep mode. Please refer the section A.1 Current profile in these document for more information.

              This may be the case if we stop advertising before entering into the Deep Sleep mode (where there is not having any other interrupt or connection events to wakeup) may not go into Deep Sleep mode.

               

               

              Thanks,

              PSYU.

              • 4. Re: Bless Sleep and Stop Advertising
                dimasidi

                Can you please specify a set of commands for BLE, before sleep,

                that will enable me going to sleep, and waking up Only by a WTD interrupt?

                No advertising or any other BLE interrupts.

                Pure WDT wakeup, and continue BLE from there.

                 

                Thanks!

                • 5. Re: Bless Sleep and Stop Advertising
                  psyu

                  Hello,

                   

                  Can you please tell me up to how much time you need to advertise and after that stop advertising. And also the time you need to stop advertise.

                   

                  Thanks,

                  PSYU.

                  • 6. Re: Bless Sleep and Stop Advertising
                    dimasidi

                    i am using  a 1 second interval in my system.   i want  to send a packet, go to sleep for the rest of the time, knowing nothing will wake me up until the next second.

                     

                    Trying hard to make this happen:

                     

                    (1) Do stuff.. ( system can be advertising during this period)

                    (2) Send 1 packet over BLE, make sure it arrived. - (even better)

                     

                    (3) Stop advertising, Send BLE to Sleep.

                     

                    (4) Deep Sleep of system without waking up for anything. (as much sleep time as possible ~1 sec)

                    (5) wake up only by WDT after 1 second passed.  and go to (1) again....

                     

                    * can either advertise while (1) or just send a packet during (2), one of them  happening is just fine.

                    • 7. Re: Bless Sleep and Stop Advertising
                      psyu

                      Hello,

                       

                      Please refer the attached project where BLE enters into the Deep Sleep mode after stopping the advertisement and WDT interrupt will enable the system and starts advertising. You can see the code flow in the TERA_TERM where UART is used for printing the statements.

                      BLE interrupt priority should be 0 and wdt interrupt priority is 1.

                       

                      Please let me know if this helps you.

                       

                      Thanks,

                      PSYU.