67  Matter Testing and Certification

In 60 Seconds

Matter certification requires CSA membership (minimum Adopter tier at $7,500/year), passing 1,000+ protocol conformance tests at an Authorized Test Lab, and verifying multi-ecosystem interoperability. Use CHIP Tool for development testing and run the Test Harness continuously throughout development to avoid costly late-stage certification failures.

67.1 Matter Testing and Certification

Time: ~12 min | Difficulty: Advanced | Unit: P08.C48.U04

Minimum Viable Understanding

Matter certification requires CSA membership (minimum Adopter tier at $7,500/year), passing 1,000+ protocol conformance tests at an Authorized Test Lab, and verifying interoperability with multiple ecosystems. Use CHIP Tool for command-line development testing, enable verbose debug logging with chip[XX] tags, and run the Test Harness continuously throughout development to avoid costly late-stage certification failures.

Learning Objectives

By the end of this section, you will be able to:

  • Execute CHIP Tool commands to commission, control, and inspect Matter devices
  • Configure verbose debug logging and classify log entries by chip[XX] tag categories
  • Capture and analyze Matter network traffic using Wireshark on Thread and Wi-Fi transports
  • Evaluate CSA membership tiers and map certification requirements to a product launch timeline
  • Design a pre-certification testing strategy that minimises ATL re-test costs

67.2 Prerequisites

Before diving into this chapter, you should be familiar with:

Matter certification ensures that any device with the Matter logo will work with any Matter controller (Apple Home, Google Home, Amazon Alexa, etc.). This requires rigorous testing:

  1. Protocol Conformance: Does your device follow the Matter specification exactly?
  2. Interoperability: Does it work with reference devices and controllers?
  3. Security: Are cryptographic implementations correct and secure?

Analogy: Think of it like a driving test. You can’t just claim you can drive - you need to prove it by passing standardized tests. Matter certification is the “driving test” for smart home devices.

67.3 Testing and Debugging

67.3.1 CHIP Tool (Command Line Testing)

The CHIP Tool is the official Matter testing utility:

# Build CHIP Tool
cd ~/connectedhomeip
source scripts/activate.sh
./scripts/examples/gn_build_example.sh examples/chip-tool out/chip-tool

# Commission device
./out/chip-tool/chip-tool pairing ble-thread 1 hex:THREAD_DATASET \
    20202021 3840

# Control light
./out/chip-tool/chip-tool onoff toggle 1 1
./out/chip-tool/chip-tool levelcontrol move-to-level 128 10 0 0 1 1

# Read attributes
./out/chip-tool/chip-tool onoff read on-off 1 1
./out/chip-tool/chip-tool basic read vendor-name 1 0

# Subscribe to changes
./out/chip-tool/chip-tool onoff subscribe on-off 1 60 1 1

67.3.2 Debug Logging

Enable verbose logging:

// In sdkconfig or menuconfig
CONFIG_LOG_DEFAULT_LEVEL_VERBOSE=y
CONFIG_CHIP_LOG_LEVEL_DEBUG=y

Log categories:

Tag Description
chip[DL] Device layer
chip[DMG] Data model
chip[IN] Interaction model
chip[SC] Security
chip[BLE] Bluetooth commissioning
chip[DIS] Discovery

67.3.3 Network Sniffing

Thread Network Capture:

# Using nRF52840 Dongle with Wireshark
# 1. Flash nRF Sniffer firmware
# 2. Install Wireshark nRF Sniffer plugin
# 3. Configure Thread network key

# Decrypt Thread traffic
# Edit > Preferences > Protocols > Thread
# Add Network Key from Border Router

Wi-Fi Matter Capture:

# Capture Matter over Wi-Fi
wireshark -i wlan0 -k -f "udp port 5540"

# Matter uses UDP port 5540 by default

Objective: Simulate the Matter certification test sequence on ESP32, demonstrating protocol conformance tests (On/Off, Level Control, Security) and showing how test pass/fail results determine certification readiness.

Paste this code into the Wokwi editor:

#include <WiFi.h>

struct TestCase {
  const char* id;
  const char* category;
  const char* description;
  bool pass;
  int durationMs;
};

