NXP Semiconductors KW40 User manual

© 2015 Freescale Semiconductor, Inc. All rights reserved.
KW40 Heart Rate Monitor Using Bluetooth
Low Energy
User's Guide
1.Introduction
This document explains the features and usage of the
Bluetooth®Low Energy (BLE) Heart Rate Monitor
reference design which uses the KW40Z device. It does
not contain software or hardware descriptions. See the
Reference Manual (document BLEHRMRDUG) or
Design Guide (document KW40HRMRDUG) for
software and hardware descriptions.
1.1. Audience
The manual is intended for any person interested in
understanding the functionality of the BLE Heart Rate
Monitor reference design.
Freescale Semiconductor, Inc.
Document Number: KW40HRMUG
User's Guide
Rev. 0
,
10/2015
Contents
1. Introduction....................................................................1
1.1. Audience.............................................................. 1
2. Overview of reference design..........................................2
2.1. Get to know the BLE Heart Rate Monitor.............. 2
3. Unboxing........................................................................3
4. Functional description.....................................................4
4.1. Battery Retention State......................................... 4
4.2. Advertising State.................................................. 4
4.3. Connection with a smartphone .............................. 5
4.4. Operation............................................................. 6
4.5. Disconnecting from the application ....................... 7
4.6. Charging the battery ............................................. 7
5. User Interface Description...............................................8
5.1. Red LED.............................................................. 8
5.2. Green LED........................................................... 8
5.3. Application Button ............................................... 8
6. Loading firmware ...........................................................8
6.1. Prerequisites......................................................... 9
6.2. Download process ................................................ 9
7. Revision history............................................................ 10

Overview of reference design
KW40 Heart Rate Monitor Using Bluetooth Low Energy, User's Guide, Rev. 0, 10/2015
2 Freescale Semiconductor, Inc.
2.Overview of reference design
The BLE Heart Rate Monitor reference design demonstrates the implementation of a wireless
electrocardiogram (ECG) acquisition system. It features the Freescale MKW40 system on chip (SoC)
which includes an ARM® CortexTM M0+ processor together with a 2.4 GHz radio for BLE and
802.15.4.
The ECG signal is obtained from the finger tips and processed by the MKW40 SoC. Then, the user’s
heart rate is calculated and transmitted to a smartphone application using BLE. Figure 1 shows a general
block diagram of the system implementation.
Figure 1. Application block diagram
A Li-Ion coin-cell battery is also included. The LIR3040 is a 3.6V 200mA/h rechargeable. The Freescale
MC34671 is included provide a battery charger solution for the device.
2.1. Get to know the BLE Heart Rate Monitor
Figure 2 highlights the most relevant parts of the hardware.

Unboxing
KW40 Heart Rate Monitor Using Bluetooth Low Energy, User's Guide, Rev. 0, 10/2015
Freescale Semiconductor, Inc. 3
Figure 2. BLE heart rate monitor board
3.Unboxing
The demo kit contains two items: the main board and a LIR3048 coin-cell battery. The coin-cell battery
must be placed in the main board’s battery holder before you use the device. Figure 3 shows position of
the battery.
Figure 3. Battery placement
After you have inserted the battery, the device will enter a battery retention mode. It can now interact
with the user interface components.

Functional description
KW40 Heart Rate Monitor Using Bluetooth Low Energy, User's Guide, Rev. 0, 10/2015
4 Freescale Semiconductor, Inc.
4.Functional description
This chapter describes the device behavior across all its functional phases. It comprises all the required
information to fully understand the application’s functionality.
4.1. Battery Retention State
The battery retention state consists of turning off all the board indicators and program the KW40Z SoC
to be in a low power state for battery saving.
The device can only exit from this state by connecting the battery charger or by entering the device in
Advertising State (see the next section, 4.2).
The device enters in this state if a connection is not established during the advertising state or by
pressing the application button either when the device is advertising or connected.
4.2. Advertising State
When the device is in advertising state, presence reports are transmitted over the air so the BLE devices
nearby can be aware of the device’s availability for connection.
To enter the advertising phase, the device must be in Battery Retention State (see section 4.1) and the
application button must be pressed. The green LED will start blinking to indicate that the device is in the
Advertising State (see Figure 4).
Figure 4. Device advertising
The device will advertise for 30 seconds. If a connection is not detected during that time interval, the
device enters the battery retention state.

