Matter CYW30739 Lock Example#

An example showing the use of Matter on the Infineon CYW30739 platform.


Table of Contents#


Introduction#

The CYW30739 lock example provides a baseline demonstration of a door lock control device, built using Matter and the Infineon Modustoolbox SDK. It can be controlled by a Matter controller over Thread network.

The CYW30739 device can be commissioned over Bluetooth Low Energy where the device and the Matter controller will exchange security information with the Rendez-vous procedure. Target Thread Network information including the active dataset and CASE credentials are then provided.

Installing ModusToolbox™ Software#

Follow the Installation Guide to download and install the ModusToolbox™ Software.

ModusToolbox™ tools package#

ModusToolbox™ tools package should be automatically installed in the default location if you followed the Installation Guide. Please refer to the Installation Guide for the default location for different operating systems.

If you need to install the ModusToolbox™ tools package in a custom location, you must set the environment variable CY_TOOLS_PATHS to the /path/to/ModusToolbox/tools_x.x to specify the location of tools.

export CY_TOOLS_PATHS="/path/to/ModusToolbox/tools_x.x"

Note for WSL (Windows Subsystem for Linux)#

If you are using WSL, please ensure you have installed the ModusToolbox™ Software for Linux. Running Windows tools directly from the WSL command line would cause path resolution failure in the build process.

Checkout Submodules#

Before building the example, check out the Matter repository and sync submodules using the following command:

$ cd ~/connectedhomeip
$ scripts/checkout_submodules.py --platform infineon

Building#

  • Build the example application:

    $ cd ~/connectedhomeip
    $ scripts/examples/gn_build_example.sh examples/lock-app/infineon/cyw30739 out/cyw30739-lock
    
  • OR use GN/Ninja directly

    $ cd ~/connectedhomeip
    $ source scripts/activate.sh
    $ gn gen --root=examples/lock-app/infineon/cyw30739 out/cyw30739-lock
    $ ninja -C out/cyw30739-lock [lock_app-BOARD_NAME]
    
  • To delete generated executable, libraries and object files use:

    $ cd ~/connectedhomeip
    $ rm -rf out/cyw30739-lock
    

Factory Data#

Commissionable Data#

Infineon CYW30739 examples use test passcode, discriminator and PAKE parameters by default. For a production build, manufacturers should override commissionable data by the following arguments:

  • matter_passcode, matter_discriminator, matter_pake_iteration_count, matter_pake_salt

    $ cd ~/connectedhomeip
    $ scripts/examples/gn_build_example.sh examples/lock-app/infineon/cyw30739 out/cyw30739-lock \
    'matter_passcode=20202021' \
    'matter_discriminator=3840' \
    'matter_pake_iteration_count=1000' \
    'matter_pake_salt="U1BBS0UyUCBLZXkgU2FsdA=="'
    

Device Information#

Infineon CYW30739 examples support overriding the default device information by the following arguments:

  • matter_vendor_name

  • matter_vendor_id

  • matter_product_name

  • matter_product_id

  • matter_serial_number

  • matter_hardware_version

  • matter_hardware_version_string

To override the default device information, pass the desired values to the gn_build_example.sh script as arguments.

```bash
$ cd ~/connectedhomeip
$ scripts/examples/gn_build_example.sh examples/lock-app/infineon/cyw30739 out/cyw30739-lock \
'matter_vendor_name="Infineon"' \
'matter_vendor_id="0x1388"' \
'matter_product_name="TEST_PRODUCT"' \
'matter_product_id="0x0001"' \
'matter_serial_number="TEST_SN"' \
'matter_hardware_version=30739' \
'matter_hardware_version_string="30739"'
```

DAC / DAC Key / PAI Certificate / Certificate Declaration#

Infineon CYW30739 examples use development certifications, keys, and CD by default. For a production build, manufacturers can provision certifications, keys, and CD by the following arguments:

  • matter_att_cert, matter_att_cert_password, matter_cd

    $ cd ~/connectedhomeip
    $ scripts/examples/gn_build_example.sh examples/lock-app/infineon/cyw30739 out/cyw30739-lock \
    'matter_att_cert="/path/to/att_cert.p12"' \
    'matter_att_cert_password="password"' \
    'matter_cd="/path/to/cd.der"'
    

Flashing the Application#

Enter Recovery Mode#

Put the CYW30739 in to the recovery mode before running the flash script.

  1. Press and hold the RECOVERY button on the board.

  2. Press and hold the RESET button on the board.

  3. Release the RESET button.

  4. After one second, release the RECOVERY button.

Run Flash Script#

  • On the command line:

    $ cd ~/connectedhomeip
    $ out/cyw30739-lock/lock_app-BOARD_NAME.flash.py --port <port>
    

Running the Complete Example#

  • It is assumed here that you already have an OpenThread border router configured and running. If not see the following guide Openthread_border_router for more information on how to setup a border router on a raspberryPi.

  • You can provision and control the Chip device using the python controller, Chip tool standalone, Android or iOS app

    Python Controller

    Here is an example with the Python controller:

    $ chip-device-ctrl
    chip-device-ctrl > connect -ble 3840 20202021 1234
    chip-device-ctrl > zcl NetworkCommissioning AddThreadNetwork 1234 0 0 operationalDataset=hex:0e080000000000000000000300000b35060004001fffe00208dead00beef00cafe0708fddead00beef000005108e11d8ea8ffaa875713699f59e8807e0030a4f70656e5468726561640102c2980410edc641eb63b100b87e90a9980959befc0c0402a0fff8 breadcrumb=0 timeoutMs=1000
    chip-device-ctrl > zcl NetworkCommissioning EnableNetwork 1234 0 0 networkID=hex:dead00beef00cafe breadcrumb=0 timeoutMs=1000
    chip-device-ctrl > close-ble
    chip-device-ctrl > resolve 1234
    chip-device-ctrl > zcl OnOff Toggle 1234 1 0