Value to write to remote client characteristic configuration attribute

I am working on integrating Metawear C sensor with my own platform with a BLE chip.

I am able to connect to the Meta C, but when I issue “client attribute write” and write 0x0001 to remote client characteristic configuration attribute, to start receiving notifications, I don’t get any notifications back with the attribute value from Meta C.

I am assuming that the value 0x0001 to be written to remote client characteristic configuration attribute maybe different with the Metawear C platform. Can you let me know what the correct value is? Or if I need to do something else with the Meta C to start getting attributes value notifications.

I am using the below UUID’s

 SERVICE_UUID= 326A9000-85CB-9195-D9DD-464CFBBAE75A

 CHAR_NOTIFICATION_UUID =326A9006-85CB-9195-D9DD-464CFBBAE75A

Here is the flow:

Sent (to Meta C):                   Gap Discover

Received (from Meta C):      Gap Scan Response 

(Received response the service UUID above)

Sent:                                       Gap Connect

Received:                                Gap Connection Status

Sent:                                       Read Attribute client service groups

Received:                                Attribute client group found

Received:                                Attribute client procedure completed

Sent:                                       Attribute client find CCC (0x2A1C) and

measurement (0x2902) handles

Received:                                Measurement and CCC descriptor

Received:                                Attribute client procedure completed

Sent:                                       Attribute Client Write

                                                (write 0x0001 to remote Client characteristic

configuration attribute, to start receiving attribute value 

notifications)

(Time out: No attribute value received from Meta C)

Please let me know what could be the issue.

Sanjay