Functional description
KW40 Heart Rate Monitor Using Bluetooth Low Energy, User's Guide, Rev. 0, 10/2015
Freescale Semiconductor, Inc. 5
4.3. Connection with a smartphone
During the Advertising State, any BLE enabled smartphone can attempt to establish communication
with the device. The following steps must be performed on the smartphone side:
1. Enable Bluetooth on the smartphone and scan for devices. See the smartphone’s user
documentation to learn how to do this.
2. Search for device “FSL_HRS_RD” and attempt a connection with it.
Figure 5. Device report name
3. When the passkey is requested, type 123456.
4. After connection is established, open the Freescale BLE Toolkit application in the smartphone.
Any BLE heart rate application can be used as well.
5. Heart rate and battery level measurements will be reported in the application.
Figure 6. Application showing the reported measurements

Functional description
KW40 Heart Rate Monitor Using Bluetooth Low Energy, User's Guide, Rev. 0, 10/2015
6 Freescale Semiconductor, Inc.
4.4. Operation
After the device is connected, two types of measurements are reported to the smartphone application,
heart rate and battery level.
4.4.1. Battery level
The battery level reports the percentage of the remaining charge in the device battery. This value is
updated every 10 seconds in the smartphone application.
When the battery level reaches 0%, the device automatically enters the Battery Retention State and the
device cannot be used until the battery has enough energy. Any attempt to begin using the device with a
low battery will result in the red LED blinking three times indicating low battery level. See section 4.6
for instructions on how to properly charge the battery.
4.4.2. Heart rate measurements
When the device is connected to a heart rate application, it begins to report the acquired measurements.
The ECG is obtained from the fingertips by placing them in the on-board electrodes. You must carry out
the following steps to ensure accurate measurements.
1. Place your thumbs on the on-board firmware electrodes (see Figure 7). Avoid pressing too hard
to prevent muscular noise interference.
Figure 7. Fingers position
2. Wait for at least 10 seconds for the signal to stabilize. The red LED will blink every time a
heartbeat is detected.
NOTE
PCB electrodes might not always acquire the ECG signal immediately. If this happens and the
reported heart rate is shown as zero, remove your fingers from the PCB electrodes and repeat steps 1
and 2.

Functional description
KW40 Heart Rate Monitor Using Bluetooth Low Energy, User's Guide, Rev. 0, 10/2015
Freescale Semiconductor, Inc. 7
3. See the results on the smartphone screen. The results are updated every 2 seconds.
Figure 8. Heart rate report
4.5. Disconnecting from the application
A connection can end for three main reasons:
1. The connection is lost.
2. The connection is explicitly terminated by the smartphone.
3. The connection is explicitly terminated by the device.
When the connection is lost or explicitly terminated by the smartphone, the device enters the
Advertising State during 30 seconds. If the connection is not re-established during that time, the device
enters the Battery Retention State.
When the connection is explicitly terminated by the device by pressing the application button, it enters
the Battery Retention State.
4.6. Charging the battery
The BLE Heart Rate Monitor includes a rechargeable coin-cell battery and a battery charger. The device
actively reports the current battery level every 10 seconds when connected to a smartphone.
The included coin-cell battery is recharged by connecting a USB battery charger to the microUSB port
in the board (see Figure 2).
4.6.1. Device operation when charging
Immediately after the battery charger is connected the red LED will start blinking indicating that the
battery is being charged.
During charging, all BLE communications and analog processing is disabled. Any established
connection is terminated immediately after the charger is connected. Any advertising or connection
attempts are rejected during the time the charger is connected.
NOTE
To ensure user safety, the analog acquisition circuit is disabled during the charge of the battery.
Heart rate measurements are unavailable during that time.