// Simulated Matter certification tests
TestCase tests[] = {
  // On/Off cluster tests
  {"TC_OO_1_1", "On/Off",    "Read OnOff attribute",           true,  120},
  {"TC_OO_2_1", "On/Off",    "Toggle command",                 true,  180},
  {"TC_OO_2_2", "On/Off",    "On/Off with TimedRequest",       true,  250},
  {"TC_OO_2_3", "On/Off",    "Global scene control",           true,  200},
  // Level Control tests
  {"TC_LVL_1_1", "Level",    "Read CurrentLevel attribute",    true,  130},
  {"TC_LVL_3_1", "Level",    "MoveToLevel command",            true,  300},
  {"TC_LVL_5_1", "Level",    "Step command",                   false, 280},
  // Security tests
  {"TC_SC_1_1",  "Security", "PASE session establishment",     true,  500},
  {"TC_SC_3_1",  "Security", "CASE session establishment",     true,  450},
  {"TC_SC_3_3",  "Security", "CASE session resumption",        true,  200},
  {"TC_SC_4_1",  "Security", "Group key management",           true,  350},
  // Commissioning tests
  {"TC_CADMIN_1_3", "Admin", "Open commissioning window",      true,  400},
  {"TC_CADMIN_1_5", "Admin", "Revoke commissioning",           true,  300},
  {"TC_CADMIN_1_9", "Admin", "Multi-admin (max 5 fabrics)",    true,  600},
  // Discovery tests
  {"TC_DD_1_5",  "Discover", "DNS-SD service discovery",       true,  250},
  {"TC_DD_1_8",  "Discover", "Commissionable advertisement",   false, 200},
  // Data Model tests
  {"TC_DM_1_1",  "DataModel","Read ServerList attribute",      true,  150},
  {"TC_DM_2_1",  "DataModel","Read PartsList attribute",       true,  160},
};
int numTests = 18;

void setup() {
  Serial.begin(115200);
  delay(1000);

  Serial.println("=== Matter Certification Test Harness ===");
  Serial.println("Simulating CSA conformance test suite\n");

  // Device Under Test info
  Serial.println("Device Under Test:");
  Serial.println("  Type: Dimmable Light (0x0101)");
  Serial.println("  Vendor: 0xFFF1 (Test Vendor)");
  Serial.println("  Product: 0x8001");
  Serial.println("  Software: v1.2.0");
  Serial.println("  Endpoints: 0 (Root), 1 (Light)");
  Serial.println("  Clusters: Basic, OnOff, LevelControl, Groups\n");

  int passed = 0, failed = 0;
  unsigned long totalTime = 0;
  const char* failedTests[10];
  int failCount = 0;

  // Run test categories
  const char* categories[] = {"On/Off", "Level", "Security", "Admin", "Discover", "DataModel"};
  int numCats = 6;

  for (int c = 0; c < numCats; c++) {
    Serial.printf("--- %s Tests ---\n", categories[c]);

    for (int t = 0; t < numTests; t++) {
      if (strcmp(tests[t].category, categories[c]) != 0) continue;

      Serial.printf("[%s] %s... ", tests[t].id, tests[t].description);
      delay(50);  // Simulate test execution

      if (tests[t].pass) {
        Serial.printf("PASS (%dms)\n", tests[t].durationMs);
        passed++;
      } else {
        Serial.printf("FAIL (%dms)\n", tests[t].durationMs);
        failed++;
        if (failCount < 10) failedTests[failCount++] = tests[t].id;
      }
      totalTime += tests[t].durationMs;
    }
    Serial.println();
  }

  // Results summary
  Serial.println("========================================");
  Serial.println("CERTIFICATION TEST RESULTS");
  Serial.println("========================================");
  Serial.printf("Total tests:  %d\n", numTests);
  Serial.printf("Passed:       %d (%d%%)\n", passed, passed * 100 / numTests);
  Serial.printf("Failed:       %d\n", failed);
  Serial.printf("Total time:   %.1f seconds\n\n", totalTime / 1000.0);

  if (failed > 0) {
    Serial.println("FAILED TESTS (must fix before ATL submission):");
    for (int f = 0; f < failCount; f++) {
      Serial.printf("  - %s\n", failedTests[f]);
    }
    Serial.println("\nDiagnosis:");
    Serial.println("  TC_LVL_5_1: Step command transition time not");
    Serial.println("    matching specification (off by 20ms)");
    Serial.println("  TC_DD_1_8: Commissionable service not advertising");
    Serial.println("    correct VendorID in TXT record\n");

    Serial.println("STATUS: NOT READY FOR CERTIFICATION");
    Serial.println("Fix failures and re-run before scheduling ATL test.");
  } else {
    Serial.println("STATUS: READY FOR ATL SUBMISSION");
  }

  // Cost estimate
  Serial.println("\n--- Certification Cost Estimate ---");
  Serial.println("CSA Membership (Adopter):  $7,500/year");
  Serial.println("ATL Testing:               $15,000-30,000");
  Serial.println("Re-test (per failure):     $5,000-10,000");
  Serial.printf("Estimated total:           $%s\n",
                failed > 0 ? "27,500-47,500 (includes re-test)" :
                             "22,500-37,500");
}

