GithubHelp home page GithubHelp logo

Comments (9)

paul-szczepanek-arm avatar paul-szczepanek-arm commented on July 17, 2024 1

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.

paul-szczepanek-arm avatar paul-szczepanek-arm commented on July 17, 2024 1

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.

paul-szczepanek-arm avatar paul-szczepanek-arm commented on July 17, 2024 1

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.

ciarmcom avatar ciarmcom commented on July 17, 2024

@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.

paul-szczepanek-arm avatar paul-szczepanek-arm commented on July 17, 2024

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.

jw-smaal avatar jw-smaal commented on July 17, 2024

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.

jw-smaal avatar jw-smaal commented on July 17, 2024

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 150ms

Advertising 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 events

Scanning 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 225ms

Advertising 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.

jw-smaal avatar jw-smaal commented on July 17, 2024

@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.

paul-szczepanek-arm avatar paul-szczepanek-arm commented on July 17, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.