Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
8 years, 10 months ago.
BLE stability issue
Hi
We've been using your nRF51822 mbed implementation since last year and it always worked great! Thanks a lot!
Now we had to update to Softdevice 8 and we are facing serious stability issues. The connection keeps breaking after 30min - 1h. I've checked it with a sniffer. Our Periphery device just stops answering to a stable connection but it does not dissconnect (no dissconnection callback and no start of advertising). See the sniffer log here:
No to be sure it's not a App problem, if've removed everything appart from the BLE code. And it still crashes. To be even more safe, I did Flash it to the nrf dongle from Nordic. And it still crashed. Here is the very minimal code:
extracted code
PainGuard::PainGuard() { _pBle = new BLEDevice(); _pBle->init(); _pDeviceInformationService = new DeviceInformationService(*_pBle, "Manufacturer", //manufacturersName "Gadget", //modelNumber "00000000", //serialNumber "1", //hardwareRevision STR_FW_VERSION, //firmwareRevision "0.1"); //softwareRevision } void PainGuard::init(void) { _pTicker = new Ticker(); _pBle->gap().onDisconnection(disconnectionCallback); _pBle->gap().onConnection(connectionCallback); _pBle->gattServer().onDataSent(onDataSent); _pBle->onDataWritten(onDataWritten); // setup advertising and prefered connection parameters _pBle->accumulateAdvertisingPayload(GapAdvertisingData::BREDR_NOT_SUPPORTED | GapAdvertisingData::LE_GENERAL_DISCOVERABLE); _pBle->setAdvertisingType(GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED); _pBle->setAdvertisingInterval(ADVERTISING_INTERVAL_MS); _pBle->setDeviceName(reinterpret_cast<const uint8_t*>("Gadget")); _pBle->gap().accumulateScanResponse(GapAdvertisingData::COMPLETE_LOCAL_NAME, reinterpret_cast<const uint8_t*>("LiquiGadget"), 6); _pBle->gap().setPreferredConnectionParams(&_connectionParamsFast); _pTicker->attach_us(&PainGuard::periodicCallback, MEASUREMENT_INTERVAL_MS*1000); _pBle->startAdvertising(); } void PainGuard::onDataSent(unsigned count) // called after notifications have been sent { _pServiceDataHandler->notificationHandler(ServiceDataHandler::CONTEXT_CB); } void PainGuard::disconnectionCallback(const Gap::DisconnectionCallbackParams_t *params) { _pBle->startAdvertising(); } void PainGuard::connectionCallback(const Gap::ConnectionCallbackParams_t* param) { Gap::Handle_t gap_handle = param->handle; _pBle->gap().updateConnectionParams(gap_handle, &_connectionParamsFast); } /** * Runs once a second in interrupt context triggered by the 'ticker'; */ void PainGuard::periodicCallback() { _MeasurementPending = true; } void PainGuard::process() { _pBle->waitForEvent(); }
Now I'm wondering whether you also face these problems? As mentioned, it only happens after >30min. Or is there anything I'm doing terribly wrong?
Thanks for your help! Stephen
This sounds very similar to what I'm experiencing with some nRF51-DK prototypes. Did you get anywhere in solving this?
Anyone else have ideas?
posted by CJ Shaw 05 Jul 2016