- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi ,
I have a peripheral device, which connects to the central device periodically. First instance it connects to the central and sends the packet data as expected. But on the second instance, it fails on GAP connection event and generates a CYBLE_EVT_GATT_DISCONNECT_IND and then peripheral stops advertising.
How to restart the BLE advertisement again?
Solved! Go to Solution.
- Labels:
-
BLE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
You can know the reason for the disconnection from the DISCONNECT event. Also, did you try restarting the advertisement after the disconnect event (inside the event callback or somewhere else)?
Regards,
- Madhu Sudhan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
You can know the reason for the disconnection from the DISCONNECT event. Also, did you try restarting the advertisement after the disconnect event (inside the event callback or somewhere else)?
Regards,
- Madhu Sudhan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
1) Disconnection happens when the central device tries to establish the connection with peripheral.
2) Also tried to restart the advertisement once it disconnects, it comes to CYBLE_EVT_GATT_DISCONNECT_IND and stops advertising. Its not invoking CYBLE_EVT_GAP_DEVICE_DISCONNECTED event.
is there any way of restarting the ble?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi there, was there any resolution to this?
I'm running into the same issue when restarting advertising after using my device as a BLE central (stop advertising, connect, write, disconnect, re-advertise).
I can only re-advertise for a second before advertisements just stop.
I've noticed that when I remove sleep mode (ifdef'd out), everything works as expected.
Update: More specifically, only when I go into BLESS_DEEP_SLEEP do I run into the problem where advertisements stop. Regular BLESS SLEEP can still have functional advertisements.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Suresh,
Would it be possible for you to post the code that handles sleep/wake transitions in your application? I have seen this occur once when the testing conditions for whether to use normal sleep vs. deep sleep are not quite correct.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Just as a note, I've pulled in a horrific workaround from Project052_BLE_Mesh_Directed. It says this workaround is there as a workaround for CDT 214662, and I don't know what that is.
Anyways, to recap, I have a state machine which runs through (and verifies the state of): Stop Advertising, Connect to peripheral via mac address, write a message, disconnect, start advertising.
When I have my device set to go into BLESS_DEEPSLEEP, that last advertising state would only send a few advertisements then go silent, and there was no way to recover. If I only went down into BLESS_SLEEP, then everything worked normally (but, doesn't matter when, if I EVER went back into DEEPSLEEP mode, advertisements stop).
The only workaround to the above scenario was to restart advertising, disable DEEPSLEEP mode, and stay in regular SLEEP. Then, after a phone connected to the device, and then disconnected - I was able to enter DEEPSLEEP again, and it seemed like everything worked correctly. So, there was something about acting like a peripheral, getting connected to, and then disconnecting that put us back in a good state.
Note: I have tried restarting advertisements in callbacks, in the event handlers, in the main loop, etc. I've also put ProcessEvents EVERYWHERE to no luck - the problem is outside of the trivial solutions unfortunately, it seems.
I've opened up a support ticket, but what I'm going with for now is that after I finish my (as a central) disconnection state, instead of re-advertising, I do a CyBle_Stop() then CyBle_Start(myEventHandler)... In my Initialization event handler, I restart advertisements - and all -seems- to work, but this is a pretty rough workaround.
I'll follow up if the support ticket shows a bug in my code, or a bug in the component. I hope it's in my code, not the component, because my code has already discovered a component bug that I need to put a workaround in the generated source for.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Any luck? Could it be something with the BLESS interrupt priority?