Search code examples
embeddedbluetooth-lowenergyiot

Bluetooth Low Energy (BLE) Multiple Characteristics


I am trying to get a BLE module (datasheet) read/write to my laptop. I'm using python on my laptop and am able to see the services and characteristics as follows:

SERVICE 00001800-0000-1000-8000-00805f9b34fb (Handle: 1): Generic Access Profile
     CHARACTERISTIC 00002a00-0000-1000-8000-00805f9b34fb (Handle: 2): Device Name ['read']
     CHARACTERISTIC 00002a01-0000-1000-8000-00805f9b34fb (Handle: 4): Appearance ['read']
     CHARACTERISTIC 00002a04-0000-1000-8000-00805f9b34fb (Handle: 6): Peripheral Preferred Connection Parameters ['read']
SERVICE 00001801-0000-1000-8000-00805f9b34fb (Handle: 8): Generic Attribute Profile
     CHARACTERISTIC 00002a05-0000-1000-8000-00805f9b34fb (Handle: 9): Service Changed ['indicate']
         DESCRIPTOR 00002902-0000-1000-8000-00805f9b34fb (Handle: 11): Client Characteristic Configuration
SERVICE 0000180a-0000-1000-8000-00805f9b34fb (Handle: 12): Device Information
     CHARACTERISTIC 00002a23-0000-1000-8000-00805f9b34fb (Handle: 13): System ID ['read']
     CHARACTERISTIC 00002a26-0000-1000-8000-00805f9b34fb (Handle: 15): Firmware Revision String ['read']
SERVICE 0000ffc0-0000-1000-8000-00805f9b34fb (Handle: 17): Vendor specific
     CHARACTERISTIC 0000ffc1-0000-1000-8000-00805f9b34fb (Handle: 18): Vendor specific ['write-without-response', 'write']
     CHARACTERISTIC 0000ffc2-0000-1000-8000-00805f9b34fb (Handle: 20): Vendor specific ['notify', 'indicate']
         DESCRIPTOR 00002902-0000-1000-8000-00805f9b34fb (Handle: 22): Client Characteristic Configuration
SERVICE 0000ff90-0000-1000-8000-00805f9b34fb (Handle: 23): Vendor specific
     CHARACTERISTIC 0000ff91-0000-1000-8000-00805f9b34fb (Handle: 24): Vendor specific ['read', 'write-without-response', 'write']
     CHARACTERISTIC 0000ff92-0000-1000-8000-00805f9b34fb (Handle: 26): Vendor specific ['read', 'write-without-response', 'write']
     CHARACTERISTIC 0000ff93-0000-1000-8000-00805f9b34fb (Handle: 28): Vendor specific ['read', 'write-without-response', 'write']
     CHARACTERISTIC 0000ff94-0000-1000-8000-00805f9b34fb (Handle: 30): Vendor specific ['write-without-response', 'write']
     CHARACTERISTIC 0000ff95-0000-1000-8000-00805f9b34fb (Handle: 32): Vendor specific ['read', 'write-without-response', 'write']
     CHARACTERISTIC 0000ff96-0000-1000-8000-00805f9b34fb (Handle: 34): Vendor specific ['read', 'write-without-response', 'write']
     CHARACTERISTIC 0000ff97-0000-1000-8000-00805f9b34fb (Handle: 36): Vendor specific ['read', 'write-without-response', 'write']
     CHARACTERISTIC 0000ff98-0000-1000-8000-00805f9b34fb (Handle: 38): Vendor specific ['read', 'write-without-response', 'write']
     CHARACTERISTIC 0000ff99-0000-1000-8000-00805f9b34fb (Handle: 40): Vendor specific ['read', 'write-without-response', 'write']
     CHARACTERISTIC 0000ff9a-0000-1000-8000-00805f9b34fb (Handle: 42): Vendor specific ['read', 'write-without-response', 'write']
SERVICE 0000ffe0-0000-1000-8000-00805f9b34fb (Handle: 44): Vendor specific
     CHARACTERISTIC 0000ffe9-0000-1000-8000-00805f9b34fb (Handle: 45): Vendor specific ['write-without-response', 'write']
     CHARACTERISTIC 0000ffe4-0000-1000-8000-00805f9b34fb (Handle: 47): Vendor specific ['notify']
         DESCRIPTOR 00002902-0000-1000-8000-00805f9b34fb (Handle: 49): Client Characteristic Configuration
SERVICE 5833ff01-9b8b-5191-6142-22a4536ef123 (Handle: 50): Unknown
     CHARACTERISTIC 5833ff02-9b8b-5191-6142-22a4536ef123 (Handle: 51): Unknown ['write']
     CHARACTERISTIC 5833ff03-9b8b-5191-6142-22a4536ef123 (Handle: 53): Unknown ['notify']
         DESCRIPTOR 00002902-0000-1000-8000-00805f9b34fb (Handle: 55): Client Characteristic Configuration

I'm am getting that I am connected to the module but when I try to send data to module or receive from module (module is connected via UART to MCU) I don't get anything. I'm new to BLE and tried a few characteristics above for the read and write but nothing seems to work. Why are there many multiples of characteristics and which one should I use?

P.S. Also confused about notify vs read. From what I understand they are same thing.


Solution

  • Every BLE development, regardless if it is between two mobile phones or using a different BLE device, should start by scanning the target device using a generic BLE scanner such as nRF Connect or LightBlue. This way you can make sure that the BLE device is working properly before attempting to develop something on your own.

    Regarding your device, the posted datasheet contains an interface description on page 27 where they explain that the Pass-through Data Channel uses the Service UUID 0xFFE0. THis is a 16-Bit short version and can be converted to 128 bit if needed.

    The Service should contain two characteristics:

    Characteristic UUID Privilege Bytes Default Value Remark
    FFE9 (handle: 0x0013) Write 20 None APP Write data to module and output to UART TX.
    FFE4 (handle: 0x000E) notify 20 None Notify the data from UART RX to BLE APP.

    Try using one of the BLE scanner mentioned above to write to FFE9 and activate notifications on FFE4.

    The notification privilege is not the same as a read privilege. You can't read from a characteristic that only offers notifications, but you can subscribe to them and, as the name suggests, get notified if new data is available. The data will be transmitted with the notification.