void loop() {
  delay(10000);
}

Let’s calculate the total first-year cost for a startup bringing a Matter smart bulb to market with CSA Community membership:

\[\text{Year 1 Total} = \text{CSA Membership} + \text{ATL Testing} + \text{Certification Fee}\]

\[= \$7{,}500 + \$15{,}000 + \$8{,}000 = \$30{,}500\]

If planning 5 product SKUs over 3 years, the amortized per-product cost is \(\$30{,}500 + (4 \times \$8{,}000)\)/5 = \(\$12{,}500\) per product. This excludes engineering time for test harness integration (typically 40-60 hours at \(\$150\)/hr = \(\$6{,}000\)-\(\$9{,}000\) additional per product). For volume manufacturers (>100k units/year), the ~\(\$20k\) per-product certification cost is negligible, but for small startups shipping <10k units, it represents \(\$2\)-\(\$4\) per unit sold.

What to Observe:

  1. Test categories cover the full Matter specification: On/Off commands, Level Control, Security (PASE/CASE), Commissioning Admin, Discovery (DNS-SD), and Data Model – all 1,000+ tests must pass
  2. Two tests fail (TC_LVL_5_1 and TC_DD_1_8) with specific diagnostic output – real test harness failures require reading logs to identify root causes before re-testing
  3. Certification cost is $22,500-47,500 minimum (CSA membership + ATL testing) – each re-test adds $5,000-10,000, which is why running the test harness continuously during development saves money
  4. Multi-admin test (TC_CADMIN_1_9) verifies the device supports 5 simultaneous fabrics – this is what enables one device to work with Apple, Google, and Amazon simultaneously

67.4 Matter Certification

67.4.1 Certification Process Overview

Matter certification flowchart showing steps: Start Development, Join CSA ($7,500-$170,000/year), Obtain Vendor ID, Develop Product, Self-Testing with Test Harness, ATL Testing at Authorized Test Lab, Submit Declaration of Conformity to CSA, Certification Granted with logo rights, Product Launch. Green endpoints indicate successful certification completion.
Figure 67.1: Matter Certification Process from CSA Membership to Product Launch

67.4.2 CSA Membership Tiers

Tier Annual Fee Benefits
Adopter $7,500 Certify products, basic logo
Participant $25,000 + Working group access
Promoter $75,000 + Steering committee
Board $170,000 + Board representation

67.4.3 Certification Requirements

Required Testing:

Category Tests Purpose
Protocol Conformance ~1,000+ Verify Matter protocol
Interoperability Varies Test with reference devices
Security ~50 Verify cryptographic implementation
Device Type Per type Verify cluster implementation

67.4.4 Test Harness

The Matter Test Harness automates certification testing:

# Run Test Harness
cd ~/connectedhomeip
python3 scripts/tests/run_test.py \
    --target-app chip-tool \
    --target-type all \
    --tests TC_OO_1_1 TC_OO_2_1  # On/Off cluster tests

Test Categories:

Prefix Category Example
TC_OO On/Off TC_OO_2_1 (Toggle command)
TC_LVL Level Control TC_LVL_3_1 (Move command)
TC_CC Color Control TC_CC_5_1 (Color temperature)
TC_SC Security TC_SC_3_1 (CASE handshake)
TC_CADMIN Commissioning TC_CADMIN_1_3 (Multi-admin)

67.5 Pre-Certification Testing Strategy

67.5.1 Comprehensive Testing Approach

1. Self-testing with Test Harness:

  • Run full TC_* test suite
  • Focus on device-type-specific tests (e.g., On/Off Plug-In Unit)
  • Run interoperability tests

2. Controller compatibility testing:

  • Test with Apple Home (HomePod)
  • Test with Google Home (Nest Hub)
  • Test with Amazon Alexa (Echo)
  • Test with Home Assistant

3. Stress testing:

  • 10,000 on/off cycles
  • Multi-admin (3+ fabrics)
  • Network disconnection/reconnection
  • OTA update scenarios

4. Pre-ATL review:

  • Contact ATL early for consultation
  • Review common failure points
  • Ensure manufacturing data provisioning works

67.6 Understanding Check

Knowledge Check

Scenario: You’re developing a Matter smart plug with energy monitoring for commercial sale. The plug should: - Support both Thread and Wi-Fi - Include power measurement (W, Wh) - Work with Apple, Google, and Amazon ecosystems - Ship in 6 months

Questions:

  1. Which SDK would you recommend and why?
  2. What CSA membership tier do you need?
  3. What unique data needs to be provisioned per device?
  4. How would you test before submitting for certification?

