Freescale Semiconductor, Inc. Document Number: KW40ZBRDUG User's Guide Rev. 1, 01/2016 KW40 ZumoBot Reference Design By: Alberto Vargas 1. Introduction The ZumoBot Reference Design is initially provided with the ZumoBot mobile application. This application interacts with the ZumoBot. It enables scanning BLE devices, service discovery, battery measurement, and ZumoBot control using the HID profile. This document targets on the Freescale Freedom FRDM-KW40Z development board. This section details the hardware and software requirements to use the ZumoBot. 1.1. Supported hardware The ZumoBot firmware application is designed to run on the Freescale FRDM-KW40Z board. For more information about the FRDM-KW40Z board, see the documentation on www.nxp.com/frdm-kw40z. 1.2. System requirements IAR Embedded Workbench 7.40.1 (or later) FRDM-KW40Z board KW40Z Connectivity Software and download link Smartphone with Bluetooth 4.0 and Android 4.3.1 (or later) Contents 1. Introduction... 1 1.1. Supported hardware... 1 1.2. System requirements... 1 1.3. ZumoBot software... 2 1.4. ZumoBot features... 2 2. SoC (System on Chip) details... 2 2.1. Kinetis KW40 description... 2 2.2. Kinetis KW40 radio features... 2 3. Hardware setup... 3 3.1. Zumo shield... 3 3.2. FRDM-KW40Z... 4 4. Software setup... 4 4.1. Battery measurement... 4 4.2. Downloading firmware... 5 4.3. Debugging firmware... 6 5. Assembling the demo... 7 5.1. Required items... 7 5.2. Step-by-step assembly... 7 6. Running the demo... 8 6.1. ZumoBot mobile application... 8 7. Troubleshooting and known issues... 12 8. Zumo shield manufacturer information... 13 9. Revision history... 13 2016 Freescale Semiconductor, Inc. All rights reserved.
SoC (System on Chip) details 1.3. ZumoBot software Download the ZumoBot software from the Freescale web site (www.nxp.com). Section 3, Hardware setup, Section 4, Software setup, and Section 6, Running the demo describe how to use this reference design. 1.4. ZumoBot features Created using the FRDM-KW40Z board with Bluetooth Smart (BLE) connectivity Based on Kinetis Software Development Kit (KSDK) Application based on the HID profile Battery service implementation Smartphone connectivity 2. SoC (System on Chip) details 2.1. Kinetis KW40 description The KW40Z/30Z/20Z (referred to as KW40Z throughout this document) is an ultra-low-power, highly integrated single-chip device that enables Bluetooth low energy (BLE) or IEEE Standard 802.15.4 RF connectivity for portable, extremely-low-power embedded systems. The applications include portable health care devices, wearable sports and fitness devices, AV remote controls, computer keyboards and mice, gaming controllers, access control, security systems, smart energy, and home area networks. The KW40Z SoC integrates a radio transceiver operating in the range from 2.36 GHz to 2.48 GHz, supporting a range of FSK/GFSK and O-QPSK modulations, an ARM Cortex-M0+ CPU, 160 KB flash and 20 KB SRAM, BLE Link Layer hardware, 802.15.4 packet processor hardware, and peripherals optimized to meet the requirements of the target applications. The KW40Z SoC s radio frequency transceiver is compliant with Bluetooth version 4.1 for Low Energy (aka Bluetooth Smart), and the IEEE standard 802.15.4-2011 using OQPSK in the 2.4 GHz ISM band. 2.2. Kinetis KW40 radio features 2.4 GHz ISM band (2400-2483.5 MHz) and MBAN 2360-2400 MHz operation Supported standards: Bluetooth v4.1 Low Energy compliant 1 Mb/s GFSK modulation IEEE Std. 802.15.4-2011 compliant O-QPSK modulation Freescale Thread Networking Stack Bluetooth Low Energy (BLE) application profiles ZigBee PRO and application profiles 2 Freescale Semiconductor, Inc.
Hardware setup Receiver performance: Receive sensitivity of -91 dbm for BLE Receive sensitivity of -102 dbm typical for IEEE Std. 802.15.4 Programmable transmit output power from -18 dbm to +5 dbm with DC/DC bypass and buck modes of operation Bluetooth Low Energy Link Layer hardware Hardware acceleration for IEEE Std. 802.15.4 packet processing 32 MHz crystal reference oscillator Supports antenna diversity option for IEEE Std. 802.15.4 Supports dual PAN for IEEE Std. 802.15.4 with hardware-assisted address matching acceleration Differential RF port shared by transmitter and receiver Low count of external components Supports transceiver range extension using external PA and/or LNA 3. Hardware setup 3.1. Zumo shield You must add several pins to enable the battery measurement feature. These pins must use the differential ADC inputs of the FRDM-KW40Z. See Section 4, Battery Measurement for more information. Blue Section A0 must be connected to GND to have a GND reference in the ADC0_DP0 input. Green Section A1 must be connected to the battery level. This delivers a safe voltage level for the ADC0_DM0 input of the FRDM-KW40Z board using the voltage divider included in the Zumo shield. Red Section These pins are required for the FRDM-KW40Z header. Freescale Semiconductor, Inc. 3
Software setup 3.2. FRDM-KW40Z SH7 SH8 SH9 SH10 R3 R4 R5 R8 POT R78 J26 Table 1. Traces to cut Cut these traces to populate the required resistors to enable the PWM and GPIO outputs for motor control. Table 2. Traces to populate Add 0 Ω resistors to send the PWM and GPIO output signals to J1-2, J1-4, J1-6, and J2-16. Table 3. Components to remove POT is connected directly to the ADC0_DM0 input. Remove it to keep the 2/3 ratio of the voltage divider included in the Zumo shield. Remove this resistor to avoid short circuit when using the battery measurement feature. Table 4. Components to add 5 V voltage regulator (LT1129-5 or LM7805 is recommended). It is required to supply the 5 V required by the Pololu Zumo shield. Table 5. Hardware signal and connectors description FRDM-KW40Z Signal name Connector pin Function Pin name MCU pin Zumo shield pin M2DIR 2 GPIO Output PTA0 1 8 J1 M1PWM 4 Right PWM Output TPM1_CH0 40 9 M2PWM 6 Left PWM Output TPM1_CH1 41 10 J2 M1DIR 16 GPIO Output PTB3 19 7 7.45V 16 Voltage Input P5-9V VIN V IN GND 14 GND GND GND J24 GND 12 GND GND GND 5V 10 Voltage Output P5V_USB 5V 3.3V 8 Voltage Output P3V3 3.3V J25 ADC 1 Input ADC0_DP0 24 A0 ADC 3 Input ADC0_DM0 25 A1 4. Software setup 4.1. Battery measurement The battery measurement feature only works with 1.2 V AA rechargeable batteries, and it is enabled in the firmware by default. Using regular AA batteries can damage the FRDM-KW40Z board with this feature enabled. 4 Freescale Semiconductor, Inc.
Software setup 4.1.1. Enabling battery measurement Follow these steps to enable the battery measurement: 1. Zumo shield: Add a jumper between A1 and BAT LEVEL (Zumo shield green section). Add a jumper between A0 and GND (Zumo shield blue section). 2. Firmware: app\zumobot\app.h: Make sure this macro is enabled (uncomment if necessary): #define gbatterymeasurementsupported_d 4.1.2. Disabling battery measurement Perform these steps to disable the battery measurement: 1. Zumo shield: Remove the jumper between A1 and BAT LEVEL (Zumo shield green section). Remove the jumper between A0 and GND (Zumo shield blue section). 2. Firmware: app\zumobot\app.h: Make sure this macro is not defined (comment if necessary): #define gbatterymeasurementsupported_d 4.2. Downloading firmware 1. Connect a micro-usb cable from the computer to the FRDM-KW40Z board. Wait for the drivers to install. 2. When the drivers are installed, the FRDM-KW40Z board is detected as a removable storage device. 3. Select a method to download the firmware to the board and follow the required steps. 4. Download the ZumoBot firmware from www.nxp.com/products/software-and-tools/reference- designs/kinetis-designs/bluetooth-low-energy-ble-controlled-robot:bluetooth- CONTROLLED-ROBOT. Freescale Semiconductor, Inc. 5
Assembling the demo 5. Unzip the file to this path: C:\Freescale\KW40Z_Connectivity_Software_1.0.0\ConnSw\examples\bluetooth. 4.2.1. Downloading firmware using binary file Perform these steps to download the firmware using a binary file: 1. Locate zumobot.bin on this path: C:\Freescale\KW40Z_Connectivity_Software_1.0.0\ConnSw\examples\bluetooth\zumobot\bin. 2. Drag and drop zumobot.bin into the DAPLink unit. 3. Wait until the computer finishes copying the file to the FRDM-KW40Z board. 4.2.2. Downloading firmware using IAR Embedded Workbench Perform these steps to download the firmware using IAR Embedded Workbench: 1. Download and install IAR Embedded Workbench version 7.4 (or later). Download a 30-day trial version from www.iar.com. 2. Open the file zumobot.eww. This file is located on this path: C:\Freescale\KW40Z_Connectivity_Software_1.0.0\ConnSw\examples\bluetooth\zumobot\applic ation\frdmkw40z\freertos\build\iar. 3. Compile the ZumoBot project. 4. Click the Download and Debug button to download the firmware to the FRDM-KW40Z board. 5. When the board is programmed, click the Stop button and assemble the demo. 4.3. Debugging firmware ZumoBot uses PTA0 to control the direction of the left DC motor. PTA0 is shared with SWD_DIO. When the pin is configured as a GPIO, the debugger is lost. To enable the debugger again, enable SW2 to switch the PTA0 between GPIO and SWD. The behavior of SW2 is as follows: A single press event changes the PTA0 to GPIO. A long press event changes the PTA0 to SWD_DIO. 6 Freescale Semiconductor, Inc.
Assembling the demo 5. Assembling the demo 5.1. Required items One Pololu Zumo shield One FRDM-KW40Z board Four AA rechargeable batteries The batteries are required to enable the battery measurement (See Section 4.1, Battery measurement on using regular AA batteries) ZumoBot App 5.2. Step-by-step assembly 1. Remove the blade from the Zumo shield. 2. Connect the FRDM-KW40Z board to the Zumo shield. Make sure the Zumo shield pins match the FRDM-KW40Z board headers. Freescale Semiconductor, Inc. 7
Running the demo 3. Put batteries into the ZumoBot. 6. Running the demo 6.1. ZumoBot mobile application The ZumoBot mobile application is designed to work with Motorola XT1032 (Moto G) running Android 4.3.1, and it is tested with these phones and Android versions: Table 6. Compatible phones Brand Model OS LG Nexus 4 Android 4.4.2 Android 4.3.1 Moto G Android 4.4.2 Motorola Moto X Android 4.4.2 Nexus 6 Android 5.0 Galaxy S3 Android 4.3.1 Samsung Galaxy S4 Android 4.3.1 Android 4.4.2 Galaxy S5 Android 5.0 Sony Xperia Z2 Android 4.4.4 8 Freescale Semiconductor, Inc.
Running the demo To use the ZumoBot mobile application, perform these steps: 1. Download the ZumoBot mobile application from Google Play. The ZumoBot mobile application requires a Smartphone with Bluetooth 4.0 and Android 4.3 (or later). 2. Turn on the ZumoBot. ZumoBot starts the advertisement process automatically. 3. Search for and launch the ZumoBot app on the smartphone. Freescale Semiconductor, Inc. 9
Running the demo 4. If Bluetooth is turned off, the application requests you to turn it on. 5. The ZumoBot application starts scanning automatically. Start or stop the scan by tapping the Scan/Stop button. Any ZumoBot device found is listed (as shown in the following figure). Select the ZumoBot device to connect with. 10 Freescale Semiconductor, Inc.
Running the demo 6. When the connection with the ZumoBot is established, the screen looks like this: 7. Use the Connect/Disconnect button to connect to/disconnect from the ZumoBot. 8. To disconnect from the ZumoBot, tap the Disconnect button or use the smartphone s Backward button to return to the scanning screen. Freescale Semiconductor, Inc. 11
Zumo shield manufacturer information 9. To operate the ZumoBot, move the slider controls to change the speed/direction of the ZumoBot. 7. Troubleshooting and known issues The application may crash when trying to reconnect. The application may require reconnecting to the ZumoBot if the GATT discovery fails. The connection may be unstable. If the application loses connection, tap the Connect button to reconnect to the ZumoBot or tap the Backward button to return to the scan screen and connect to the ZumoBot again. 12 Freescale Semiconductor, Inc.
Revision history 8. Zumo shield manufacturer information The Zumo shield makes it easy to build an Arduino-controlled Zumo robot. Mount the shield onto the assembled Zumo chassis, connecting it directly to the chassis battery terminals and motors, and connect the Arduino plugs into the shield (face-down). This shield includes dual motor drivers, a buzzer for playing simple sounds and music, user push-button, and a 3-axis accelerometer, compass, and gyroscope. The shield boosts the battery voltage to power the Arduino and it breaks out the Arduino I/O lines, reset button, and user LED for convenient access, and to accommodate additional sensors for features such as obstacle and edge detection. Manufacturer: www.pololu.com Zumo shield: www.pololu.com/product/2510 9. Revision history The following table summarizes the changes done to this document since the initial release. Table 7. Revision history Revision number Date Substantive changes 0 10/2015 Initial release. 1 01/2016 Updated Section 2.1, Kinetis KW40 description, Section 2.2, Kinetis KW40 radio features. Added Section 4.3, Debugging firmware and Section 7, Troubleshooting and known issues. Freescale Semiconductor, Inc. 13
How to Reach Us: Home Page: www.freescale.com Web Support: www.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: www.freescale.com/salestermsandconditions. Freescale, the Freescale logo, and Kinetis are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. ZigBee is a trademark of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. Android is a trademark of Google Inc. ARM, the ARM Powered logo, and Cortex are registered trademarks of ARM Limited (or its subsidiaries) in the EU and/or elsewhere. IAR Embedded Workbench is a registered trademark of IAR Systems. Bluetooth is a registered trademark of Bluetooth SIG, Inc. IEEE Std. 802.15.4 is a registered trademark of the Institute of Electrical and Electronics Engineers, Inc. (IEEE). This product is not endorsed or approved by IEEE. All rights reserved. 2016 Freescale Semiconductor, Inc. Document Number: KW40ZBRDUG Rev. 1 01/2016