Software and Tools Environment Setup
Step 1: Jump Start Your Design with the NXP Kinetis SDK!
Kinetis SDK is a complementary collection of comprehensive software enablement for NXP Kinetis Microcontrollers that includes system startup, peripheral drivers, USB and connectivity stacks, middleware, and real-time operating system (RTOS) kernels. Hexiwear is developed based on Kinetis SDK Version 1.3. Click below to download the SDK Release appropriate for your computer's operating system, the link to Kinetis SDK is:
Step 2: Install the NXP KDS Toolchain
The Kinetis Design Studio (KDS) is a complimentary integrated development environment for Kinetis MCUs that enables robust editing, compiling and debugging of your designs. Based on free, open-source software including Eclipse, GNU Compiler Collection (GCC), GNU Debugger (GDB), and others, the Kinetis Design Studio IDE offers designers a simple development tool with no code-size limitations. Hexiwear default software can be modified in the KDS.
Download the latest version on KDS.
Step 3: Serial UART Driver
Many of the example applications output data over the MCU UART so make sure that the driver for the board's virtual COM port is installed. Before you run the driver installer, please make sure you have Hexiwear on docking station and docking station plugged in to your PC. For More instruction on how to put Hexiwear on docking station, watch the video at www.hexiwear.com/1769-
Download the serial UART driver.
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 115,200 baud rate, 8 data bits, no parity and 1 stop bit. To determine the port number of the Hexiwear's virtual COM port, open the device manager and look under the "Ports" group.
Step 4: Download Hexiwear Hardware / Software / Documentation package
- Go to the Hexiwear Github repository located at: github.com/MikroElektronika/HEXIWEAR
- Select Clone or download and choose Download ZIP in the popup window
- Once the download is complete, extract the content of the HEXIWEAR-master.zip on your computer.
Step 5: Install Eclipse Updates
Before using Kinetis Design Studio IDE with Kinetis SDK, the Kinetis SDK Eclipse update must be applied. Without this update, Eclipse cannot generate Kinetis SDK-compatible projects.
Windows and Mac® OS Users
Open Kinetis Design Studio. The program will ask you to select a workspace. Select default workspace.
From Kinetis Design Studio toolbar, select Help then Install New Software
In the Install New Software dialog box, click the Add button in the upper right corner. Then, in the Add Repository dialog, select the Archive button
In the Add Repository archive dialog box, browse the Kinetis SDK install directory. Find the following file:
/tools/eclipse_update folder and select the KSDK_ _Eclipse_Update.zip
Click Open and the OK button in the Add Repository dialog box.
The Kinetis SDK update shows up in the list of the original Install dialogs
Check the box to the left of the KSDK 1.3.0 Eclipse Update and click the Next button in the lower right corner. Follow the remaining instructions and Accept the licensing to finish the installation of the update. After the update is applied, restart KDS for the changes to take effect.
Step 6 Install PyOCD Eclipse Add-in
In order to program/debug Hexiwear via its docking featuring an ARM DAP-LINK Debug, virtual Serial and Flash programming interface, we need to upgrade Eclipse with the PyOCD plug-in.
The PyOCD plug-in requires first to install Python software
From your web browser download Python 2.7.11 installer at: www.python.org/downloads
Double click on the installer located in your download directory and follow the instructions.
Download the Zip package for the PyOCD Eclipse Plugin
From Sourceforge at https://sourceforge.net/projects/gnuarmeclipse/files/Eclipse/ and select the latest version shortcut (see picture below)
The ilg.gnuarmeclipse.repository-3.2.1-201701141320.zip file is also available from Hexiwear Github repository in the folder SWpyOCD
Copy the Zip package to the folder C:Freescale of your computer hard-drive
Now let’s upgrade Eclipse with PyOCD plug-in.
a. Select from KDS toolbar Help >> Install New Software…
b. In the new window, choose Add… then Archive…
c. Select the file ilg.gnuarmeclipse.repository-3.2.1-201701141320.zip available at C:Freescale and click on Open… and OK
d. Check the box next to GNU ARM C/C++ Cross Development Tools TO SELECT ALL THE OPTIONS (see picture below) and click on Next
e. Accept the license agreement then Click on Finish…
f. Kinetis Design Studio will restart to complete the installation of the plugin
You must now install PyOCD GDB Server tool
The pyocd-gdbserver.exe file is also available from Hexiwear Github repository in the folder SWpyOCD
Copy the executable to KDS rooth folder folder C:FreescaleKDS_v3
Building and debugging the first program
Basics of Kinetis Design Studio
Several Tutorials available on web:
- MCU on Eclipse: How to use Kinetis Design Studio
- Kinetis Design Studio 3.0 Kinetis SDK 1.2 Processor-Expert using FRDM-KL43Z: Quick tutorial on GPIO Interrupt (Toggling LED using button with Interrupt logic)
- FRDM K64F - blinking an LED using #Kinetis Design Sudio and Processor Expert
Step 1: Importing Hexiwear Project in Kinetis Design Studio
Let’s now build with the NXP KDS toolchain a project example for the Hexiwear board. First, open Kinetis Design Studio, then follow these steps:
- Select File, Import from the KDS IDE menu. In the window that appears, expand the General folder and select Existing Projects into Workspace. Then press the Next button.
- Click the Browse button next to the Select root directory: option
- Point to the project folder for the K64 device, which can be found in the HEXIWEAR-master package using this path:
HEXIWEAR-masterSWMK64
4. Press OK, then Check the box to the left of the HEXIWEAR_MK64 and HEXIWEAR_Bootloader_() project and click the Finish button in the lower right corner.
Step 2: Building Hexiwear Project
Select the HEXIWEAR_MK64 project in the project explorer window and click on the Build icon (hammer) from the toolbar.
Be patient, the first compilation of this advanced project (display, communication…) might last few minutes depending from your computer configuration. Compilation will end up with few Warnings…
Step 3: Placing Hexiwear unit on Docking Station
For More instruction on how to put Hexiwear on docking station, watch the video at www.hexiwear.com/1769-2/
Plug the Hexiwear board to the Docking Station via the specific connector.
Hexiwear Docking Station embeds a hardware debug interface called OpenSDA By default it is preprogrammed with the ARM DAP-LINK OpenSDA Application, which delivers Debug, Virtual Serial and Flash Programming services.
Hexiwear embeds two MCUs, a Kinetis K64F as main MCU and a KW40Z as BLE MCU On the Docking Station please make sure that you have the correct jumper configuration, to debug the Kinetis K64F: 11001111
One USB to micro-USB cable is included in the Docking Station packaging. Connect one end of the USB port to your computer and the other end to the micro-USB port of the Docking station.
Windows should detect a new peripheral
To properly finish the installation of the OpenSDA / DAP-LINK drivers, you must download and install the ARM mbed Serial drivers at the address below As a confirmation, check in the Peripheral Manager that you don’t have peripherals unidentified and that the following devices are available:
- Portable Device: DAP-LINK
- Ports (COM & LPT): mbed Serial Port (COMxxx)
Step 4: Debug Configuration Settings
Let’s now launch the debug session for the Hexiwear project example with KDS toolchain.
Click on the small downward arrow next to the Debug (green bug) icon from the toolbar and select Debug Configurations…
In the Debug Configurations window, right click on GDB PyOCD Debugging and select New • From the right panel, in the Main tab, below Project press the Browse button and select the HEXIWEAR_MK64 and select OK
In order to program/debug Hexiwear via its docking featuring an ARM DAP-LINK Debug, virtual Serial and Flash programming interface, we need to upgrade Eclipse with the PyOCD plug-in. The PyOCD plug-in requires first to install Python software
From the Debugger tab, select the Browse button next to PyOCD Setup / Executable, choose the pyocd-gdbserver.exe and press OK
Click on the buttons Apply and Debug to launch the debug session
In the console, you should see the project starting to be programmed in the K64F MCU of the Hexiwear board
Press the Resume icon from the toolbar to start the application
Code Examples: Flashlight and Haptic Feedback
Excercise 1: Flashlight LED Tweaks
Open flashlight_driver.c. The source is shown in the image:
This code is designed for turning or of the RGB LED based on input from app on Hexiwear unit
Change Code for RED LED.
Press the Debug icon from the toolbar to start the application
Press the Resume icon from the toolbar to start the application
Now using flashlight app on Hexiwear, Red LED would turn on instead on RGB LED
Exercise 2: Change Haptic Feedback Duration
• Use the same file flashlight_driver.c
• Locate haptic_Vibrate() function.
• Open the haptic_Vibrate() function
• Changing the OSA_TimeDelay () value will change the vibration duration of the Haptic feedback motor on every click. Change the value to 200.
• Press the Debug icon from the toolbar to start the application.
Now on every click the haptic feedback would be longer.