1. SDK Recommendation: ESP-Matter (ESP32-C6)

  • ESP32-C6 supports both Wi-Fi 6 and Thread (802.15.4)
  • Cost-effective ($3-5 in volume)
  • Well-documented with active community
  • Pre-certified RF modules available (reduces certification cost)
  • ESP-Matter includes energy monitoring examples

2. CSA Membership: Adopter ($7,500/year)

  • Minimum tier to certify products
  • Sufficient for product launch
  • Upgrade to Participant later if joining working groups

3. Per-Device Provisioning Data:

  • Device Attestation Certificate (DAC)
  • Device private key (in secure element or flash)
  • Unique 11-digit setup code
  • 12-bit discriminator
  • Serial number
  • QR code label with full payload

4. Pre-Certification Testing:

  1. Self-testing with Test Harness:
    • Run full TC_* test suite
    • Focus on device-type-specific tests (On/Off Plug-In Unit)
    • Run interoperability tests
  2. Controller compatibility testing:
    • Test with Apple Home (HomePod)
    • Test with Google Home (Nest Hub)
    • Test with Amazon Alexa (Echo)
    • Test with Home Assistant
  3. Stress testing:
    • 10,000 on/off cycles
    • Multi-admin (3+ fabrics)
    • Network disconnection/reconnection
    • OTA update scenarios
  4. Pre-ATL review:
    • Contact ATL early for consultation
    • Review common failure points
    • Ensure manufacturing data provisioning works

Sammy the Sensor wants to explain why testing matters so much! Imagine you built a new board game. Before you can sell it in stores, you need to prove:

  1. The rules work correctly (Protocol Conformance) – Every card, every move follows the official rulebook exactly. For Matter, that means passing over 1,000 tests!

  2. It plays well with others (Interoperability) – Your game pieces should work on other people’s boards too. A Matter light must work with Apple Home AND Google Home AND Amazon Alexa.

  3. The lock on the box works (Security) – Nobody should be able to cheat. The encryption must be implemented perfectly.

Max the Microcontroller explains the tools: “CHIP Tool is like a referee for your device. It sends commands, checks responses, and tells you if anything is wrong. Always test with the referee FIRST before going to the official tournament.”

Lila the LED warns: “The certification exam costs real money – you need a CSA membership ($7,500/year!) and must test at an official lab. If you fail, you pay again. So test early and test often with the free tools during development. Discovering a bug during certification is like failing your driving test because you never practiced parallel parking!”

Bella the Battery adds: “Turn on debug logging during development. It is like having a diary that records everything your device does – super helpful when something goes wrong.”

67.7 Decision Framework: Test Harness Failure Triage

When the Matter Test Harness reports failures, use this decision tree to quickly identify the root cause and fix:

Step 1: Identify the test category prefix

Prefix Category Common Issues First Debug Steps
TC_OO On/Off Cluster State not updating, commands not responding Check attribute callbacks, verify GPIO control
TC_LVL Level Control Incorrect transition times, level out of range Verify CurrentLevel updates, check transition math
TC_SC Security CASE handshake failures, certificate issues Check NOC validity, verify fabric credentials
TC_CADMIN Commissioning Multi-admin failures, window timeout Test commission window timeout, verify fabric table size
TC_DD Discovery DNS-SD not advertising, TXT records wrong Check mDNS responder, verify service advertisement
TC_DM Data Model Descriptor mismatch, cluster list wrong Validate endpoint descriptors, check cluster IDs

Step 2: Analyze failure mode

Failure Type A: “Attribute read returned unexpected value”

  • Root cause: Device state not synchronized with reported attributes
  • Example: TC_OO_1_1 fails - read OnOff attribute returns 0 when light is visibly on
  • Debug:
    1. Check attribute callback: Is hardware state read correctly?
    2. Add logging: Print attribute value before reporting
    3. Verify attribute is marked as reportable in cluster definition
  • Fix: Synchronize attribute update with hardware state change

Failure Type B: “Command not executed within timeout”

  • Root cause: Command handler not processing or taking too long
  • Example: TC_LVL_3_1 fails - MoveToLevel(128) command times out after 5 seconds
  • Debug:
    1. Check command callback: Is it registered in cluster?
    2. Measure execution time: Add timestamp logging
    3. Check for blocking operations in command handler
  • Fix: Make command handler async, return immediately and update state in background

