How can use CHIP tool to commission device by QR code or manual pairing code?

 

        This is my basic information:

        1. SDK version: V2.8.0

        2. Project: Matter Light Bulb

        3. Board: 52840DK

        This is my question:

        I can use this command to commission bulb pass:

        $ ./chip-tool pairing ble-thread <node_id> hex:<operational_dataset> <pin_code> <discriminator>

        But when I use below command instead, bulb has no response:

        $ ./chip-tool pairing code <node_id> <qrcode_payload-or-manual_code>

  • This is CHIP log:

    ubuntu@ubunbtu:~/apps$ ./chip-tool pairing code 5 34970112332
    [1758015816.420] [14688:14688] [DL] ChipLinuxStorage::Init: Using KVS config file: /tmp/chip_tool_kvs
    [1758015816.421] [14688:14688] [DL] ChipLinuxStorage::Init: Attempt to re-initialize with KVS config file: /tmp/chip_kvs
    [1758015816.427] [14688:14688] [DL] ChipLinuxStorage::Init: Using KVS config file: /tmp/chip_factory.ini
    [1758015816.427] [14688:14688] [DL] ChipLinuxStorage::Init: Using KVS config file: /tmp/chip_config.ini
    [1758015816.427] [14688:14688] [DL] ChipLinuxStorage::Init: Using KVS config file: /tmp/chip_counters.ini
    [1758015816.434] [14688:14688] [DL] Wrote settings to /tmp/chip_counters.ini
    [1758015816.434] [14688:14688] [DL] NVS set: chip-counters/reboot-count = 6 (0x6)
    [1758015816.435] [14688:14688] [DL] Got Ethernet interface: eth0
    [1758015816.435] [14688:14688] [DL] Found the primary Ethernet interface:eth0
    [1758015816.436] [14688:14688] [DL] Got WiFi interface: wlan0
    [1758015816.436] [14688:14688] [DL] Failed to reset WiFi statistic counts
    [1758015816.436] [14688:14688] [IN] UDP::Init bind&listen port=0
    [1758015816.436] [14688:14688] [IN] UDP::Init bound to port=45590
    [1758015816.436] [14688:14688] [IN] BLEBase::Init - setting/overriding transport
    [1758015816.436] [14688:14688] [IN] TransportMgr initialized
    [1758015816.436] [14688:14688] [FP] Initializing FabricTable from persistent storage
    [1758015816.436] [14688:14688] [TS] Last Known Good Time: 2023-10-14T01:16:48
    [1758015816.438] [14688:14688] [FP] Fabric index 0x1 was retrieved from storage. Compressed FabricId 0x4CBEDD0E38A1813B, FabricId 0x0000000000000001, NodeId 0x000000000001B669, VendorId 0xFFF1
    [1758015816.440] [14688:14688] [ZCL] Using ZAP configuration...
    [1758015816.446] [14688:14688] [DL] Avahi client registered
    [1758015816.446] [14688:14688] [IM] WARNING ┌────────────────────────────────────────────────────
    [1758015816.446] [14688:14688] [IM] WARNING │ Interaction Model Engine running in 'Checked' mode.
    [1758015816.446] [14688:14688] [IM] WARNING │ This executes BOTH ember and data-model code paths.
    [1758015816.447] [14688:14688] [IM] WARNING │ which is inefficient and consumes more flash space.
    [1758015816.447] [14688:14688] [IM] WARNING │ This should be done for testing only.
    [1758015816.447] [14688:14688] [IM] WARNING └────────────────────────────────────────────────────
    [1758015816.447] [14688:14688] [CTL] System State Initialized...
    [1758015816.447] [14688:14688] [CTL] Setting attestation nonce to random value
    [1758015816.447] [14688:14688] [CTL] Setting CSR nonce to random value
    [1758015816.447] [14688:14688] [IN] UDP::Init bind&listen port=5550
    [1758015816.448] [14688:14688] [IN] UDP::Init bound to port=5550
    [1758015816.448] [14688:14688] [IN] TransportMgr initialized
    [1758015816.448] [14688:14690] [DL] CHIP task running
    [1758015816.448] [14688:14690] [DL] HandlePlatformSpecificBLEEvent 32786
    [1758015816.449] [14688:14690] [CTL] Setting attestation nonce to random value
    [1758015816.449] [14688:14690] [CTL] Setting CSR nonce to random value
    [1758015816.450] [14688:14690] [CTL] Generating NOC
    [1758015816.451] [14688:14690] [FP] Validating NOC chain
    [1758015816.454] [14688:14690] [FP] NOC chain validation successful
    [1758015816.454] [14688:14690] [FP] Updated fabric at index: 0x1, Node ID: 0x000000000001B669
    [1758015816.454] [14688:14690] [TS] Last Known Good Time: 2023-10-14T01:16:48
    [1758015816.454] [14688:14690] [TS] New proposed Last Known Good Time: 2021-01-01T00:00:00
    [1758015816.454] [14688:14690] [TS] Retaining current Last Known Good Time
    [1758015816.457] [14688:14690] [FP] Metadata for Fabric 0x1 persisted to storage.
    [1758015816.458] [14688:14690] [TS] Committing Last Known Good Time to storage: 2023-10-14T01:16:48
    [1758015816.460] [14688:14690] [CTL] Joined the fabric at index 1. Fabric ID is 0x0000000000000001 (Compressed Fabric ID: 4CBEDD0E38A1813B)
    [1758015816.460] [14688:14690] [IN] UDP::Init bind&listen port=5550
    [1758015816.460] [14688:14690] [IN] UDP::Init bound to port=5550
    [1758015816.460] [14688:14690] [IN] TransportMgr initialized
    [1758015816.475] [14688:14690] [CTL] Setting attestation nonce to random value
    [1758015816.475] [14688:14690] [CTL] Setting CSR nonce to random value
    [1758015816.476] [14688:14690] [CTL] Stopping commissioning discovery over DNS-SD
    [1758015816.476] [14688:14690] [CTL] Starting commissioning discovery over DNS-SD
    [1758015816.487] [14688:14690] [DL] Avahi browse: cache exhausted
    [1758015817.491] [14688:14690] [DL] Avahi browse: all for now
    [1758015846.505] [14688:14690] [CTL] Discovery timed out
    [1758015846.505] [14688:14690] [CTL] Stopping commissioning discovery over DNS-SD
    [1758015846.505] [14688:14690] [TOO] Secure Pairing Failed
    [1758015846.506] [14688:14688] [CTL] Shutting down the commissioner
    [1758015846.506] [14688:14688] [CTL] Stopping commissioning discovery over DNS-SD
    [1758015846.506] [14688:14688] [CTL] Shutting down the controller
    [1758015846.506] [14688:14688] [IN] Expiring all sessions for fabric 0x1!!
    [1758015846.506] [14688:14688] [FP] Forgetting fabric 0x1
    [1758015846.506] [14688:14688] [TS] Pending Last Known Good Time: 2023-10-14T01:16:48
    [1758015846.507] [14688:14688] [TS] Previous Last Known Good Time: 2023-10-14T01:16:48
    [1758015846.507] [14688:14688] [TS] Reverted Last Known Good Time to previous value
    [1758015846.507] [14688:14688] [CTL] Shutting down the commissioner
    [1758015846.507] [14688:14688] [CTL] Shutting down the controller
    [1758015846.507] [14688:14688] [CTL] Shutting down the System State, this will teardown the CHIP Stack
    [1758015846.507] [14688:14688] [DMG] All ReadHandler-s are clean, clear GlobalDirtySet
    [1758015846.508] [14688:14688] [FP] Shutting down FabricTable
    [1758015846.508] [14688:14688] [TS] Pending Last Known Good Time: 2023-10-14T01:16:48
    [1758015846.508] [14688:14688] [TS] Previous Last Known Good Time: 2023-10-14T01:16:48
    [1758015846.508] [14688:14688] [TS] Reverted Last Known Good Time to previous value
    [1758015846.515] [14688:14688] [DL] Wrote settings to /tmp/chip_counters.ini
    [1758015846.515] [14688:14688] [DL] NVS set: chip-counters/total-operational-hours = 0 (0x0)
    [1758015846.515] [14688:14688] [DL] Inet Layer shutdown
    [1758015846.515] [14688:14688] [DL] BLE Layer shutdown
    [1758015846.515] [14688:14688] [DL] System Layer shutdown
    [1758015846.516] [14688:14688] [TOO] Run command failure: ../../examples/chip-tool/commands/pairing/PairingCommand.cpp:372: CHIP Error 0x00000003: Incorrect state

  • This is bulb log:

    [2025-09-16 17:43:10.453]
    uart:~$ *** Booting My Application v2.8.0-a2386bfc8401 ***[2025-09-16 17:43:10.453]
    *** Using nRF Connect SDK v2.8.0-a2386bfc8401 ***[2025-09-16 17:43:10.469]
    *** Using Zephyr OS v3.7.99-0bc3393fb112 ***[2025-09-16 17:43:10.469]
    I: 39 [DL]BLE address: D4:E5:33:F7:53:6D[2025-09-16 17:43:10.469]
    I: 49 [DL]CHIP task running[2025-09-16 17:43:10.484]
    I: Init CHIP stack[2025-09-16 17:43:10.484]
    I: 55 [DL]OpenThread started: OK[2025-09-16 17:43:10.484]
    I: 58 [DL]Setting OpenThread device type to ROUTER[2025-09-16 17:43:10.500]
    D: Registered new test event: 0xffffffff00000000[2025-09-16 17:43:10.500]
    D: Registered new test event: 0xffffffff10000000[2025-09-16 17:43:10.500]
    I: 72 [SVR]Subscription persistence not supported[2025-09-16 17:43:10.516]
    I: 77 [SVR]Server initializing...[2025-09-16 17:43:10.516]
    I: 80 [TS]Last Known Good Time: 2023-10-14T01:16:48[2025-09-16 17:43:10.516]
    I: 85 [DMG]AccessControl: initializing[2025-09-16 17:43:10.516]
    I: 89 [DMG]Examples::AccessControlDelegate::Init[2025-09-16 17:43:10.531]
    I: 93 [DMG]AccessControl: setting[2025-09-16 17:43:10.531]
    I: 96 [DMG]DefaultAclStorage: initializing[2025-09-16 17:43:10.531]
    I: 100 [DMG]DefaultAclStorage: 0 entries loaded[2025-09-16 17:43:10.531]
    D: 104 [IN]UDP::Init bind&listen port=5540[2025-09-16 17:43:10.547]
    E: 108 [IN]IPV6_PKTINFO failed: 109[2025-09-16 17:43:10.547]
    D: 112 [IN]UDP::Init bound to port=5540[2025-09-16 17:43:10.547]
    D: 115 [IN]BLEBase::Init - setting/overriding transport[2025-09-16 17:43:10.547]
    D: 120 [IN]TransportMgr initialized[2025-09-16 17:43:10.547]
    D: 127 [DL]Using Thread extended MAC for hostname.[2025-09-16 17:43:10.563]
    I: 133 [ZCL]Using ZAP configuration...[2025-09-16 17:43:10.563]
    I: 139 [DMG]AccessControlCluster: initializing[2025-09-16 17:43:10.578]
    D: 143 [DL]Boot reason: 1[2025-09-16 17:43:10.578]
    I: 146 [ZCL]Initiating Admin Commissioning cluster.[2025-09-16 17:43:10.578]
    I: 151 [ZCL]Endpoint 1 On/off already set to new value[2025-09-16 17:43:10.594]
    I: 156 [ZCL]Cluster LevelControl: attribute CurrentLevel set to 254[2025-09-16 17:43:10.594]
    D: 163 [IN]SecureSession[0x200036a0]: Allocated Type:1 LSID:43633[2025-09-16 17:43:10.594]
    D: 169 [DL]CHIPoBLE advertising set to on[2025-09-16 17:43:10.609]
    I: 172 [DIS]Updating services using commissioning mode 1[2025-09-16 17:43:10.609]
    E: 178 [DIS]Failed to remove advertised services: 3[2025-09-16 17:43:10.609]
    D: 182 [DL]Using Thread extended MAC for hostname.[2025-09-16 17:43:10.625]
    I: 187 [DIS]Advertise commission parameter vendorID=65521 productID=32773 discriminator=3840/15 cm=1 cp=0[2025-09-16 17:43:10.625]
    E: 196 [DIS]Failed to advertise commissionable node: 3[2025-09-16 17:43:10.641]
    E: 201 [DIS]Failed to finalize service update: 3[2025-09-16 17:43:10.641]
    I: 206 [DIS]Updating services using commissioning mode 1[2025-09-16 17:43:10.641]
    E: 211 [DIS]Failed to remove advertised services: 3[2025-09-16 17:43:10.641]
    D: 215 [DL]Using Thread extended MAC for hostname.[2025-09-16 17:43:10.656]
    I: 220 [DIS]Advertise commission parameter vendorID=65521 productID=32773 discriminator=3840/15 cm=1 cp=0[2025-09-16 17:43:10.656]
    E: 229 [DIS]Failed to advertise commissionable node: 3[2025-09-16 17:43:10.672]
    E: 234 [DIS]Failed to finalize service update: 3[2025-09-16 17:43:10.672]
    I: 239 [IN]CASE Server enabling CASE session setups[2025-09-16 17:43:10.672]
    D: 244 [IN]SecureSession[0x20003770]: Allocated Type:2 LSID:43634[2025-09-16 17:43:10.688]
    I: 250 [SVR]Joining Multicast groups[2025-09-16 17:43:10.688]
    I: 253 [SVR]Server Listening...[2025-09-16 17:43:10.688]
    I: 256 [DL]Device Configuration:[2025-09-16 17:43:10.688]
    I: 259 [DL]  Serial Number: 11223344556677889900[2025-09-16 17:43:10.703]
    I: 264 [DL]  Vendor Id: 65521 (0xFFF1)[2025-09-16 17:43:10.703]
    I: 267 [DL]  Product Id: 32773 (0x8005)[2025-09-16 17:43:10.703]
    I: 271 [DL]  Product Name: not-specified[2025-09-16 17:43:10.703]
    I: 274 [DL]  Hardware Version: 0[2025-09-16 17:43:10.703]
    I: 277 [DL]  Setup Pin Code (0 for UNKNOWN/ERROR): 20202021[2025-09-16 17:43:10.719]
    I: 283 [DL]  Setup Discriminator (0xFFFF for UNKNOWN/ERROR): 3840 (0xF00)[2025-09-16 17:43:10.719]
    I: 289 [DL]  Manufacturing Date: 2022-01-01[2025-09-16 17:43:10.719]
    I: 293 [DL]  Device Type: 65535 (0xFFFF)[2025-09-16 17:43:10.734]
    I: 297 [SVR]SetupQRCode: [MT:6FCJ142C00KA0648G00][2025-09-16 17:43:10.734]
    I: 302 [SVR]Copy/paste the below URL in a browser to see the QR Code:[2025-09-16 17:43:10.734]
    I: 308 [SVR]https://project-chip.github.io/connectedhomeip/qrcode.html?data=MT%3A6FCJ142C00KA0648G00[2025-09-16 17:43:10.750]
    I: 317 [SVR]Manual pairing code: [34970112332][2025-09-16 17:43:10.750]
    E: 321 [DL]Long dispatch time: 269 ms, for event type 2[2025-09-16 17:43:10.766]
    I: 326 [ZCL]Cluster OnOff: attribute OnOff set to 0[2025-09-16 17:43:10.766]
    I: 331 [ZCL]Cluster LevelControl: attribute CurrentLevel set to 254[2025-09-16 17:43:10.766]
    I: 339 [DL]CHIPoBLE advertising started[2025-09-16 17:43:10.781]
    I: 343 [DL]NFC Tag emulation started[2025-09-16 17:43:10.781]
    I: 30342 [DL]CHIPoBLE advertising mode changed to slow[2025-09-16 17:43:40.766]
    I: 30349 [DL]CHIPoBLE advertising started[2025-09-16 17:43:40.781]

  • Hi, 

    This is because the QR code command tries to commission the device over IP, and this device is not connected to the Thread network. The CHIP Tool tries to resolve the device IP address, and it fails. You can use the QR code command only if the device was connected to the Thread network before.

    Regards,
    Amanda H.

  •  

            Thanks for your response!

            AFAIK, if bulb has been connected to the Thread network, that means it is in the Thread network and can be controlled by Phone.

            Base above, why we need to commission it again by QR code or manual pairing code?

  • susepc said:
    if bulb has been connected to the Thread network, that means it is in the Thread network and can be controlled by Phone.

    That just means it's a node in the thread network, but doesn't belong to any Matter controller device. You still need to commission the device to a Matter controller (fabric) using its QR/manual code so it can exchange credentials, create secure sessions, and be authorized/owned by your controller app. See Commissioning into a network over IP section in Working with the CHIP Tool

Related