Comments

  • Did you issued a command to the MetaWear board?  Characteristic notifications are only fired when the characteristic value changes so simply enabling notifications does not mean you will get a periodic stream of notifications.
  • Hi Eric,
    I did not issue any command. I assumed once we write to the CCC attribute, the notifications are enabled (as they are in other sensors such as HR sensors etc.).

    Can you point me to sections of the documentation/code which I can follow to issue these commands, or you can describe to me what I need to do here, either way is good.

    Thanks,

    Sanjay



  • They are enabled, however, as explained in my previous post, you only receive notifications when the characteristic value changes  As there is no further activity from the board, there are no value changes to notify the host device with.

    The MetaWear service has a 2nd characteristic, 326a9001-85cb-9195-d9dd-464cfbbae75a, which you will write to to issue commands to the board.  Try writing [0x01, 0x01, 0x01] to it and press the button.
  • I am really confused. Just so we are on the same page, I have my own board running a RTOS which has BLE stack (host), which I am trying to connect to Metawear C (board).

    The Metawear C accelerometer board does continuous measurements and I should receive attribute values continuously on the host, once enabled.

    I have tried what you have described above, and no attribute values are received.

    Here are the characteristics handle and UUID Data that I receive on my platform:

    Characteristics Handle: 0x1B00
    UUID Data: 0x2800
    Length: 16 bit

    Characteristics Handle: 0x1C00
    UUID Data: 0x2803
    Length: 16 bit

    Characteristics Handle: 0x1D00
    UUID Data: 326a9001-85cb-9195-d9dd-464cfbbae75a
    Length: 16 bit

    Characteristics Handle: 0x1E00
    UUID Data: 0x2803
    Length: 16 bit

    Characteristics Handle: 0x1F00
    UUID Data: 326a9006-85cb-9195-d9dd-464cfbbae75a
    Length: 128 bit

    Characteristics Handle: 0x2000
    UUID Data: 0x2902
    Length: 16 bit

    Currently, after I receive the last characteristics handle (0x2000), I issue a attribute write command to enable notifications with that characteristics handle (0x2000). I have tried various command strings:

    0x01, 0x01, 0x01
    0x03, 0x04, 0x01
    0x03, 0x02, 0x01



  • You need to enable notifications on handle 0x1f00 and write [0x01, 0x01, 0x01] to handle 0x1d00 to stream button presses.
  • I have tried the above, but still face the same issue. It seems like I am missing a step or the right set of commands. I have scrounged this forum and the code. After all service/UUID have been found, Here is what I am doing to enable notifications and receive x,y & z axis accelerometer streaming data:

    <----- On host, Client Attribute Write on UUID *9006* (Handle 0x1F) with command 0x03, 0x04, 0x01
    ----->  On host, Received Client Procedure Completed from Metawear C with result as success

    <----- Client Attribute Write on UUID *9006* (Handle 0x1F) with command 0x03, 0x01, 0x01
    ----->  Received Client Procedure Completed from Metawear C with result as success

    <----- Client Attribute Write on UUID *9006* (Handle 0x1F) with command 0x03, 0x02, 0x01, 0x00
    ----->  Received Client Procedure Completed from Metawear C with result as success

    <----- Client Attribute Write on UUID *9001* (Handle 0x1D) with command 0x01, 0x01, 0x01
    ----->  Received Client Procedure Completed from Metawear C with result as success

    After last command, I press the button on Metawear C, but nothing happens even after that. I am waiting for attribute value indication on the host, but it does not get called. Please advise.






  • As mentioned in my previous post, write commands to characteristic 326a9001-85cb-9195-d9dd-464cfbbae75a (handle 0x1d00), enable notifications on characteristic 326a9006-85cb-9195-d9dd-464cfbbae75a (handle 0x1f00).  This is what the Android and iOS APIs, and UWP example code all do behind the scenes to communicate over the BLE link.

    Have you tried using the MetaWear board with the sample app to check that the board is working as expected?  Also, try using the nRF Connect (Android, iOS) to configure the BLE connection as stated above and try streaming button presses to that app.
  • I have already checked with the Metawear App on iPhone. The board is working.

    What I am struggling is to figure out how to enable notifications. From the CPP API code, I see the following commands:

    0x03, 0x02, 0x01, 0x00 - Data Interrupt Enable (Start accelerometer sampling, Issue on Handle 0x1D)
    0x03, 0x01, 0x01 - Power Mode, Start Accelerometer (issue on Handle 0x1D)

    What additional do I need to do to enable notifications - the above commands don't enable the accelerometer data streaming? The terminology is a bit confusing. 










  • You also need to write [0x03, 0x04, 0x01].
  • Still no success.

    I am writing:

    <----- 0x03, 0x04, 0x01 (on Handle 0x1D)
    ------> Received confirmation
    <---- 0x03, 0x02, 0x01, 0x00 (on Handle 0x1D)
    -----> Received confirmation
    <---- 0x03, 0x01, 0x01 (On Handle 0x1D)
    -----> Received confirmation

    Am I missing some commands to enable notifications on Handle 0x1F?

    Sanjay





  • That depends on the Bluetooth stack you are using.  What does that BT stack's documentation say about enabling notifications?
  • I am using Silicon Labs BLE113 and their Bluegiga Protocol Stack. As long as a connection is established with Meta C - which in this case there is one, all data coming from Meta C on that connection will be passed to the application by BLE113 stack using the "attribute client value" indication. This is just part of the standard protocol.

    I have connected to several peripherals such as HR sensor etc. and they work flawlessly. The documentation of those sensors clearly specific what value to write to the remote client characteristics configuration attribute and that enables the indications.

    I am pretty confidant if something is being sent by Meta C on that connection, I will receive it. When I write 0x0002 on handle 0x20 (UUID: 0x2902), button presses on Meta C result in two packets being received with values (0x01, 0x01, 0x01) and (0x01, 0x01, 0x00). Not sure what they mean, but the connection exists - I just need your software to send me X,Y, Z accelerometers values on that connection.

    It appears that I am missing a command to either enable the Nordic BLE stack you are using to send data to my board or a command to your stack to send data to my board.





     


  • Sorry - just to add and correct:

    when I write 0xFFFF to handle 0x20 (UUID: 0x2902), I get the two packets with 0x01, 01, 01 and 0x01, 0x01, 0x00

    The indicated characterstic handle is 0x1F on these packets.



  • MetaWear uses characteristic notifications which is not the same as characteristic indications.  The difference is explained in this port on the nordic developer forum

    Based on your original post, it looks like you were trying to enable indications.
  • I am enabling characteristic notifications on Nordic by writing on UUID 0x2902 (essentially the LSB needs to be set). After I do that, button presses result in some packets coming through on handle 0x1F.

    Now, I just need the x, y and z axis accelerometer values to come up the stack. Is there a post that explains how the Metawear commands need to packed into a buffer when sent to the wrapper when we do a write GATT characteristics - maybe there is a command formatting issue?




  • Eric,
    I am able to get streaming notifications now. Just playing around with the order of commands fixed the issue. Thank you!

    Sanjay
This discussion has been closed.