Getting Started with the USB-KW38

Last Modified: 2020-04-28 15:39:00Supports USB-KW38

1. Plug It In

Let's take your USB-KW38 for a test drive.

1.1 Attach the USB-KW38 to the PC

USB-KW38 Components

USB-KW38 Components

1.2 Start the Board and Run the Out-of-Box Demo

Your USB-KW38 power green LED should stay ON when you connect the board.

2. Get Software

In this step, we are going to guide you through the process to get the required software to enable the USB-KW38 dongle as a Bluetooth Low Energy sniffer. You can also use the USB-KW38 as a development platform. Select the option you want to accomplish with your USB-KW38.

2.1 Choose a Development Path

3. Build, Run

Each of our Wireless Connectivity Stack comes with a list of demo applications and driver examples ready to be compiled and run.

3.1 Select a Connectivity Stack

4. Create

NXP provides a project cloner tool which allows you to copy an existing demo to use as a base for your own development, keeping the original demo app resources for reference. The cloner tool is included in your software package download. It can be found in <install_dir>\tools\wireless\ProjectCloner.

4.1 Clone an Example Project from MCUXpresso SDK

Option A: Use the MCUXpresso IDE to clone an example project.

Option B: Use the MCUXpresso Config Tools to clone an existing MCUXpresso SDK example for use with third party IDEs.

4.2 Use the Pins Tool

Now, let's use the Pins tool that is part of the MCUXpresso Config Tools to show how to add a new GPIO pin to your project to blink a LED.

4.3 Use the Clocks Tool

Next, use the Clocks Tool that is part of the MCUXpresso Config Tools to change the clock settings and change the rate that the LED blinks.

Programming USB-KW38 as a Sniffer

USB-KW38 Sniffer

USB-KW38 comes pre-programmed with sniffer firmware by default. However, if you erased the pre-programmed software in the USB-KW38, you can follow the steps provided in the guide below to reprogram the USB-KW38 with the sniffer application again.

These steps show how to program USB-KW38 with the sniffer application. To enable USB-KW38 as a sniffer, you need to program both devices (K22F and KW37).

The next tools are needed to be able to program USB-KW38:

Hardware Tools

  • J-Link/JTAG Debugger and USB-KW38 dongle

Software Tools

  • J-Link software and documentation pack

It is assumed that the user already knows how to flash USB-KW38. This means that the user already went through the "Update Software of the USB-KW38 QSG" document shown in the USB-KW38 "Getting Started" page when using this board as a development platform.

Locate the Sniffer Binaries to be Downloaded

  1. Sniffer binaries files are located in the next path: <connectivitysoftware_install_folder>\tools\wireless\binaries

    USB-KW38-GS-SNIFFER-QSG-01-1

    USB-KW38-GS-SNIFFER-QSG-01-1
  2. 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_Vxxx)

Flashing USB-KW38 as Sniffer

