Comments (9)
That means a timeout, one of the devices failed to send a packet for longer than the supervision timeout.
It's worthwhile to check the connection parameters. If you don't see them on your phone you can do a similar event on the example:
void onConnectionComplete(const ble::ConnectionCompleteEvent &event) override
and examine:
conn_interval_t connectionInterval,
slave_latency_t connectionLatency,
supervision_timeout_t supervisionTimeout,
If for some reason your phone is busy with other traffic it might miss connection slots or maybe you have a noisy environment and despite the board connecting the quality of the connection is so poor that it barely ever manages to get a packet through and disconnects. Check with your scanner to see the dbm of the signal and how many devices are competing for the spectrum.
from mbed-os-example-ble.
This is not related to your problem (at least I don't) but wanted to mention that I have recently overhauled the examples - the new versions are available in the 'development' branch.
from mbed-os-example-ble.
The BLE_GAP example is designed to connect and disconnect on its own. It looks like it's happily negotiating higher bandwidth and longer packet size so your connection must be OK. I'm surprised by the out of memory errors for creation of an advertising set. I'll look into that.
One of the examples designed to maintain a connection is any of the gatt ones like the BLE_GattServer_CharacteristicWrite which will wait for connection and allow you to write a characteristic at your leisure.
from mbed-os-example-ble.
@jw-smaal thank you for raising this issue.Please take a look at the following comments:
We cannot automatically identify a release based on the version of Mbed OS that you have provided.
Please provide either a single valid sha of the form #abcde12 or #3b8265d70af32261311a06e423ca33434d8d80de
or a single valid release tag of the form mbed-os-x.y.z .
E.g. 'https://github.com/ARMmbed/mbed-os/#8ef0a435b2356f8159dea8e427b2935d177309f8' has not been matched as a valid tag or sha.
NOTE: If there are fields which are not applicable then please just add 'n/a' or 'None'.This indicates to us that at least all the fields have been considered.
Please update the issue header with the missing information, the issue will not be mirroredto our internal defect tracking system or investigated until this has been fully resolved.
from mbed-os-example-ble.
Can you look into the log on your iphone to see what the reason for disconnection is? You can also add to the example after init complete:
_gap.setEventHandler(this);
and add a function to the main class:
void onDisconnectionComplete(const ble::DisconnectionCompleteEvent &event) override
{
printf("Disconnected with error %d\r\n", event.getReason());
}
This way the example will also print the reason for disconnection.
from mbed-os-example-ble.
Paul,
Thank you for looking into this. The iPhone BLE scanner reports:
Connected --> Discovering Services -- > [Callback] centralManager(centraldidDisconnectPeripheral: peripheral error: "The connection has timed out unexpectedly"
When I add the code I get
DEVICE MAC ADDRESS: da:3f:a1:0a:f5:0f
Disconnected with error 8
from mbed-os-example-ble.
I have a good signal -37dBm I tried the development branch as well and with the BLE_GAP example I am getting similar issues. Maybe it's not a bug but I am unable to get it to function at least with my phone. I am going to get some other devices to try with as well.
The serial port on the NRF52_DK shows the following:
We have scanned for 200ms with an interval of 80 timeslots and a window of 60 timeslots
We have been listening on the radio for at least 150msAdvertising started (type: 0x0, interval: [25 : 50]ms)
Gap::createAdvertisingSet() failed: BLE_ERROR_NO_MEM: Out of Memory
Advertising set 0 started
Connected in 200ms
Stopped advertising early due to connection
Data length changed on the connection 1.
Maximum sizes for over the air packets are:
251 octets for transmit and 251 octets for receive.
Phy update on connection 1 - Tx Phy: LE 2M, Rx Phy: LE 2M
Data length changed on the connection 1.
Maximum sizes for over the air packets are:
251 octets for transmit and 251 octets for receive.
Disconnected
We have advertised for 200ms
We created at least 4 tx and rx eventsScanning started (interval: 50ms, window: 37ms, timeout: 10000ms).
We found a connectable device
Connected in 349ms
Disconnected
We have scanned for 349ms with an interval of 80 timeslots and a window of 60 timeslots
We have been listening on the radio for at least 225msAdvertising started (type: 0x0, interval: [25 : 50]ms)
Gap::createAdvertisingSet() failed: BLE_ERROR_NO_MEM: Out of Memory
Advertising set 0 started
from mbed-os-example-ble.
@paul-szczepanek-arm happy to report that I managed to use the "BLE_GattServer_CharacteristicWrite" connect to the GattServer on the NRF52_DK and write characteristic to it. Thanks for all your help.
from mbed-os-example-ble.
Glad it works for you. I will follow up on the out of memory errors in the gap example but since it's not part of this issue I will close this. If you think there's still a problem please reopen.
from mbed-os-example-ble.
Related Issues (20)
- Bug with string in function init or in function parameter HOT 2
- Why are none of the examples using the UUID class to properly define UUIDs HOT 3
- GAP example broken for nRF52_DK in branch mbed-os-5-15 HOT 2
- BLE examples throwing up errors in MBED Studio (OS6.2) HOT 3
- BLE_GattServer does not appear to advertise its service UUID HOT 5
- Why is delay required before starting advertisements after setting up SecurityManager? HOT 7
- missing file: pretty_printer.h on example mbed-os-6.5.0 HOT 24
- BLE_GattServer_AddService does not work on NRF52-DK HOT 15
- Lack of usable BLE documentation HOT 17
- Mbed CLI 2 not linking BlueNrg HCI drivers HOT 4
- Periodic advertisement example issue on WB55 HOT 9
- Relying on event queue seems to be a really bad idea HOT 3
- Missing examples for reusable services HOT 19
- Some examples don't expose their list of services HOT 7
- BLE_Advertising example stack overflow nRF52 if debugging with MBED_TICKLESS is set HOT 4
- mbed-tools.exe does not clone mbed-os-ble-utils for BLE_SupportedFeatures HOT 1
- Definition of 'GattServer' device to search for HOT 3
- How to change component to "BlueNRG_2" from "BlueNRG_MS"
- Not working for CY8CKIT_062_BLE
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mbed-os-example-ble.