Loading firmware
KW40 Heart Rate Monitor Using Bluetooth Low Energy, User's Guide, Rev. 0, 10/2015
8 Freescale Semiconductor, Inc.
After the battery is fully charged, the red LED will remain on to indicate that the battery charger can be
disconnected.
5.User Interface Description
In the BLE Heart Rate Monitor, the user interface is composed of two LEDs and one push button.
Functionality for each element is described below.
5.1. Red LED
Table 1 shows the possible indications for the red LED and its meaning.
Table 1. Red LED indications
LED Status
Indicated action
LED off
No action
LED fade
Battery charging
LED on
Battery fully charged
LED flash
Heartbeat detected
5.2. Green LED
Table 2 shows the possible indications for the green LED and its meaning.
Table 2. Green LED indications
LED Status
Indicated Action
LED off
No action
LED blink
Device advertising
LED fade
Device connected
5.3. Application Button
Table 3 shows the action performed by the application button depending on the actual state.
Table 3. Application button actions
Device state
Action performed
Battery Retention State
Enter Advertising state
Advertising State
Enter Battery Retention State
Connected
Enter Battery Retention State
Charging
None
6.Loading firmware
If a firmware update is required, a new version can be downloaded using a J-link programmer. This
chapter explains the firmware download process for the device.

Loading firmware
KW40 Heart Rate Monitor Using Bluetooth Low Energy, User's Guide, Rev. 0, 10/2015
Freescale Semiconductor, Inc. 9
6.1. Prerequisites
The following list details the required elements for the download process:
1. Download and install J-Link software v5.02 or higher from www.segger.com.
2. J-Link or J-Link Pro debugger.
3. heart_rate_sensor.bin file with the latest firmware.
6.2. Download process
The following steps explain the downloading process for the firmware.
1. Copy the heart_rate_sensor.bin file to the J-Link software installation folder. It is typically
located in C:\Program Files\SEGGER for 32-bit systems and C:\Program Files (x86)\SEGGER
for 64-bits systems.
2. Make sure that the battery is inserted properly (see Figure 3).
3. Connect the J-Link debugger to the SWD header in the board as shown in the following.
Figure 9. J-Link connection
4. In the J-Link software installation folder, execute the program JLink.exe. A terminal window
will open (see Figure 10).

Revision history
KW40 Heart Rate Monitor Using Bluetooth Low Energy, User's Guide, Rev. 0, 10/2015
10 Freescale Semiconductor, Inc.
Figure 10. J-Link.exe terminal
5. Type the following instructions and press the enter key.
—unlock kinetis
—device MKW40Z160xxx4
—loadbin heart_rate_sensor.bin 0
6. Wait for the board to flash (see Figure 11).
Figure 11. Board flashing
7. Remove the battery and insert it again to begin using the device.
7.Revision history
Table 4. Revision history
Revision number
Date
Substantial changes
0
10/2015
Initial release

Document Number: KW40HRMUG
Rev. 0
10/2015
How to Reach Us:
Home Page:
freescale.com
Web Support:
freescale.com/support
Information in this document is provided solely to enable system and software implementers to
use Freescale products. There are no express or implied copyright licenses granted hereunder to
design or fabricate any integrated circuits based on the information in this document.
Freescale reserves the right to make changes without further notice to any products herein.
Freescale makes no warranty, representation, or guarantee regarding the suitability of its
products for any particular purpose, nor does Freescale assume any liability arising out of the
application or use of any product or circuit, and specifically disclaims any and all liability,
including without limitation consequential or incidental damages. “Typical” parameters that may
be provided in Freescale data sheets and/or specifications can and do vary in different
applications, and actual performance may vary over time. All operating parameters, including
“typicals,” must be validated for each customer application by customer's technical experts.
Freescale does not convey any license under its patent rights nor the rights of others. Freescale
sells products pursuant to standard terms and conditions of sale, which can be found at the
following address: freescale.com/SalesTermsandConditions.
Freescale and the Freescale logo are trademarks of Freescale Seminconductor, Inc.Reg. U.S. Pat.
& Tm. Off.All other products or service names are the property of their respective owners.
ARM, the ARM Powered logo, and Cortex are registered trademarks of ARM Limited (or its
subsidiaries) in the EU and/or elsewhere.
© 2015 Freescale Semiconductor, Inc. All rights reserved.
Table of contents
Other NXP Semiconductors Monitor manuals