Matter (Project CHIP) - Creating Matter device example will not build.

I am going through the Nordic tutorial Creating Matter device ( developer.nordicsemi.com/.../ug_matter_gs_adding_clusters.html ) but I am getting errors during the build that I cannot resolve. I am able to build and run the template sample in nRF Connect SDK v2.0.0, everything works as expected, I am using an older version of the SDK because when using newer versions I cannot commission the device via the Android CHIP tool. I've only successfully commissioned end devices with nRF Connect SDK v2.0.0 sample projects.

The tutorial has you use the Zap tool to add the Matter Temperature Sensor endpoint with the clusters specified in the link above. I start the zap tool and then generate files using the following commands:

node src-script/zap-start.js --logStdout --gen ~/connectedhomeip/src/app/zap-templates/app-templates.json --zcl ~/connectedhomeip/src/app/zap-templates/zcl/zcl.json -i ~/Downloads/templateModified.zap

node src-script/zap-generate.js --genResultFile -z ./zcl-builtin/matter/zcl.json -g ~/connectedhomeip/src/app/zap-templates/app-templates.json -i ~/Downloads/templateModified.zap -o ./tmp/

This produces the following files which I then put into the ./src/zap-generated/

I make all the modifications called out in the tutorial linked above to .c and .h files as well as add zcl-callbacks.c into the src folder, but the build fails. See attached build output.2313.b_Output1.txt

Two errors appear.

First error

This error (../src/zap-generated/endpoint_config.h:84:1: error: conversion from '<brace-enclosed initializer list>' to 'EmberAfDefaultOrMinMaxAttributeValue' is ambiguous) repeats several times and I am confused because the brace enclosed initializer list is just a modified version of the original endpoint_config.h

Snippet from endpoint_config.h showing the brace enclosed initializer list:

#define ZAP_ATTRIBUTE_MASK(mask) ATTRIBUTE_MASK_ ## mask
// This is an array of EmberAfAttributeMetadata structures.
#define GENERATED_ATTRIBUTE_COUNT 18
#define GENERATED_ATTRIBUTES { \
\
  /* Endpoint: 1, Cluster: Identify (server) */ \
  { 0x00000000, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0x0) }, /* identify time */  \
  { 0x00000001, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(0x0) }, /* identify type */  \
  { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_SIMPLE_DEFAULT(0) }, /* FeatureMap */  \
  { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(4) }, /* ClusterRevision */  \
\
  /* Endpoint: 1, Cluster: On/Off (server) */ \
  { 0x00000000, ZAP_TYPE(BOOLEAN), 1, 0, ZAP_SIMPLE_DEFAULT(0) }, /* OnOff */  \
  { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_SIMPLE_DEFAULT(0) }, /* FeatureMap */  \
  { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(4) }, /* ClusterRevision */  \
