1 Reply Latest reply on Jun 2, 2017 7:59 AM by e.pratt_1639216

    problem (deep) sleeping when connected to bluetooth

    jonathan.driscoll

      Hello,

         

      We have been working an a devices using PSOC 4 bluetooth, for a wireless ultra-low power sensor.

         

      Currently, we have the electronics and firmware working, drawing only 150 microamps of power.  This works well, and is done by putting the system mostly into deep sleep, and taking a measurement once every five seconds.

         

      However, if we begin to make calls to 

         

        BLE_ProcessEvents();

         

      The system only enters sleep briefly, and we appear to be bombarded by several hundred events per second.  Although the connection to the app appears to work fine, sending out an actual measurement every five seconds, this creates an huge additional power overhead (about a factor of ten), which is too high for our application.

         

      It seemed that perhaps the Connection Interval settings were incorrect, resulting in extra (unnecessary) events (???).  However, we have tried changing these settings both through the bluetooth configuration and by calls to

         

         CyBle_L2capLeConnectionParamUpdateRequest(cyBle_connHandle.bdHandle, &connectionParameters);

         

      This seems to have no effect.

         

      Any idea what could be causing the extra events?  We only make calls to 

         

        CyBle_GattsWriteAttributeValue(&measurementHandle, FALSE, &cyBle_connHandle, FALSE);

         

        CyBle_GattsNotification(cyBle_connHandle, &measurementHandle);

         

      once every five seconds.  There should be no issue (deep) sleeping most of the time, but it seems there is something extra going on that’s taking up all the processing time.

         

      Thanks,
      Jonathan

        • 1. Re: problem (deep) sleeping when connected to bluetooth
          e.pratt_1639216

          The BLE_ProcessEvents() function is a nonblocking call to handle any queued BLE events. Calling CyBle_ functions will normally generate x number of events (usually just one) which need to be handled. Once you've handled all of them, it will just return without doing any processing.

             

          What are your connection parameters you are using?

             

          Are you handling the BLE events after calling the CyBle functions?

             

          Can you upload your project for us to check for issues?

             

          The architecture approach I've seen that works best is:

             

          Call BLE_ProcessEvents() from main loop;

             

          Call other processing functions in main loop;

             

          If there is no more events/processing to be done, then go to sleep by calling a low_power function in main;

             

          Can you list/see what events are occurring when the process events is called?

             

          (You will have to disable sleep mode and run a debugger connected to the device)