You are here

BLE Disconnects after Custom Characterisitic Write | Cypress Semiconductor

BLE Disconnects after Custom Characterisitic Write

Summary:1 Reply, Latest post by e.pratt_1639216 on 15 Aug 2017 07:09 AM PDT
Verified Answers:0
Last post
Log in to post new comments.
maxwin_2575031's picture
10 posts

Device CYBL10563-56LQXI


I am trying to create an application where the user can put the BLE device to sleep for certain hours.

I have created a service which has two characteristics; 1.Sleep time and 2.SleepNowFlag.

The user enters the duration for which it wants the BLE device to sleep, and they write on to the SleepNowFlag when they want to put the BLE  to sleep.

After I write the sleep time; the BLE becomes unresponsive and it disconnects after few seconds.


e.pratt_1639216's picture
638 posts

Your BLE write request handler code seems fine, except that you are calling the CyBle_ProcessEvents() from inside the event handler.This will cause the device to try to handle more events while it is mid-processing of the event.Try moving the CyBle_ProcessEvents() calls to only be called from the main() loop.Changing both of those function calls in the BLE event handler should fix the unit locking up when you write data to it.

Edit:Also, you should wait until the user disconnects from the unit before putting the BLE into the deep sleep, otherwise it will immediately disconnect from the BLE connection and you can't finish writing service data, or will fail to go to deep sleep and will keep running until disconnected anyways :/

Log in to post new comments.