...
...
...
The error appears to happen in C:\ncs\v2.0.0\modules\lib\matter\src\app\util\attribute-storage.cpp when the GENERATED_ATTRIBUTES is suppose to initialize the EmberAfDefaultOrMinMaxAttributeValue generatedAttributes[] variable in attribute-storage.cpp (see below):
constexpr const EmberAfAttributeMetadata generatedAttributes[]      = GENERATED_ATTRIBUTES;
Why does this updated version of endpoint_config.h cause this error but the unmodified file builds without errors?
Do the generated zap files also need to go into this directory -> C:\ncs\v2.0.0\modules\lib\matter\zzz_generated ?
Second error
C:/ncs/v2.0.0/modules/lib/matter/src/app/clusters/ota-requestor/DefaultOTARequestor.cpp:827:5: error: 'Controller' has not been declared
827 | Controller::OtaSoftwareUpdateProviderCluster cluster;
Other General info:
Platform: Windows 10
End Device: nRF52840 DK
Border router: Raspberry Pi 4 B
RCP: nRF52840 Dongle
IDE: VSCode
Matter Controller: Android CHIP Tool
Parents Reply Children
  • Thanks, here is the endpoint_config.h

    endpoint_config.h

    Am currently trying to modify the v2.1.0 Template sample project, will update later with results.

  • I attempted to use v2.1.0 Template sample project and it did build successfully but I cannot commission the end device. I mentioned this issue in my post. The only nRF Connect SDK sample projects I can commission end devices are in v2.0.0. So my reasoning is to fix build errors with v2.0.0 where I can commission end devices. 

    When attempting to commission an end device with the unmodified v2.1.0 Template sample project I get this UART output from the end device:

    Android CHIP Tool:

    I: 580 [SVR]SetupQRCode: [MT:Y.K9042C00KA0648G00]
    I: 585 [SVR]Copy/paste the below URL in a browser to see the QR Code:
    I: 591 [SVR]project-chip.github.io/.../qrcode.html
    I: 600 [SVR]Manual pairing code: [34970112332]
    I: 605 [DL]CHIP task running
    I: 610 [DL]CHIPoBLE advertising started
    I: 30614 [DL]CHIPoBLE advertising mode changed to slow
    I: 96405 [DL]BLE connection established (ConnId: 0x00)
    I: 96410 [DL]Current number of connections: 1/1
    I: 96415 [DL]CHIPoBLE advertising stopped
    D: 97488 [DL]Write request received for CHIPoBLE RX characteristic (ConnId 0x00)
    I: 97495 [BLE]local and remote recv window sizes = 5
    I: 97500 [BLE]selected BTP version 4
    I: 97503 [BLE]using BTP fragment sizes rx 244 / tx 244.
    D: 112503 [DL]ConnId: 0x00, New CCCD value: 0x0000
    E: 112508 [BLE]receive handshake timed out, closing ep 0x2000f358
    D: 112514 [IN]Clearing BLE pending packets.
    I: 112518 [BLE]Releasing end point's BLE connection back to application.
    I: 112524 [DL]Closing BLE GATT connection (ConnId 00)
    I: 112638 [DL]BLE GAP connection terminated (reason 0x16)
    I: 112643 [DL]Current number of connections: 0/1
    I: 112650 [DL]CHIPoBLE advertising started

    chip-tool on Mac:

    I: 555 [DL] Device Type: 65535 (0xFFFF)
    I: 559 [SVR]SetupQRCode: [MT:Y.K9042C00KA0648G00]
    I: 564 [SVR]Copy/paste the below URL in a browser to see the QR Code:
    I: 570 [SVR]project-chip.github.io/.../qrcode.html
    I: 579 [SVR]Manual pairing code: [34970112332]
    I: 584 [DL]CHIP task running
    I: 589 [DL]CHIPoBLE advertising started
    I: 30593 [DL]CHIPoBLE advertising mode changed to slow
    I: 30593 [DL]CHIPoBLE advertising mode changed to slow
    I: 89230 [DL]BLE connection established (ConnId: 0x00)
    I: 89235 [DL]Current number of connections: 1/1
    I: 89239 [DL]CHIPoBLE advertising stopped
    I: 91350 [DL]BLE GAP connection terminated (reason 0x08)
    I: 91355 [DL]Current number of connections: 0/1
    I: 91362 [DL]CHIPoBLE advertising started
    I: 91644 [DL]BLE connection established (ConnId: 0x00)
    I: 91649 [DL]Current number of connections: 1/1
    I: 91653 [DL]CHIPoBLE advertising stopped
    I: 93783 [DL]BLE GAP connection terminated (reason 0x08)
    I: 93788 [DL]Current number of connections: 0/1
    I: 93794 [DL]CHIPoBLE advertising started
    I: 94644 [DL]BLE connection established (ConnId: 0x00)
    I: 94649 [DL]Current number of connections: 1/1
    I: 94654 [DL]CHIPoBLE advertising stopped
    I: 96769 [DL]BLE GAP connection terminated (reason 0x08)
    I: 96774 [DL]Current number of connections: 0/1
    I: 96781 [DL]CHIPoBLE advertising started
    I: 96841 [DL]BLE connection established (ConnId: 0x00)
    I: 96846 [DL]Current number of connections: 1/1
    I: 96850 [DL]CHIPoBLE advertising stopped
    I: 98978 [DL]BLE GAP connection terminated (reason 0x08)
    I: 98983 [DL]Current number of connections: 0/1
    I: 98989 [DL]CHIPoBLE advertising started
    I: 99052 [DL]BLE connection established (ConnId: 0x00)
    I: 99057 [DL]Current number of connections: 1/1
    I: 99061 [DL]CHIPoBLE advertising stopped
    I: 101172 [DL]BLE GAP connection terminated (reason 0x08)
    I: 101177 [DL]Current number of connections: 0/1
    I: 101183 [DL]CHIPoBLE advertising started
    I: 101225 [DL]BLE connection established (ConnId: 0x00)
    I: 101229 [DL]Current number of connections: 1/1
    I: 101234 [DL]CHIPoBLE advertising stopped
    I: 103351 [DL]BLE GAP connection terminated (reason 0x08)
    I: 103356 [DL]Current number of connections: 0/1
    I: 103362 [DL]CHIPoBLE advertising started
    I: 103398 [DL]BLE connection established (ConnId: 0x00)
    I: 103403 [DL]Current number of connections: 1/1
    I: 103407 [DL]CHIPoBLE advertising stopped
    I: 105520 [DL]BLE GAP connection terminated (reason 0x08)
    I: 105525 [DL]Current number of connections: 0/1
    I: 105531 [DL]CHIPoBLE advertising started
    I: 105575 [DL]BLE connection established (ConnId: 0x00)
    I: 105580 [DL]Current number of connections: 1/1
    I: 105584 [DL]CHIPoBLE advertising stopped
    I: 107713 [DL]BLE GAP connection terminated (reason 0x08)
    I: 107719 [DL]Current number of connections: 0/1
    I: 107725 [DL]CHIPoBLE advertising started
    I: 107781 [DL]BLE connection established (ConnId: 0x00)
    I: 107786 [DL]Current number of connections: 1/1
    I: 107791 [DL]CHIPoBLE advertising stopped
    I: 109914 [DL]BLE GAP connection terminated (reason 0x08)
    I: 109919 [DL]Current number of connections: 0/1
    I: 109925 [DL]CHIPoBLE advertising started
    I: 110295 [DL]BLE connection established (ConnId: 0x00)
    I: 110300 [DL]Current number of connections: 1/1
    I: 110305 [DL]CHIPoBLE advertising stopped
    I: 110330 [DL]BLE GAP connection terminated (reason 0x13)
    I: 110335 [DL]Current number of connections: 0/1
    I: 110342 [DL]CHIPoBLE advertising started

Related