Failure Type C: “CASE session establishment failed”

  • Root cause: Certificate or fabric credential issues
  • Example: TC_SC_3_1 fails - device cannot establish encrypted session
  • Debug:
    1. Verify NOC (Node Operational Certificate) is installed: chip-tool operationalcredentials read nocs 1 0
    2. Check fabric table: chip-tool operationalcredentials read fabrics 1 0
    3. Verify device clock is set correctly (certificate validity period)
  • Fix: Re-commission device to reinstall valid NOC, sync device clock

Failure Type D: “Multi-admin test failed - device rejected second fabric”

  • Root cause: Fabric table full, commission window not opened, or RAM exhaustion
  • Example: TC_CADMIN_1_9 fails - device accepts Fabric A but rejects Fabric B
  • Debug:
    1. Check fabric count: chip-tool operationalcredentials read fabrics 1 0 → should show < 5 fabrics
    2. Verify commission window was opened: Check logs for “Commission window opened”
    3. Check RAM usage: Multi-fabric CASE sessions consume 2-5 KB RAM each
  • Fix: Increase fabric table size, optimize session memory, ensure commission window open before second controller

Failure Type E: “DNS-SD service not discovered”

  • Root cause: mDNS not advertising, network multicast blocked, TXT records malformed
  • Example: TC_DD_1_8 fails - test harness cannot discover commissionable device
  • Debug:
    1. Check mDNS advertisement: dns-sd -B _matterc._udp . on same network → should list device
    2. Verify TXT records: Look for VP (Vendor ID), D (Discriminator), CM (Commissioning Mode)
    3. Check network: Multicast must be enabled (some Wi-Fi routers block it)
  • Fix: Enable mDNS responder, verify TXT record formatting, disable multicast filtering

Step 3: Reproduce with CHIP Tool

Before submitting to ATL, reproduce the exact failure locally:

# Run single test case
./chip-tool tests Test_TC_OO_1_1

# Run with verbose logging
./chip-tool --trace_decode 1 tests Test_TC_OO_1_1

# Capture network traffic simultaneously
tcpdump -i eth0 -w matter-test.pcap udp port 5540

Step 4: Fix and verify

After fix: 1. Run failing test case → should pass 2. Run full test category (e.g., all TC_OO tests) → verify no regressions 3. Run interoperability test with real controllers (Apple, Google, Amazon) 4. Document fix in test report for ATL submission

Common Fix Patterns:

  • Cluster attribute issues: Add attribute update callbacks, ensure reportable flag set
  • Command timing: Make handlers asynchronous, return success immediately
  • Security failures: Re-commission with fresh credentials, verify certificate validity
  • Multi-admin: Implement commission window management, increase fabric table size
  • Discovery: Enable mDNS, format TXT records correctly, check network multicast

Time-Saving Tip: 80% of test failures are in 20% of categories (OnOff, LevelControl, Security, Commissioning). Focus pre-ATL testing on these areas to catch most issues early.

Common Pitfalls

Matter certification tests include error injection, malformed message handling, and race conditions. Testing only successful commissioning and basic command invocation leaves failure handling untested and risks certification failure.

CSA certification lab scheduling requires weeks of lead time. Developers who complete development before engaging a certification lab often face delays of 4–8 weeks waiting for lab availability. Engage certification labs early.

Declaring optional features in your PICS that are not fully implemented to generate a wider list of capabilities leads to test failures on the very features you claimed. Only declare features you have fully implemented and tested.

:

Key Concepts

  • Matter Certification: The CSA process verifying that a Matter device correctly implements the specification, enabling use of the Matter badge and inclusion in the certified products database.
  • PICS (Protocol Implementation Conformance Statement): A document declaring which optional features of the Matter specification a device implements, guiding which test cases apply.
  • chip-tool: The command-line Matter controller included in the project-chip SDK, used for commissioning devices, invoking commands, and reading attributes during testing.
  • Test Harness: The software framework running Matter conformance tests against a device under test; CSA provides official test harness for certification testing.
  • OTA (Over-the-Air) Update Testing: Verification that the Matter OTA Requestor and Provider clusters correctly implement the firmware update workflow including signing validation.
  • Multi-Admin Testing: Testing that a Matter device correctly handles commissioning by multiple administrators and correctly enforces ACL access control for each fabric.

67.9 What’s Next

Topic Description
Thread Network Architecture Understand Thread mesh networking roles, topology, and Border Router operation
Matter Architecture and Fabric Review the data model, security layers, and fabric concepts that underpin certification tests
Matter SDKs and Development Environment Set up the development toolchain required to build and run the Test Harness
Prototyping Hardware Select ESP32-C6, nRF52840, or other hardware platforms for Matter development
CI/CD for IoT Integrate the Matter Test Harness into automated build and test pipelines
Testing and Validation Apply comprehensive testing strategies beyond protocol conformance