Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Dirk_6716
Level 2
Level 2
10 sign-ins 10 replies posted 10 questions asked

while(1)

    {

        BLE_Run();

        BLE_ManagePower();

        if(Application_GetPowerState() == ACTIVE)

        {

            Application_Run();           

        }

        Application_ManagePower();  

        System_ManagePower();       

    } /* End of while(1) */

Hello,

    Above seems to be a generic main loop that can be used for low power ble applications. It works fine when the Application_Run(); function is quick and shorter than the BLE connection interval. After the quick application, the processor can go into deepsleep until the next connection. However, my application will run for up to two minutes and I don't need any BLE events to occur during the application.

Initially, I wanted to update the connection parameters such that I could skip connection events during the application. However, it seems the maximum connection timeout is 32s and I don't want disconnection.

If a connection occurs during my application, I assume my application would be halted for a few milliseconds and then resume after the connection. How would I put BLESS back into deepsleep after connection during the middle of my application? The 2 minute application is not a repetitive loop timed according to each connection event, so I cannot call Cybleprocessevents() and call CyBle_EnterLPM(CYBLE_BLESS_DEEPSLEEP) repetitively. Is there a way to call Cybleprocessevents() and call CyBle_EnterLPM(CYBLE_BLESS_DEEPSLEEP) every connection cycle?

I assume a can use a bless_interrupt callback function to call Cybleprocessevents() right before the connection. However, How would I put BLESS into deepsleep after connection.

Thanks!

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.
VenkataD_41
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hi,

Please note that the current consumption for BLE will be very less when you set the connection interval to be high. However, to answer to your query:

>> "Is there a way to call Cybleprocessevents() and call CyBle_EnterLPM(CYBLE_BLESS_DEEPSLEEP) every connection cycle?"

--> You can use the "pendsv" interrupt handler to process the events and put the BLE subsystem back to sleep.

Fo this you have to pend the pendsv interrupt in the BLE isr callback.

The attached code snippet might help you. Please check.

For more information about pendsv interrupt please refer the ARM cortex M0 generic user guide from the link below:

http://infocenter.arm.com/help/topic/com.arm.doc.dui0497a/DUI0497A_cortex_m0_r0p0_generic_ug.pdf

We hope this helps, please update for more queries.

Thanks

Ganesh

View solution in original post

3 Replies