tree: 20ba9481524f9d50b774ad9a70dad2bca100976d [path history] [tgz]
  1. include/
  2. third_party/
  3. .gn
  4. args.gni
  5. BUILD.gn
  6. README.md
examples/lock-app/nxp/mcxw72/README.md

Matter MCXW72 Door Lock Example Application

For generic information related to door lock application, please see the common README.

Introduction

This is a door lock application implemented for an mcxw72 device.

The following board was used when testing this Matter reference app for a mcxw72 device:

MCXW72-EVK

Please see MCXW72 product page for more information.

Device UI

This reference app is using matter-cli to send commands to the board through a UART interface.

interfacerole
UART0Used for logs
UART1Used for matter-cli and flashing

The user actions are summarized below:

matter-cli commandoutput
mattercommissioning onEnable BLE advertising
mattercommissioning offDisable BLE advertising
matterfactoryresetInitiate a factory reset
matterresetReset the device

Additional UART interface

You need a USB-UART bridge to make use of the second UART interface. The pin configuration is the following:

  • JP11 pin 1 (UART0 TX)
  • JP12 pin 1 (UART0 RX)
  • J11 pin 4 (GND)

The state feedback is also provided through LED effects:

widgeteffectdescription
LED2short flash on (50ms on/950ms off)The device is in an unprovisioned (unpaired) state and is waiting for a commissioner to connect.
LED2rapid even flashing (100ms period)The device is in an unprovisioned state and a commissioner is connected via BLE.
LED2short flash off (950ms on/50ms off)The device is fully provisioned, but does not yet have full network (Thread) or service connectivity.
LED2solid onThe device is fully provisioned and has full network and service connectivity.
RGB LEDonThe LockState attribute of the DoorLock cluster is Unlocked.
RGB LEDoffThe LockState attribute of the DoorLock cluster is Locked.

The user actions are summarized below:

buttonactionstateoutput
SW2short pressnot commissionedEnable BLE advertising
SW2long pressNAInitiate a factory reset (can be cancelled by pressing the button again within the factory reset timeout limit - 6 seconds by default)
SW3short pressNAToggle attribute LockState value
SW3long pressNAClean soft reset of the device (takes into account proper Matter shutdown procedure)

Building

Manually building requires running the following commands:

user@ubuntu:~/Desktop/git/connectedhomeip$ export NXP_SDK_ROOT=<path_to_SDK>
user@ubuntu:~/Desktop/git/connectedhomeip$ cd examples/lock-app/nxp/mcxw72
user@ubuntu:~/Desktop/git/connectedhomeip/examples/lock-app/nxp/mcxw72$ gn gen out/debug
user@ubuntu:~/Desktop/git/connectedhomeip/examples/lock-app/nxp/mcxw72$ ninja -C out/debug

Please note that running gn gen out/debug without --args option will use the default gn args values found in args.gni.

After a successful build, the elf and srec files are found in out/debug/. See the files prefixed with chip-mcxw72-lock-example.

Flashing

We recommend using JLink to flash both host and NBU cores. To support this device, a JLink patch shall be applied, so please contact your NXP liaison for guidance.

coreJLink target
hostKW47B42ZB7_M33_0
NBUKW47B42ZB7_M33_1

Note: NBU image should be written only when a new NXP SDK is released.

Flashing the NBU image with blhost

  1. Install Secure Provisioning SDK tool using Python:

    pip install spsdk
    

    Note: There might be some dependencies that cause conflicts with already installed Python modules. However, blhost tool is still installed and can be used.

  2. Updating NBU Firmware for Wireless examples

    It is necessary to work with the matching NBU image for the SDK version of the application you are working with. This means that when you download your SDK, prior to loading any wireless SDK example, update your NBU image with the SDK provided binaries:

    middleware\wireless\ieee-802.15.4\bin\mcxw72\mcxw72_nbu_ble_15_4_dyn.bin

    1. Place your device in ISP mode:

      • Press and hold SW4 (BOOT_CONFIG)
      • Press and hold SW1 (RST)
      • Relax SW1
      • Relax SW4
    2. Once the device is connected, you may find the assigned port by running:

      nxpdevscan
      
    3. Run the blhost command to write the bin file:

      blhost -p <assigned_port> write-memory 0x48800000 <path_to_SDK>/middleware/wireless/ieee-802.15.4/bin/mcxw72/mcxw72_nbu_ble_15_4_dyn.bin
      
      

Flashing the NBU image with JLink

Steps:

  • Plug MCXW72-EVK board into the USB port
  • Connect JLink to the device:
    JLinkExe -device KW47B42ZB7_M33_1 -if SWD -speed 4000 -autoconnect 1
    
  • Run the following commands:
    reset
    halt
    loadbin <path_to_SDK>/middleware/wireless/ieee-802.15.4/bin/mcxw72/mcxw72_nbu_ble_15_4_dyn.bin 0
    reset
    go
    quit
    

Note: If running into issues related to board connection, please refer to Flashing the NBU image with blhost. This might be needed when the NBU core is empty.

Flashing the host image

Host image is the one found under out/debug/. It should be written after each build process.

Steps:

  • Plug MCXW72-EVK board into the USB port
  • Connect JLink to the device:
    JLinkExe -device KW47B42ZB7_M33_0 -if SWD -speed 4000 -autoconnect 1
    
  • Run the following commands:
    reset
    halt
    loadfile chip-mcxw72-lock-example.srec
    reset
    go
    quit
    

Factory data

Factory data is written in IFR0, sector 1 at a predefined offset, using blhost. The expanded address is 0x2002680:

blhost --port <serial_port> flash-erase-region 0x2002680 <factory_data_len>
blhost --port <serial_port> write-memory 0x2002680 <factory_data_bin>

where <serial_port> is the OS assigned port, <factory_data_len> the length of factory data binary in bytes and <factory_data_bin> the path to the factory data binary.

OTA

Please see OTA guide.

Multiple BLE connections

To compile with the Multiple BLE connections support demo example add the gn argument nxp_multiple_ble_connections=true.

The application will accept multiple BLE connections after commissioning, by pressing the BLE advertise button again. Once discovered by a BLE central, a custom GATT service will be visible on the device.

The user can change the default behavior by implementing the class defined in BLEApplicationManager.h