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:
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.
interface |
role |
---|---|
UART0 |
Used for logs |
UART1 |
Used for |
The user actions are summarized below:
matter-cli command |
output |
---|---|
|
Enable BLE advertising |
|
Disable BLE advertising |
|
Initiate a factory reset |
|
Reset 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:
widget |
effect |
description |
---|---|---|
LED2 |
short flash on (50ms on/950ms off) |
The device is in an unprovisioned (unpaired) state and is waiting for a commissioner to connect. |
LED2 |
rapid even flashing (100ms period) |
The device is in an unprovisioned state and a commissioner is connected via BLE. |
LED2 |
short flash off (950ms on/50ms off) |
The device is fully provisioned, but does not yet have full network (Thread) or service connectivity. |
LED2 |
solid on |
The device is fully provisioned and has full network and service connectivity. |
RGB LED |
on |
The |
RGB LED |
off |
The |
The user actions are summarized below:
button |
action |
state |
output |
---|---|---|---|
SW2 |
short press |
not commissioned |
Enable BLE advertising |
SW2 |
long press |
NA |
Initiate a factory reset (can be cancelled by pressing the button again within the factory reset timeout limit - 6 seconds by default) |
SW3 |
short press |
NA |
Toggle attribute |
SW3 |
long press |
NA |
Clean 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.
core |
JLink target |
---|---|
host |
|
|
|
Note: NBU
image should be written only when a new NXP SDK is released.
Flashing the NBU
image with blhost
#
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.Updating
NBU
Firmware for Wireless examplesIt 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 yourNBU
image with the SDK provided binaries:middleware\wireless\ieee-802.15.4\bin\mcxw72\mcxw72_nbu_ble_15_4_dyn.bin
Place your device in
ISP
mode:Press and hold
SW4
(BOOT_CONFIG
)Press and hold
SW1
(RST
)Relax
SW1
Relax
SW4
Once the device is connected, you may find the assigned port by running:
nxpdevscan
Run the
blhost
command to write thebin
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 portConnect 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 portConnect 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