Program K22 Bootloader with J-Link Programmer

  1. Connect J-Link debugger into PC with USB cable
  2. Connect J-Link debugger to K22 JTAG connector (J6) on the USB-KW38
  3. Connect USB-KW38 to PC via USB connector (J5)
  4. Open JLink.exe (from the same path in step #1)

  5. Type "connect" command and configure the programmer
  6. Configure the programmer with the settings shown below:
    • Device = MK22FN512XXX12
    • Interface Type = SWD
    • Interface Speed = 4000 kHz (default)
  7. Type the following command to load the binary file:
    loadbin k22f_bl_crc_07132016.bin 0
  8. Verify that the image is programmed (no errors reported by JLink.exe)
  9. Type the following command to load the sniffer binary:
    loadbin sniffer_usbkw38_k22f_0x8000.bin 0x8000
  10. Verify that the image is programmed (no errors reported by JLink.exe)
  11. Remove USB-KW38 from USB

Program KW37 with J-Link Programmer

  1. Connect J-Link debugger into PC with USB cable
  2. Connect J-Link debugger to KW37 JTAG connector (J1) on the USB-KW38
  3. Connect USB-KW38 to PC via USB connector (J5)
  4. Open JLink.exe (from the same path in step #1)

  5. Type "connect" command and configure the programmer
  6. Configure the programmer with the settings shown below
    • Device = MKW38Z512XXX4
    • Interface Type = SWD
    • Interface Speed = 4000 kHz (default)
  7. Type the following command to load the binary file:
    loadbin sniffer_usbkw38_kw37z.bin 0
  8. Verify that the image is programmed (no errors reported by JLink.exe)
  9. Remove J-Link cable from PCB
  10. Power cycle the board by unplugging the USB cable and then plugging it again

Programming USB-KW38 with the Sniffer Application

USB-KW38 Development Platform

These steps show how to program USB-KW38 with the sniffer application. In order to enable USB-KW38 as a sniffer, you need to program both devices (K22F and KW37).

The next tools are needed to be able to program USB-KW38:

Hardware Tools

  • USB-KW38

Software Tools

  • KW38 Connectivity Software

Locate the Sniffer Binaries to be Downloaded

  1. Sniffer binaries files are located in the next path: <connectivitysoftware_install_folder>\tools\wireless\binaries

    USB-KW38-GS-POPUP-BOOTLOADER-1

    USB-KW38-GS-POPUP-BOOTLOADER-1

Flashing USB-KW38 as Sniffer

  1. Reprogram the USB-KW38 like an OpenSDA. First, go to OpenSDA, then select the USB-KW38 board, finally follow steps 2 and 3
  2. Open File Explorer to find out that the USB-KW38 is enumerated like a Mass Storage Device MSD name "USB-KW37Z"
  3. Drag and Drop the sniffer_usbkw38_kw37z.bin in the "USB-KW37Z"

    USB-KW38-GS-POPUP-BOOTLOADER-3

    USB-KW38-GS-POPUP-BOOTLOADER-3
  4. It's time to program the MK22F microcontroller with the sniffer software, the MCU may be re-programmed using the bootloader feature used in step 1. To start your board into bootloader mode:
    • Power cycle the board by unplugging the USB cable
    • Hold the SW2 button and plug the USB cable
    • Wait for the computer to enumerate the device as a Mass Storage Device with ID "DAPLINKBOOT"
    • Open the "DAPLINKBOOT" drive. Drag and drop the file sniffer_usbkw38_k22f_0x8000.bin in the "DAPLINKBOOT" drive

  5. Unplug and plug again the USB-KW38 to your PC. Now, the sniffer application has been programmed to your USB-KW38

Flash OpenSDA

Flash OpenSDA

To flash the OpenSDA version again to the K22F of USB-KW38, follow the next steps:

  1. Power cycle the board by unplugging the USB cable
  2. Hold the SW2 button and plug the USB cable
  3. Wait for the computer to enumerate the device as a Mass Storage Device with ID "DAPLINKBOOT"
  4. Open the "DAPLINKBOOT" drive
  5. Drag and drop the file k22f_usbkw37z_if_crc.bin in the "DAPLINKBOOT" drive

    OPENSDA-POPUP-IMAGE-STEPE

    OPENSDA-POPUP-IMAGE-STEPE
  6. Power cycle the board by unplugging the USB cable and then plugging it again
  7. Verify that the device enumerates as "USB-KW37Z"

For futher information please refer to OpenSDA Serial and Debug Adapter.

Tera Term Tutorial

Tera Term Tutorial

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.

  1. Download Tera Term from SourceForge. After the download, run the installer and then return to this webpage to continue
  2. Download

  3. Launch Tera Term. The first time it launches, it will show you the following dialog. Select the Serial option. Assuming your board is plugged in, there should be a COM port automatically populated in the list
  4. Configure the serial port settings (using the COM port number identified earlier) to 115,200 baud rate, 8 data bits, no parity and 1 stop bit. To do this, go to Setup → Serial Port and change the settings
  5. Verify that the connection is open. If connected, Tera Term will show something like below in its title bar
  6. You're ready to go

PuTTY Tutorial

PuTTY Tutorial

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.

  1. Download PuTTY using the button below. After the download, run the installer and then return to this webpage to continue
  2. Download

  3. Launch PuTTY by either double clicking on the *.exe file you downloaded or from the Start menu, depending on the type of download you selected
  4. Configure in the window that launches, select the Serial radio button and enter the COM port number that you determined earlier. Also enter the baud rate, in this case 115,200
  5. Click Open to open the serial connection. Assuming the board is connected and you entered the correct COM port, the terminal window will open. If the configuration is not correct, PuTTY will alert you
  6. You're ready to go

IAR Embedded Workbench IDE

Running a demo using IAR Embedded Workbench IDE

These steps show how to:

  • Load and build the demo application in IAR Embedded Workbench
  • Download and run the demo application

The example used below is for the Generic FSK Connectivity Test demo, but these steps can be applied to any of the Wireless Connectivity demo applications.

Load and Build the Application Demo

  1. Navigate to the Connectivity Test IAR workspace (located at <install_dir>\boards\USBKW38\wireless_examples\genfsk\connectivity_test\freertos\iar)

    USB-KW38-GS-POPUP-GFSK-WORKBENCH-1

    USB-KW38-GS-POPUP-GFSK-WORKBENCH-1
  2. After the workspace is open, select the project
  3. Click the Make button to build the project

Download and Run the Application Demo

  1. Connect your USB-KW38 board to your PC
  2. Click on the Download and Debug button (green arrow located on the toolbar)
  3. Once the project has loaded, the debugger should stop at main(). Open a Terminal Emulator program and open a session to your USB-KW38 COM port. Configure the terminal with these settings:
    • 115,200 baud rate
    • No parity
    • 8 data bits
    • 1 stop bit
  4. Click the Go button to resume operation
  5. The following output will be displayed in the serial terminal If you don't see this output, verify your terminal settings and connections
  6. Refer to <install_dir>\docs\wireless\GENFSK\Generic FSK Link Layer Quick Start Guide.pdf - MKW37A/MKW38A/MKW39A/MKW37Z/MKW38Z Generic FSK Link Layer Software for more information on this demo application

MCUXpresso IDE

Running a demo using MCUXpresso IDE

These steps show how to:

  1. Load and build the demo application in MCUXpresso IDE
  2. Download and run the demo application

The example used below is for the Generic FSK Connectivity Test demo, but these steps can be applied to any of the Wireless Connectivity demo applications.

Import the MCUXpresso SDK

  1. Open up the MCUXpresso IDE
  2. Switch to the Installed SDKs view within the MCUXpresso IDE window

    USB-KW38-GS-POPUP-GFSK-MCUXPRESSO-1

    USB-KW38-GS-POPUP-GFSK-MCUXPRESSO-1
  3. Open Windows Explorer and drag and drop the USB-KW38 SDK (unzipped) file into the Installed SDKs view
  4. You will get the following pop-up. Click on OK to continue the import:

    USB-KW38-GS-POPUP-GFSK-MCUXPRESSO-2

    USB-KW38-GS-POPUP-GFSK-MCUXPRESSO-2
  5. The installed SDK will appear in the Installed SDKs view as shown below:

    USB-KW38-GS-POPUP-GFSK-MCUXPRESSO-3

    USB-KW38-GS-POPUP-GFSK-MCUXPRESSO-3

Build an Example Application

The following steps will guide you through opening the GenFSK example.

  1. Find the Quickstart Panel in the lower left hand corner

    USB-KW38-GS-POPUP-GFSK-MCUXPRESSO-4

    USB-KW38-GS-POPUP-GFSK-MCUXPRESSO-4
  2. Then click on Import SDK examples(s)

    USB-KW38-GS-POPUP-GFSK-MCUXPRESSO-5

    USB-KW38-GS-POPUP-GFSK-MCUXPRESSO-5
  3. Click on the USB-KW38 board to select that you want to import an example that can run on that board, and then click on Next

    USB-KW38-GS-POPUP-GFSK-MCUXPRESSO-6

    USB-KW38-GS-POPUP-GFSK-MCUXPRESSO-6
  4. In the search text box, type "connectivity_test" to filter the example projects. Use the arrow button to expand the list and locate the “connectivity_test” project (wireless_examples → genfsk → connectivity_test), then, select the freertos version of the project and click “Finish”

    USB-KW38-GS-POPUP-GFSK-MCUXPRESSO-7

    USB-KW38-GS-POPUP-GFSK-MCUXPRESSO-7
  5. Now, build the project by clicking on the project name and then in the Quickstart Panel click on Build
  6. You can see the status of the build in the Console tab

    USB-KW38-GS-POPUP-GFSK-MCUXPRESSO-9

    USB-KW38-GS-POPUP-GFSK-MCUXPRESSO-9
  7. Now that the project has been compiled, you can flash it to the board and run it
  8. Make sure the USB-KW38 board is plugged in, and in the Quickstart Panel click on Debug
  9. MCUXpresso IDE will probe for connected boards and should find the DAPLink CMSIS-DAP debug probe that is part of the integrated OpenSDA circuit on the USB-KW38. Click on OK to continue

    USB-KW38-GS-POPUP-GFSK-MCUXPRESSO-11

    USB-KW38-GS-POPUP-GFSK-MCUXPRESSO-11
  10. The firmware will be downloaded to the board and the debugger started

    USB-KW38-GS-POPUP-GFSK-MCUXPRESSO-12

    USB-KW38-GS-POPUP-GFSK-MCUXPRESSO-12
  11. Once the project has loaded, the debugger should stop at main(). Open a Terminal Emulator program and open a session to your USB-KW38 COM port. Configure the terminal with these settings:
    • 115,200 baud rate
    • No parity
    • 8 data bits
    • 1 stop bit
  12. Click the "Run" button to resume operation
  13. The following output will be displayed in the serial terminal
  14. Refer to <install_dir>\docs\wireless\GENFSK\Generic FSK Link Layer Quick Start Guide.pdf - MKW37A/MKW38A/MKW39A/MKW37Z/MKW38Z Generic FSK Link Layer Software for more information on this demo application

Design Resources

Additional Resources

Explore beyond the USB-KW38 by integrating other NXP solutions and software to your project and interact with our worldwide design community.

KW37/38/39 Bluetooth Low Energy 5 Wireless MCU

The KW37/38/39 is an ultra low power, highly integrated single-chip device that enables Bluetooth Low Energy (LE) version 5.0 and Generic FSK (at 250, 500, 1000 and 2000 kbps) RF connectivity for automotive embedded systems. Find out more at KW37/38/39.

CAN Transceiver and Controllers

The TJA1057 is part of the Mantis family of high-speed CAN transceivers. It provides an interface between a Controller Area Network (CAN) protocol controller and the physical two-wire CAN bus. Learn more at TJA1057.

LIN Transceiver

The TJA1027 is the interface between the Local Interconnect Network (LIN) leader/follower protocol controller and the physical bus in a LIN network. Learn more at TJA1027.

Support

Forums

Connect with other engineers and get expert advice on designing with Kinetis MCUs and Wireless Connectivity software. Join the community discussion in one of our two dedicated communities: