Timeout error while initialising board

Hello,

I'm getting an unexpected error while trying to initialise the board. My code is available here:

https://github.com/liweiyap/metawear-impl

Trying to gain programmatic access to a stream of quaternions via the C++ API on Linux has been much harder than anticipated. Example code for Linux would be of much help. In the meantime, below is a brief description of the current issue.

Board Information

  • Code tested and produces same results with MMR and MMR+. Both devices have the same:
    • Hardware revision: 0.4
    • Firmware revision: 1.5.0
    • Model number: 5

Host Device Information

Description of Problem

  1. Expected to print the message Board initialised from initBoard(board) with a status of 0 (MBL_MW_STATUS_OK).
  2. Instead, observed the message Error initialising board from initBoard(board) with a status of 16 (MBL_MW_STATUS_ERROR_TIMEOUT).
  3. The steps leading up to this behaviour in main.cpp:
    1. A WarbleGatt object is first created using the device MAC address and the host HCI address.
    2. Connection to the device MAC address via warble_gatt_connect_async is successful.
    3. An MblMwBtleConnection object is created using our own implementations of the GATT operations.
    4. An MblMwMetaWearBoard object is instantiated using mbl_mw_metawearboard_create.
    5. Finally, initBoard(board) calls mbl_mw_metawearboard_initialize, which initialises the internal state of the MblMwMetaWearBoard object. This is where the observed message is printed.

SDK

  • MetaWear C++ SDK, version 0.18.4
  • Ubuntu 16.04
  • Self-contained piece of MetaWear SDK calls that replicates this issue is found in main.cpp. The entire code can be copied/pasted and run, assuming that the following dependencies are also installed:

  • All the output from stdout/stderr (with the message Error initialising board and the status of 16 for MBL_MW_STATUS_ERROR_TIMEOUT all the way at the bottom):

Connecting to F2:DC:73:7D:AA:08
error 1590070706.778786: Error on line: 296 (src/blestatemachine.cc): Operation now in progress
Connected
Services disconvered
Characteristics discovered
Descriptors found
Connected to F2:DC:73:7D:AA:08
Enabling notification of characteristic: {326a9006-85cb-9195-d9dd-464cfbbae75a}
Succeeded in enabling notifications.
Reading characteristic: {00002a26-0000-1000-8000-00805f9b34fb}: 1.5.0
Reading characteristic: {00002a24-0000-1000-8000-00805f9b34fb}: 5
Reading characteristic: {00002a27-0000-1000-8000-00805f9b34fb}: 0.4
Reading characteristic: {00002a29-0000-1000-8000-00805f9b34fb}: MbientLab Inc
Reading characteristic: {00002a25-0000-1000-8000-00805f9b34fb}: 047D22
Writing characteristic: {326a9001-85cb-9195-d9dd-464cfbbae75a}: 1 128 
Writing characteristic: {326a9001-85cb-9195-d9dd-464cfbbae75a}: 2 128 
Writing characteristic: {326a9001-85cb-9195-d9dd-464cfbbae75a}: 3 128 
Writing characteristic: {326a9001-85cb-9195-d9dd-464cfbbae75a}: 4 128 
Writing characteristic: {326a9001-85cb-9195-d9dd-464cfbbae75a}: 5 128 
Writing characteristic: {326a9001-85cb-9195-d9dd-464cfbbae75a}: 6 128 
Writing characteristic: {326a9001-85cb-9195-d9dd-464cfbbae75a}: 7 128 
Writing characteristic: {326a9001-85cb-9195-d9dd-464cfbbae75a}: 8 128 
Writing characteristic: {326a9001-85cb-9195-d9dd-464cfbbae75a}: 9 128 
Writing characteristic: {326a9001-85cb-9195-d9dd-464cfbbae75a}: 10 128 
Writing characteristic: {326a9001-85cb-9195-d9dd-464cfbbae75a}: 11 128 
Writing characteristic: {326a9001-85cb-9195-d9dd-464cfbbae75a}: 12 128 
Writing characteristic: {326a9001-85cb-9195-d9dd-464cfbbae75a}: 13 128 
Writing characteristic: {326a9001-85cb-9195-d9dd-464cfbbae75a}: 15 128 
Error initialising board: 16

Comments

  • It looks like everything is correctly setup since you are receiving notifications. My guess is the response time between your ble adapter is too slow so you can try increasing the time for response with mbl_mw_metawearboard_set_time_for_response.

    Try with 1000ms

  • Hi Eric!

    I'm a colleague of the OP. Thanks a lot for your very kind response; we really appreciate it! Indeed, mbl_mw_metawearboard_set_time_for_response was already one of the first things we tried, but we still got the same timeout error as before. We even increased the time up to the maximum of 4000 ms, but to no avail. Due to the error whilst initialising the board, any further commands like mbl_mw_sensor_fusion_set_mode(board, MBL_MW_SENSOR_FUSION_MODE_IMU_PLUS) will throw a std::out_of_range exception. It seems that our problem is very similar to this one.

    I'm wondering if you happen to have any other suggestions. In the meantime, I have updated the code in the repo to include mbl_mw_metawearboard_set_time_for_response. The entire code can be copied/pasted and run.

    Thanks again and warmest regards
    Li

  • edited May 26
    1. Did you get further in the initialization process when increasing the timeout?
    2. Use btmon to log the bt adapter activity
    3. Try connecting with the python or C# netstandard SDKs
      • They also use Warble to initialize their internal state
      • Look at the source code and see how they connect Warble to their SDKs (primarily the python one)
    4. Use different BT adapters
Sign In or Register to comment.