Let's take your USB-KW40Z for a test drive!
Note: K32W061/41 is preferred for any new Zigbee®, Thread and Bluetooth® LE 5.0 design. No new software releases planned
Your USB-KW40Z Power green LED should stay ON when you connect the board.
In this step, we are going to guide you through the process to get the required software to enable the USB-KW40Z dongle as a Bluetooth Low Energy or IEEE 802.15.4 sniffer. You can also use the USB-KW40Z as a development platform. Select the option you want to accomplish with your USB-KW40Z.
The KW40Z Connectivity Software package integrates the Kinetis Software Development Kit v1.3 and all the wireless connectivity stacks required to develop your solution using IEEE 802.15.4 and/or Bluetooth Low Energy. It also includes drivers required for the USB-KW40Z.
Click below to download the KW40Z Connectivity Software for your computer.
Wireshark is an Open-source network protocol analyzer. It will help you to see what is happening in the wireless communication. It is a great tool for helping to debug issues when talking about wireless connectivity applications.
In order to enable NXP Wireless Connectivity products, an adapter is needed by wireshark to add support to NXP KW40 device. Please, install this application once you already installed Wireshark.
USB-KW40Z comes pre-programmed with the sniffer firmware by default. However, if you erased the pre-programmed software in the USB-KW40Z, you can follow the steps provided in the next guide to program USB-KW40Z sniffer application again. Please, click the next button to show you how to program USB-KW40Z with the sniffer firmware.
The KW40Z Connectivity Software package integrates the Kinetis Software Development Kit v1.3 and all the wireless connectivity stacks required to develop your solution using IEEE 802.15.4 and/or Bluetooth Low Energy. It also includes drivers required for the USB-KW40Z.
Click below to download the KW40Z Connectivity Software for your computer.
IAR Embedded Workbench for Arm® (EWARM) version 7.40.2 or later is the development toolchain used to deploy software applications using the NXP Connectivity stacks. NXP provides example EWARM workspace projects for you to start your development.
Want to use a different toolchain?
Right now, the only supported toolchain is IAR Embedded Workbench for Arm; we are currently working on the enablement of NXP KDS for the Connectivity stacks.
In order to enable NXP Wireless Connectivity products, an adapter is needed by wireshark to add support to NXP KW40 device. Please, install this application once you already installed Wireshark.
USB-KW40Z comes pre-programmed with an sniffer application. So, in order to be able to use the USB-KW40Z as a development board, it is needed to program a OpenSDA v2.1 firmware into the K22F MCU of the USB-KW40Z. Next tools are required to program the USB-KW40Z:
After you successfully installed J-Link Software. Download the OpenSDA v2.1 CMSIS-DAP binary in the next button.
Please, use the guide below to learn how to update firmware to the USB-KW40Z.
Many of the example applications output data over the MCU UART so you'll want to make sure that the driver for the board's virtual COM port is installed. Before you run the driver installer, you MUST have the board plugged in to your PC.
With the serial port driver installed, run your favorite terminal application to view the serial output from the MCU's UART. Configure the terminal to 115200 baud rate, 8 data bits, no parity and 1 stop bit. To determine the port number of the USB-KW40Z's virtual COM port, open the device manager and look under the "Ports" group.
Not sure how to use a terminal application? Try one of these tutorials:
Tera Term is a very popular open source terminal emulation application. This program can be used to display information sent from your NXP development platform's virtual serial port.
PuTTY is a popular terminal emulation application. This program can be used to display information sent from your NXP development platform's virtual serial port.
This document describes how to update or program a new application in the USB-KW40Z using J-Link debugger.
USB-KW40Z contains two MCUs that need to be programmed depending on the desired use case. Hence, USB-KW40Z contains two connectors to program the board. These connectors are shown in the figure 1 as "SWD MKW40Z" and "JTAG MK22F".
Figure 1. USB-KW40Z Hardware
When an application needs to be programmed in the MK22FN512 MCU, "JTAG MK22F" connector is used. Different from this, "SWD MKW40Z" connector is used when programming KW40Z device. In order to be able to program an application to the USB-KW40Z using JLink, ".bin" files are needed because it is the format that JLink application requires in order to be able to program a board. Please, follow the next steps to program USB-KW40Z.
Locate the .bin file that need to be programmed in the USB-KW40Z. In this case, this file is the one downloaded from the "Getting Started" web page.
Go to JLink installation path. (i.e. "C:\Program Files (x86)\SEGGER\JLink_V502")
Copy and paste the ".bin" file into the JLink installation path. Just as an example, in this document, a file called "usb-kw40z_cmsis-dap.bin" for the MK22FN512 MCU will be used.
Make sure that Jlink debugger is connected to the corresponding JTAG MK22F connector (J6) in the USB-KW40Z.
Figure 2. JLink debugger connected to JTAG MK22F connector
Go the JLink installation path, and then open the application "JLink". Windows shown in figure 3 will be displayed.
Figure 3. JLink application
Call the next instructions in next order:
unlock kinetis
device mk22fn512xxx12
loadbin usb-kw40z_cmsis-dap.bin 0
One important thing to note in the step 6 is the "loadbin" command. The name of the file to be programmed in the MCU is specified in this command. In this case, "usb-kw40z_cmsis-dap.bin" is used as an example for this document.
A success or "O.K." message should be displayed in the window once the binary file is downloaded.
Disconnect and reconnect the board.
Now, an application to the K22F MCU was successfully downloaded.
These steps show how to program USB-KW40Z with the sniffer application. In order to enable USB-KW40Z as a sniffer, you need to program both devices (K22F and KW40).
The next tools are needed to be able to program USB-KW40Z:
It is assumed that user already know how to flash USB-KW40Z. This means that user already went through the "Update Software of the USB-KW40Z QSG" document shown in the USB-KW40Z "Getting Started" page when using this board as a development platform.
Sniffer binaries files are located in the next path:
After the binaries are located. Please copy and paste these binary files in the JLink installation path (i.e. "C:\Program Files (x86)\SEGGER\JLink_V502").
NOTE: JLink_V502 folder name might change in the future, it is due to the JLink software version installed, so JLink_V502 or later is required to support KW40Z device
Make sure that Jlink debugger is connected to the corresponding JTAG MK22F connector (J6) in the USB-KW40Z.
Go the JLink installation path, and then open the application "JLink". Next window will be displayed.
Call the next instructions in next order:
In order to program the KW40Z, please, make sure that Jlink debugger is connected to the corresponding SWD MKW40Z connector (J1) in the USB-KW40Z.
Call the next instructions in next order:
A success or "O.K" message should be displayed in the window once the binary file is downloaded.
Unplug and plug again the USB-KW40Z to your PC. Now, sniffer application has been programmed to your USB-KW40Z.
USB-KW40Z comes pre-programmed with a sniffer application. Once all the required software is installed in the PC. You are ready to start sniffing your IEEE 802.15.4 or BLE applications. Next buttons provide directions on how to enable your USB-KW40Z on each protocol. Click on the desired protocol to sniff.
These steps show how to:
Configure Kinetis Protocol Analyzer Adapter and Wireshark Network Analyzer.
Sniff IEEE 802.15.4 wireless applications.
Open the "Kinetis Protocol Analyzer Adapter".
Make sure, you have USB-KW40Z connected to your PC when opening Kinetis Protocol Analyzer Adapter, it will start looking for Kinetis sniffer hardware. Once USB-KW40Z is detected, KW40Z device will be displayed.
Click on the Wireshark icon to open Wireshark Network Protocol Analyzer.
Wireshark Network Analyzer will be opened. On the "Capture" option of the main window, select the Local Area Connection that was created by the Kinetis Protocol Analyzer, in this example, Kinetis Protocol Analyzer created "Local Area Connection 2", then click "Start" button.
"Capture" window will be opened.
Select the desired IEEE 802.15.4 channel to scan in the Kinetis Protocol Analyzer Adapter window. In this guide, we are going to select channel 19 as an example.
USB-KW40Z will start to sniff and upcoming data will be displayed in the "Capture" window of the Wireshark Network Protocol Analyzer.
Refer to the "Kinetis Protocol Analyzer Adapter User's Guide"
for more information about how to enable other features of your
USB-KW40Z sniffer. Document can be found in
the next path:
These steps show how to:
Configure Kinetis Protocol Analyzer Adapter and Wireshark Network Analyzer.
Sniff BLE wireless applications.
Open the "Kinetis Protocol Analyzer Adapter".
Make sure, you have USB-KW40Z connected to your PC when opening Kinetis Protocol Analyzer Adapter, it will start looking for Kinetis sniffer hardware. Once USB-KW40Z is detected, KW40Z device will be displayed.
Click on the Wireshark icon to open Wireshark Network Protocol Analyzer.
Wireshark Network Analyzer will be opened. On the "Capture" option of the main window, select the Local Area Connection that was created by the Kinetis Protocol Analyzer, in this example, Kinetis Protocol Analyzer created "Local Area Connection 2", then click "Start" button.
"Capture" window will be opened.
Select the desired advertising channel to scan in the Kinetis Protocol Analyzer Adapter window. In this guide, we are going to select All option to start sniffing on all advertising channels (37, 38 and 39). However, you could select different advertising channels of interest to sniff.
Address Filter is selected in this guide, hence, only data upcoming from the specified address will be displayed on the "Capture" window. If you are not interested on following any specific address, you can provide a Hopping interval to sniff any device in the advertising channels.
USB-KW40Z will start to sniff and upcoming data will be displayed in the "Capture" window of the Wireshark Network Protocol Analyzer.
Refer to the "Kinetis Protocol Analyzer Adapter User's Guide"
for more information about how to enable other features of your
USB-KW40Z sniffer. Document can be found in
the next path:
Each of the Our Wireless Connectivity Stack comes with a list of demo applications and driver examples ready to be compiled and run.
Browse to the "examples\smac" folder to see the application demos:
(
If you are interested in running the preprogrammed Connectivity Test Application that comes with your board Click here
You probably want to build and debug a demo by yourself. Use the guide below to learn how to build and debug an example application using one of the Wireless Connectivity Stacks provided by NXP.
Browse to the "examples\ieee_802_15_4" folder to see the application demos:
You probably want to build and debug a demo by yourself. Use the guide below to learn how to build and debug an example application using one of the Wireless Connectivity Stacks provided by NXP.
Browse to the "examples\bluetooth" folder to see the application demos:
If you are interested in running the preprogrammed Connectivity Test Application that comes with your board Click here
You probably want to build and debug a demo by yourself. Use the guide below to learn how to build and debug an example application using one of the Wireless Connectivity Stacks provided by NXP.
Kinetis BLE Toolbox comes with mobile applications acting as a BLE central device. The Kinetis BLE Toolbox allows you to play with different sensor applications provided by the KW40Z Connectivity Software.
After you successfully installed the Kinetis BLE Toolbox. Follow the next steps to learn how to configure and play with Kinetis BLE Toolbox and Wireless Connectivity Applications.
Browse to the "examples\hybrid" folder to see the application demos:
If you are interested in running the preprogrammed Connectivity Test Application that comes with your board Click here
You probably want to build and debug a demo by yourself. Use the guide below to learn how to build and debug an example application using one of the Wireless Connectivity Stacks provided by NXP.
Kinetis BLE Toolbox comes with mobile applications acting as a BLE central device. The Kinetis BLE Toolbox allows you to play with different sensor applications provided by the KW40Z Connectivity Software.
After you successfully installed the Kinetis BLE Toolbox. Follow the next steps to learn how to configure and play with Kinetis BLE Toolbox and Wireless Connectivity Applications.
These steps show how to:
Build the platform libraries required by the application demo
Build the demo application.
Download and run the demo application.
The example used below is for the SMAC Connectivity Test demo, but these steps can be applied to any of the Wireless Connectivity demo applications.
Open the "Connectivity_Test.eww" IAR workspace.
After the workspace is open, some projects are shown: One for the KSDK platform library and one for the demo application. Build ALL the required KSDK libraries by right clicking on the SDK projects and click on 'Make'.
Select and build the "Connectivity_Test - Debug" project.
Note: If you select another project, don't forget to build the required KSDK libraries for that project.
Connect your USB-KW40Z board to your PC.
Right click on the "Connectivity_Test – Debug" project and select "Set as Active"
Click on "Download and Debug" icon to flash the board.
Open a Terminal Emulator program and open a session to your USB-KW40Z COM port.
Configure the terminal with these settings:
Press "Go" button.
The following output will be displayed in the serial terminal.
If you don't see this output, verify your terminal settings and connections.
Now unplug the first board, and plug in the other USB-KW40Z.
Program the second USB-KW40Z with the same Connectivity Test firmware by using the same steps as above.
Close any open terminal windows, then power cycle both boards, and with both boards plugged into your computer, open up a terminal window for each board.
Hit the reset button each board to bring up the Connectivity Test options for each board.
Refer to
These steps show how to:
Build the platform libraries required by the application demo.
Build the demo application.
Download and run the demo application.
The example used below is for “MyWirelessApp” application demo (Coordinator), but these steps can be applied to any of the Wireless Connectivity demo applications.
Open the "MyWirelessAppCoordinator.eww" IAR workspace.
\ieee_802_15_4\MyWirelessApp\Coordinator\usbkw40z\FreeRTOS\build\iar\MyWirelessAppCoordinator.eww
After the workspace is open, some projects are shown: One for the KSDK platform library and one for the demo application. Build ALL the required KSDK libraries by right clicking on the SDK projects and click on 'Make'.
Select and build the "MyWirelessAppCoordinator - Debug" project.
Note: If you select another project, don’t forget to build the required KSDK libraries for that project.
Connect your USB-KW40Z board to your PC.
Right click on the "MyWirelessAppCoordinator – Debug" project and select "Set as Active"
Click on "Download and Debug" icon to flash the board.
Open a Terminal Emulator program and open a session to your USB-KW40Z COM port.
Configure the terminal with these settings:
Press "Go" button.
The following output will be displayed in the serial terminal.
If you don't see this output, verify your terminal settings and connections.
Now unplug the first board, and plug in the other USB-KW40Z.
Program the second USB-KW40Z with the "MyWirelessApp" End Device
demo application which can be found at
Close any open terminal windows, then power cycle both boards, and with both boards plugged into your computer, open up a terminal window for each board.
Press SW1 on the Coordinator board, and then press SW1 on the board programmed with the EndDevice application, and wait for them to connect.
Once connected, type into the terminal of either of the boards, and you will see the text print out on the other board.
Refer to
These steps show how to:
Build the platform libraries required by the application demo.
Build the demo application.
Download and run the demo application.
The example used below is for the heart rate sensor demo, but these steps can be applied to any of the Wireless Connectivity demo applications.
Open the "heart_rate_sensor.eww" IAR workspace.
\bluetooth\heart_rate_sensor\usbkw40z\FreeRTOS\build\iar\heart_rate_sensor.eww
After the workspace is open, some projects are shown: One for the KSDK platform library and one for the demo application. Build ALL the required KSDK libraries by right clicking on the SDK projects and click on 'Make'.
Select and build the "heart_rate_sensor - Debug" project.
Note: If you select another project, don’t forget to build the required KSDK libraries for that project.
Connect your USB-KW40Z board to your PC.
Right click on the "heart_rate_sensor - Debug" project and select "Set as Active"
Click on "Download and Debug" icon to flash the board.
Press "Stop Debugging" button.
Unplug and plug again the USB to your PC. LEDs labeled as D2 and D3 in the USB will start blinking.
Press SW1 of the USB-KW40Z, LED D2 will start blinking indicating that the board is in advertising/discoverable mode.
Please, see section 3.3 How to play with the Bluetooth Low Energy Connectivity Demos? to learn how to play with the app.
Refer to
These steps show how to:
Build the platform libraries required by the application demo.
Build the demo application.
Download and run the demo application.
The example used below is for “dual_mode_demo”, but these steps can be applied to any of the Wireless Connectivity demo applications.
Open the "dual_mode_demo.eww" IAR workspace.
ble_802_15_4_dual_mode_demo\usbkw40z\bare_metal\build\iar\dual_mode_demo.eww
After the workspace is open, some projects are shown: One for the KSDK platform library and one for the demo application. Build ALL the required KSDK libraries by right clicking on the SDK projects and click on 'Make'.
Select and build the "dual_mode_demo – dual_mode_debug_BM -Debug" project.
Note: If you select another project, don’t forget to build the required KSDK libraries for that project.
Connect your USB-KW40Z board to your PC
Right click on the " dual_mode_demo – dual_mode_debug_BM -Debug " project and select "Set as Active".
Click on "Download and Debug" icon to flash the board.
Open a Terminal Emulator program and open a session to your USB-KW40Z COM port.
Configure the terminal with these settings:
Press "Go" button.
The following output will be displayed in the serial terminal.
If you don't see this output, verify your terminal settings and connections.
Now unplug the first board, and plug in the other USB-KW40Z.
Program a second USB-KW40Z with the "MyWirelessApp" End Device
demo application which can be found at
Close any open terminal windows, then power cycle both boards, and with both boards plugged into your computer, open up a terminal window for each board.
Press SW1 on the Coordinator board, and then press SW1 on the board programmed with the EndDevice application, and wait for them to connect.
Once connected, type into the terminal of either of the boards, and you will see the text print out on the other board.
Use the Kinetis BLE Toolbox mobile application to play with the BLE part of this demo, which correspond to a Heart Rate Sensor. Please, see section 3.3 How to play with the Bluetooth Low Energy Connectivity Demos? to learn how to play with the app.
Refer to
NXP provides a tool called "Project Cloner" which will allow you to copy an existing demo to use it as a base for your own development, keeping the original demo app sources for reference.
Cloning an example application project allows users to load and develop application firmware without modifying the core installation source files or default project configurations.
To create a clone of an example project:
Navigate to the Destination root path>\Cloned app name> folder to access the appplication files. The project files (//) can be found and launched in IAR EWARM from the root of this folder.
Open the project with IAR Embedded Workbench for Arm, follow the same procedure described in Section 3.2.
Modify your recently cloned application to start your own design!
For more information about the application and the APIs available, please, look at the "Applications Development Guide".
All Connectivity stack's platform make use of the Kinetis SDK low level drivers, take a look into the Kinetis SDK Demo Applications User's Guide if you want to add a driver that is not currently used on the Connectivity Demo Applications.
The Connectivity Test Application is a SMAC based Demo Application which provides the user with means to test basic transmission-reception functionalities along with several advanced testing features based on the ASP and SMAC APIs.
The runtime configuration is performed using shortcut keys which are available in most of the application’s menus. The menus or tests will change their behavior based on what settings are applied
The Connectivity Test Application has four main features:
The Carrier Sense test performs ED continuously until the ED value is above the CCA threshold and then transmit a packet which contains pseudo-random data with the payload size configured using 'n' and 'm' shortcuts.
The Transmission Control test displays a selection menu for number of packets identical with the one in PER TX test and then it prompts the user to enter the inter-packet delay. After that, the application will start sending the selected number of packets with the selected inter-packet delay, using pseudo-random data for the payload with the size configured with 'n' and 'm' shortcuts.
For additional details on how to run the Connectivity Test Application, please refer to the SMAC’s Demonstration Applications User’s Guide.