1 2 Previous Next 18 Replies Latest reply on Oct 12, 2016 11:24 PM by chaplin.u_1533771

    exit from DEEPSLEEP


      in http://www.cypress.com/go/AN92584 I read this :


      The BLESS DEEPSLEEP and SLEEP modes are entered under application control. The exit may be initiated in one of two ways:
      o The application calls the CyBle_EnterLPM() function with the input parameter as ACTIVE.


      I can`t find ANY example of calls the CyBle_EnterLPM() function with the input parameter as ACTIVE.


      Please help.

        • 1. Re: exit from DEEPSLEEP

          Open the BLE datasheet and search for CyBle_EnterLPM.





          • 2. Re: exit from DEEPSLEEP

            Sorry about my mistake ( I`m not make this word big enough) EXAMPLE of code.

            • 3. Re: exit from DEEPSLEEP

              I should put on my glasses ;-)





              • 4. Re: exit from DEEPSLEEP

                I think this program covers this.

                • 5. Re: exit from DEEPSLEEP

                  Here are the programs for the App note.


                  I did notice that they don't have the code for this issue.

                  • 6. Re: exit from DEEPSLEEP

                    In all examples you provided I can`t find CyBle_EnterLPM() function with the input parameter as ACTIVE.


                    Why you provided it ? I have 100 examples without it ...

                    • 7. Re: exit from DEEPSLEEP
                              Low power startup program has this function I checked for it. Did you look at the Ble API spec's it should be in it.   
                      • 8. Re: exit from DEEPSLEEP

                        This function requests the underlying BLE modules such as BLE Controller, BLE Host Stack and BLE Stack manger to enter into one of the supported low power modes. Application should use this function to put Bluetooth Low Energy Sub-System (BLESS) to Low Power Mode (LPM).


                        BLE Stack enters and exits low power modes based on its current state and hence the application should consider the BLE Stack LPM state before putting the CPU or the overall device into LPM. This function attempts to set the requested low power mode and if that is not possible, it tries to set the next higher low-power-mode. This behavior is due to the requirement that the application will always try to use the lowest power mode when there is nothing that it needs to process. Note that the CPU will not be able to access the BLESS registers when BLESS is in deep sleep mode.


                        BLE Stack has the following power modes:


                        Sleep (Low Power Mode)
                        DeepSleep with ECO Off (Low Power Mode)
                        Hibernate (Low Power Mode)


                        Note that certain conditions may prevent BLE sub system from entering a particular low power mode.


                        Active Mode


                        Bluetooth Low Energy Sub System (BLESS) has three sub-modes in Active mode:


                        Transmit Mode, and
                        Receive Mode


                        These modes draw full current from the device and the CPU has full access to its registers.


                        Sleep Mode


                        The clock to the link layer engine and digital modem is gated and the (External Crystal Oscillator) ECO continues to run to maintain the link layer timing. The application cannot enter sleep mode if a Transmit or Receive is in progress.


                        Deep Sleep with ECO Off Mode


                        The ECO is stopped and Watch Crystal Oscillator (WCO) is used to maintain link layer timing. All the regulators in the Radio Frequency (RF) transceiver are turned off to reduce leakage current and BLESS logic is kept powered ON from the System Resources Sub System (SRSS) deep-sleep regulator for retention of current BLESS state information. This mode can be entered from either Idle (Active) or Sleep mode. It should be entered when the next scheduled activity instant in time domain is greater than the Deep Sleep total wakeup time (typically 2ms).


                        NOTE: If application is using ECO as source of HFCLK for higher clock accuracy and calls this API to move BLESS to Deep Sleep mode then HFCLK accuracy and frequency would be impacted as this API switches HFCLK source from ECO to IMO. On BLESS wakeup, the HFCLK source would be switched back to ECO.


                        Recommendation is that application turns on IMO and sets it as HFCLK source before calling this API. Upon wakeup due to sources other than BLESS, application can turn on ECO and switch HFCLK source to ECO. Pseudo code of recommendation is given below.


                        Pseudo Code: //Turn on IMO and switch HFCLK to IMO CyBle_EnterLPM(CYBLE_BLESS_DEEPSLEEP); CySysPmDeepSleep(); //If exit is not due to BLE and application need to use ECO //then turn on ECO and switch HFCLK source to ECO.


                        Hibernate mode


                        The application layer should invoke this function with the Hibernate Mode option to put the BLE Stack in to hibernate mode. If this mode is set, the micro-controller can be put in to Hibernate Mode by the application layer. This mode ensures that BLE Sub-system is completely idle and no procedures such ADV, SCAN and CONNECTION are active.


                        The following table indicates the allowed sleep modes for the complete system (BLE Sub-system and the micro-controller). Modes marked In 'X' are the allowed combinations. The application layer should make sure that the invalid modes are not entered in to:


                        BLE Stack LPM / PSoC4A-BLE LPM Active Sleep DeepSleep Hibernate
                        Active X

                        Sleep X X

                        DeepSleep (ECO OFF) X X X



                        The application layer is responsible for putting the BLE Sub-system and the micro-controller in to the desired sleep modes. Upon entering the requested sleep mode combination, the BLE Sub-system and the micro-controller are woken up by an interrupt every advertisement interval(in case of a GAP Peripheral) or connection interval (in case of GAP Central). On wakeup, if the application needs to transmit some data, appropriate function(s) including the Stack functions need to be invoked. This needs to be followed by a call to the function CyBle_ProcessEvents, which handles all pending transmit and receive operations. The application can now put the complete system back in to one of the sleep modes. The application should ensure that the above invalid states are never encountered.


                        Application shall also ensure that BLE Sub-system's low power entry and low power exit interrupts are processed in realtime and not blocked. It is recommended that BLE Sub-system interrupt should be of higher priority. If BLE Sub-system interrupts are blocked for longer time ( > 200us ), BLE Sub-system can violate Bluetooth specification timing for wakeup where ECO is required to perform BLE radio operation. It can also result in race condition where BLE Stack waits for interrupt as ECO is not started correctly and BLE Sub system enters in unknown state, BLE Stack gets stuck in busy loop.


                        This is a blocking function. In process of entering in BLESS Deep Sleep Mode, BLE Stack puts CPU in Sleep Mode to save power while polling for entry indication to BLESS DSM. No event is generated on calling this function. Based on the return code from this function, the application layer should decide on the sleep mode for the complete system. For example, if the return code is CYBLE_BLESS_DEEPSLEEP, the application can choose to call system wide DeepSleep mode function.




                        pwrMode The power mode that the component is intended to enter. The allowed values are,




                        CYBLE_LP_MODE_T: The actual power mode that BLE stack is now set to.

                        • 9. Re: exit from DEEPSLEEP

                          I don`t understand why you do it. I can read manuals and I placed link to excellent doc with code snippets. But in all manuals and documents and examples not exist ANY code snippet for using this call. 


                          Please don`t send spam.

                          • 10. Re: exit from DEEPSLEEP

                            I opened a support  case with Cypress on your issue and will get back with you when they respond.

                            • 11. Re: exit from DEEPSLEEP

                              Thanks ! This is really help.

                              • 12. Re: exit from DEEPSLEEP

                                Chaplin: Here is Cypress's answer to your issue.


                                Hi Robert,

                                Few things that I can tell you:
                                1) CyBle_EnterLPM(CYBLE_BLESS_ACTIVE) is used under 2 scenarios:
                                a) Writing to FLASH: The BLESS interrupts are disabled and BLESS is put into LPM before starting write to FLASH. After write is complete, BLESS is woken up by CyBle_EnterLPM(CYBLE_BLESS_ACTIVE).
                                b) Reading Link Layer registers: You will be able to access Link Layer registers only when BLESS is active. So if the BLESS is in LPM, we use the CyBle_EnterLPM(CYBLE_BLESS_ACTIVE) API to wake it up and then read the LL registers.

                                2) It is better to you use CyBle_ExitLPM() over CyBle_EnterLPM(CYBLE_BLESS_ACTIVE).

                                3) I don't think there are examples for these.


                                I had him check on item 3 here is his answer.


                                We do not have any examples to demonstrate what I had told you.


                                I hope this helps you.

                                • 13. Re: exit from DEEPSLEEP

                                  Hm, not so good news. How can I create something if even Cypress don`t checked it. 


                                  Can you ask to check CyBle_ExitLPM()  ( if it`s better) functionality ?


                                  They have experts and professional programmers to do this.


                                  And will be very help if they can create some example like LED ON/OFF .  Go to SLEEP and after some delay Wake-Up.

                                  • 14. Re: exit from DEEPSLEEP

                                    Chaplin: Here are two examples that Cypress has made for you I hope this helps.

                                    1 2 Previous Next