5.4 Zigbee Commissioning through BLE - Protocol Exchange

Protocol Exchange

This section explains the communication protocol exchange between BLE Provisioner mobile app/ BLE sensor mobile app (BLE central) and WBZ451 Module (BLE peripheral).

1. Advertising Beacon:

  • Advertisement Data:

    • Service UUID: 16-bit Service UUID, 0xFEDA is purchased by Microchip from Bluetooth SIG.

    • Other Info: 0x40+Light ON/Off status (1 Byte)+ 0x41+Temperature data (2 bytes)

  • Scan Response Data:

    • The device name is part of the scan response. Device name is set as "COMBO_LIGHT_XXXX” by default (XXXX means the last two bytes of the device address). This device name can be changed using "BLE Provisioner" app as described in demo step #5

Transparent Profile and Service (TRP/TRS) is the proprietary BLE service by microchip to establish data and control channel between BLE Central (Phone) and Peripheral (device).

  • Transparent Profile (TRP) enables higher layer application to control and allow data exchange between TRP Client and Server devices

  • Transparent Service (TRS) includes both Ctrl and Data Pipes which are custom 128-bit GATT characteristics.

    • The Transparent Server shall be a GATT Server

    • The Transparent Client shall be a GATT Client

      Definition of Transparent Service and Characteristics UUIDs

      Characteristic NameUUIDProperties
      TRS Service49535343-FE7D-4AE5-8FA9-9FAFD205E455
      TRS TxD- Tx Data to Client role (Data pipe)49535343-1E4D-4BD9-BA61-23C647249616Notify, Write
      TRS TxD - Client Characteristic Configuration Descriptor Read, Write
      TRS RxD- Rx Data from Client role (Data pipe)49535343-8841-43F4-A8D4-ECBE34729BB3Write, Write without response
      TRS Ctrl Pt - Command and Response (Ctrl pipe)49535343-4C8A-39B3-2F49-511CFF073B7ENotify, Write, Write without response
      TRS Ctrl Pt - Client Characteristic Configuration descriptor Read, Write

3. "BLE Sensor" and "BLE Provisioner" Application over Transparent Service Control Point (TRS Ctrl Pt):

The combo application uses TRS Control Point Characteristic of TRPS profile to exchange data between "BLE Sensor" and "BLE Provisioner" mobile app and device.

The combo application follows the below protocol format on TRS control point characteristic.

ItemOpcodeLengthSensor/Provisioning/Control IDPayload
Size1 Byte1 Byte1 ByteVariable

The description of each element is as below:

- The Opcode:
   - (0x81) is fixed 1 byte in size and related to Provisioning commands.
   - (0x8A) is fixed 1 byte in size and related to BLE Sensor/Control commands
- Length: 1 byte in size (size of Sensor/Control ID + size of Payload)
- The Sensor/Control ID: 1 byte in size. It could be divided into Control request, Control response, Sensor/Provisioning notify data described in detail in following sections.
- The Sensor/Provisioning/control data and payload size depends on the ID as listed in the below table.

BLE sensor specific control and sensor command/response

Control Cmd Opcode Control Request ID Parameter Parameter Length (Byte) Control Response ID Control Response Payload Control Response Payload Length (Byte) Description
RGB LED On/Off Set0x8A0x10On/Off10x20Status code1Switch On/Off the RGB LED with the default/last set color
RGB LED On/Off Get0x8A0x11 0x21Status code + On/Off status2Send the RGB LED on/off status
RGB Color Set0x8A0x12Color value (HSV)30x22Status code1Set RGB color value in HSV format
RGB Color Get0x8A0x13 0x23Status code + RGB color value4Send RGB color value in HSV format
Sensor Data Sensor ID Parameter Parameter Length (Byte) Description
RGB LED On/Off status0x8A 0x40On/Off status1RGB LED On/Off Status
Temperature data0x8A 0x41Temperature sensor data2Temperature value in Celsius with 0.1 resolution. The MSB bit will be set when the negative temperature is reported
RGB Color Values0x8A 0x42RGB Color Values3RGB color values in HSV Format

BLE Provisioning specific control and command/response

Commissioning Cmd Op Code Commission Request ID Parameter Parameter Length (Byte) Commission Response ID Commission Response Payload Commission Response Payload Length (Byte) Description
GetDeviceType0x8150 A0Device Type2Get Zigbee device type (Device type see table 8)
GetSWVersion0x8151 A1Software VersionUp to 16 bytesGet Software Version
SetDeviceName0x8152Device NameUp to 16 bytesA2 Get Network State
GetDeviceName0x8153 A3Device NameUp to 16 bytesGet Device State
SetChannelMap0x8154Channel map4A4 Set Zigbee channel bit map
GetChannelMap0x8155 A5Channel map4Get Zigbee channel bit map
GetDeviceState0x8156 A6Device State1Set Zigbee MAC ID
GetMACID0x8157 A7MAC ID8Get Zigbee MAC ID
GetCommisionStatus0x8158 A8commissioning Status1Get commissioning Status
GetCurrentChannel0x8159 A9Current Channel1Get Zigbee install code
StartCommission0x815E AE Start Commission
ResetFactoryNew0x815F AF Reset to Factory New state
Commissioning Cmd Commission Response ID Commission Response Payload Commission Response Payload Length (Byte) Description
commissioningStatus0x81 60commissioning Status1

3.1 Control Command Request and Response

The Control command request is used by mobile app to send the command to device. The control request channel is opened only after Client Characteristic Configuration Descriptor of TRS Ctrl Pt Characteristic notification is enabled; it is closed when such notification is disabled.

The format of Control command is an 8bit Opcode, an 8bit request ID followed by optional control payload.

Format of Control Command

Item Op CodeLengthControl Request IDControl Payload
Size (Octet) 111Variable

The control response is used by the device to send feedback to mobile app. The format of Response is an 8bit Opcode, an 8bit response ID and response status followed by optional Response payload.

Format of Control Response Data

Item Op CodeLengthControl Response IDStatusControl Response Payload
Size (Octet) 1111Variable

Status code 0x00 means successful execution of control command. Any status code other than 0x00 means error code, as shown in below Table. An error status does not have optional control Response payload.

Definition of Status Code

Status Code Definition Description
0x00 SuccessResponse for successful operation
0x01 Op Code Not SupportedResponse if unsupported Op Code is received
0x02 Invalid ParameterResponse if Parameter received does not meet the requirements of the service.
0x03 Operation FailResponse for fail operation
0x04-0xFF Reserved for Future use

3.2 Sensor/Provisioning Notify Data

The Sensor data is sent to mobile app periodically by WBZ451 device. Similarly the commissioning status is sent to "BLE provisioner" during the commissioning procedure. The data channel is opened only after Client Characteristic Configuration Descriptor of TRS Ctrl Pt notification is enabled; it is closed when such notification is disabled.

The format of sensor data is an 8 bit Opcode, an 8bit ID followed by notify data payload.

Format of Sensor/Provisioning Data

Item Op CodeLengthSensor/Provisioning IDSensor/Provisioning Payload
Size (Octet) 111Variable

Application Flow Diagram