6 years, 6 months ago.

Ble data written callback never called

I am trying to put together an app for the MAX32630FTHR that reads IMU data and will eventually push it out over BLE.

I'm currently getting just the basics in, and starting with the example here: https://docs.mbed.com/docs/ble-intros/en/latest/Advanced/GATTEvo/ in order to make sure I set things up properly.

However, my Data write callback is never called

Ble InitComplete

void bleInitComplete(BLE::InitializationCompleteCallbackContext *params)
{
    ble_error_t error = params->error;

    if (error != BLE_ERROR_NONE) {
        return;
    }

    ble.gap().onDisconnection(disconnectionCallback);
    ble.gattServer().onDataWritten(writeCharCallback);

    /* Setup advertising */
    ble.accumulateAdvertisingPayload(GapAdvertisingData::BREDR_NOT_SUPPORTED | GapAdvertisingData::LE_GENERAL_DISCOVERABLE);
    ble.accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LIST_16BIT_SERVICE_IDS, (uint8_t *)uuid16_list, sizeof(uuid16_list));
    ble.accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LOCAL_NAME, (uint8_t *)DEVICE_NAME, sizeof(DEVICE_NAME));
    ble.setAdvertisingType(GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED);
    ble.setAdvertisingInterval(1600); /* 1000ms; in multiples of 0.625ms. */

    /* Add our custom service */
    ble.addService(customService);

    /* Start advertising */

}

main loop

if(failures == 0)
    {

        Ticker ticker;
        ticker.attach(wakeup_event_cb, 0.1);
        while (true) {
            ProcessIMU(&imu);
            ble.waitForEvent(); /* Save power */

        }
    }

The IMU data prints fine to the screen, but the write callback (which currently does what the evothings example does, plus a print on entry) is never called.

Any help?

Be the first to answer this question.