KINETIS KW41Z/31Z/21Z WIRELESS MCUS ENABLING TRUE MULTI-PROTOCOL APPLICATIONS IN A SINGLE MCU 2.4 GHZ MULTI-PROTOCOL BLUETOOTH LOW ENERGY V4.2 AND IEEE 802.15.4 STANDARD
1 KW41Z OVERVIEW
Kinetis KW41Z/31Z/21Z: Key Differentiators Multi-Protocol Radio High performance radio supporting Bluetooth Smart/Bluetooth Low Energy (BLE) v4.2, Generic FSK and IEEE 802.15.4 (Thread) based standards Large Memory Enough memory to adequately contain desired networking stack(s) with ample room remaining for custom applications Low Power Low transmit, receive and standby currents that maximizes battery life, including standard coin-cells Complete Enablement Fully compliant, certified Bluetooth Low Energy, Thread and 802.15.4 MAC/PHY. Support for Generic FSK, BLE Mesh, SMAC, multiple RTOSes, KSDK 2.0, KDS and IAR IDEs. 2
Kinetis KW41Z/31Z/21Z Core/System Cortex-M0+ running up to 48 MHz Four independently programmable DMA controller channels Memory Up to 512kB Flash Up to 128 kb SRAM Core ARM Cortex-M0+ 48 MHz Interrupt Controller Debug Interfaces System Internal and External Watchdogs DMA Low Leakage Wake-Up Unit Memories Up to 512 kb Flash Up to 128 kb SRAM Transceiver BLE 4.2, Generic FSK & 802.15.4 radio Balun Security Radio Support for BLE v4.2, 802.15.4, Generic FSK -95 dbm in BLE mode, -100 dbm in 802.15.4 mode -30 to +3.5 dbm programmable output power 6.8 ma Rx & 6.1 ma Tx (0dBm) current target (DC-DC enabled) On-chip balun with single ended bidirectional RF port Communications/HMI/Timers 2xSPI, 2xI2C, LP-UART, GPIO with IRQ capability (KBI) Carrier Modulated Timer (CMT) for infrared transmissions Hardware Capacitive Touch Sensing Interface (TSI) 3xFlexTimer (TPM) with PWM & quadrature decode support Low Power (LPTMR), Programmable Interrupt (PIT) and RTC timers Communications 2xI 2 C 2xSPI LPUART TSI CMT DC-DC Converter Analog 16-bit ADC 12-bit DAC Timers FlexTimers Programmable Delay Block Periodic Interrupt Timers Low Power Timer AES-128 True Random Number Generator Clocks Frequency Locked Loop Low / High Frequency Osc. Analog 16-bit ADC with integrated temperature sensor and battery monitor 12-bit DAC and 6-bit High-speed Comparator GPIO w/ IRQ Capabilities 6-bit ACMP Independent Real Time Clock Internal Reference Clocks Security AES-128 Accelerator and True Random Number Generator Advanced flash security Device Memory (Flash/RAM) Protocol Package MKW21Z512VHT4 MKW21Z256VHT4 512 kb / 128 KB 256 kb / 128 KB 802.15.4 7x7 48-pin Laminate QFN 4x4 75-pin WLCSP 3 Integrated DC/DC Converter Normal: 1.71V to 3.6V Buck : 2.1V to 4.2V for coin cell operation Boost : 0.9V to 1.795V for single alkaline battery operation Unique Identifiers 80-bit unique device ID programmed at factory 40-bit unique media access control (MAC) subaddress can be used for Bluetooth Low Energy or IEEE 802.15.4 MAC Address -40ºC to +105ºC MKW31Z512VHT4 MKW31Z256VHT4 MKW41Z512VHT4 MKW41Z256VHT4 Features Software and Protocol Stacks 512 kb / 128 KB 256 kb / 128 KB 512 KB / 128 KB 256 KB / 128 KB Description BLE v4.2 / Generic FSK BLE v4.2 / Generic FSK / 802.15.4 ( Supports concurrent operation) Bluetooth Smart Host Stack & Profiles Generic FSK (250 kbps, 500 kbps, 1Mbps) Thread Stack, IEEE 802.15.4 MAC, SMAC Thread + BLE Multi-Protocol Stack KSDK, RTOSes, MCUXpresso & IAR Support 7x7 48-pin Laminate QFN 4x4 75-pin WLCSP 7x7 48-pin Laminate QFN 4x4 75-pin WLCSP
Complete Enablement: Software IPv6 + 6LoWPAN, UDP 802.15.4 MAC/PHY BLE LL/PHY 2.4 GHz Bluetooth Low Energy Core Stack 4.2 Profiles Bluetooth v4.2 2.4 GHz Certificated Thread R1.1 Network Stack Thread + BLE Combo Stack IEEE 802.15.4 MAC/PHY Qualified Bluetooth Low Energy v4.2 Stack + Application Profiles IPv6 over BLE Generic FSK at 250, 500 and 1000 kbps SMAC w/ Connectivity Test for Regulatory Certification Support for Host MCU and MPU (Linux ) Processors Full integration with Kinetis SDK Multiple RTOS, including FreeRTOS and ucosii (BLE) MCUXpresso IAR Embedded Workbench 4
Enablement: KW41Z Development Board FRDM-KW41Z Freedom Development Kit Can be configured as Host or Shield for connection to Host Processor Supports all DC-DC configurations (Buck, Boost, Bypass) PCB inverted F-type antenna SMA RF Connector Internal Balun RF regulatory certified Serial Flash for OTA firmware upgrades On board NXP FXOS8700CQ digital sensor, 3D Accelerometer (±2g/±4g/±8g) + 3D Magnetometer OpenSDA, SWD and JTAG debug Full KSDK, MCUXpresso support $145 suggested resale (2 boards in a box) USB-KW41Z USB Dongle/Sniffer Ideal for BLE/Generic FSK/802.15.4 sniffer or connection to PC/Tablet Integrated PCB meander antenna RF regulatory certified OpenSDA, SWD and JTAG debug USB Type A Connector $60 suggested resale 5
Enablement: Smartphone App Kinetis BLE Toolbox BLE Toolbox include support for the following BLE profiles: Glucose Blood Pressure Cycling Speed and Cadence Health Thermometer Heart Rate Proximity Running Speed and Cadence Also includes Beacon monitoring and support for customs profiles, including: Over the Air Programming (OTAP) Wireless UART Support Thread + BLE Hybrid demo Download from itunes App Store (ios) or Google Play (Android) 6
7 BLE
Bluetooth Low Energy Controller Present on KW41Z and the KW31Z Controller consists of Link Layer (LL) and PHY Layer BLE Link Layer (Hardware and Firmware) Data management Link Control Handle IRQ from the hardware Bluetooth Low Energy Host (Stack & Profiles) HCI Bluetooth Low Energy Link Layer Firmware BLE Physical Layer (Hardware) Setup and sustain BLE link Perform low latency functions Advertising, Scanning, etc Packet management Encryption KW41 support 2 connections at the same time Bluetooth Low Energy Link Layer Hardware Bluetooth Low Energy PHY Controller 8
Bluetooth LE protocol layers 9
Bluetooth Low Energy Software Environment Highlights: Broad range of the most common Bluetooth LE GATT profiles and demo applications Profile and Application Bluetooth Low Energy Host Stack Fully compliant implementation of the Bluetooth LE host specification v4.2 (L2CAP, ATT, SM, GAP, GATT) certified by BT SIG. Connectivity Framework HCI Host Controller Interface layer with software or UART transport options RTOS Kinetis SDK Bluetooth Link Layer Firmware Bluetooth Link Layer Hardware Connectivity Framework middleware collection Bluetooth Low Energy Link Layer firmware library that interacts with the corresponding hardware. KW41Z/31Z MCU Bluetooth PHY Kinetis SDK v2.0 driver Integration with the most common RTOS s available in Kinetis SDK: FreeRTOS, µcosii and bare-metal non-preemptive scheduler. 10 2 connections at the same time
KW41Z Bluetooth Low Energy Profiles 11 A4WP Wireless Power Profile ANP - Alert Notification Profile ANS - Alert Notification Service BAS - Battery Service BLP - Blood Pressure Profile BLS - Blood Pressure Service CPP Cycling Power Profile CPS Cycling Power Service CSCP - Cycling Speed and Cadence Profile CSCS - Cycling Speed and Cadence Service CTS - Current Time Service DIS - Device Information Service FMP - Find Me Profile GLP - Glucose Monitor Profile GLS - Glucose Monitor Service HIDS - Human Interface Device Service HOGP - HID over GATT Profile HRP - Heart Rate Profile Standard GATT Profiles/Services HRS - Heart Rate Service HTP - Health Thermometer Profile HTS - Health Thermometer Service IAS - Immediate Alert Service IPSP Internet Protocol Support Profile LLS - Link Loss Service OTAP Over the Air Programmer Profile (proprietary to Freescale) PASS - Phone Alert Status Service POP Pulse Oximeter Profile PXP - Proximity Profile RSCP - Running Speed and Cadence Profile RSCS - Running Speed and Cadence Service RTUS - Reference Time Update Service TIP - Time Profile TPS - Transmit Power Service UDS - User Data Service
12 THREAD
What is Thread? A secure wireless mesh network for your home and its connected products Supports IPv6 addresses and simple IP bridging Built on well-proven, existing technologies Runs on existing 802.15.4 silicon Uses 6LoWPAN with IPv6 addressing UDP Transport and CoAP support Can support many popular application layer protocols and platforms Is optimized for low-power / battery-backed operation Is intended for control and automation (250kbps) Can support networks of 250 nodes or greater Supports low latency (less than 100 milliseconds) Offers simplified security and commissioning Reliable for critical infrastructure 13 Thread Specification is opened to public now. A software upgrade can add Thread to currently shipping 802.15.4 products
IoT Connectivity Landscape Where does Thread play? Application Layer/ Profiles Network Layer/ Transport Layer Bluetooth Host Stack TCP / UDP IPv4 / IPv6 6LoWPAN RF4CE ZigBee PRO Physical / Link Layer (PHY/MAC) Bluetooth Link Layer IEEE 802.11n 1x1 IEEE 802.15.4g IEEE 802.15.4 (low power networking) Wearables Edge Node to Gateway Sub-1 GHz Industrial Wireless 2.4 GHz Home Automation & Control Networks 14
Promise of IoT requires IP All the Way to the End Node Cloud Services can address devices from the Internet Home Network can directly address devices through Border Routers Devices can address local devices on HAN or off network devices using normal IP addressing Reduce Middle man attacks using secure DTLS connections from the end node to the cloud Wi-Fi or Ethernet Border Router THREAD Network Cloud Connectivity For control when not at home When within the home, phone or tablet must go direct to gateway to eliminate latency of going to the cloud Has to be seamless to consumer Border Router Bridge from the Thread Network to Wi-Fi/Ethernet Forwards data to cloud Provides Wi-Fi connectivity to phone, tablet or other devices in the home network. Device Communication Device to device communication within the Thread network for operations in the home 15
16
Network Architecture End Device or Router Eligible Device Active Router Leader Border Router Thread Network 17
Network Topology Roles Cellular Ethernet Wi-Fi Thread Border Router Border Router forwards data to and from the cloud Also can provide Wi-Fi/Ethernet connectivity in the home Thread Leader Master of network parameters Coordinates commissioners Routes traffic among devices Thread Active Router Routes traffic among devices Thread Routers form backbone of the Thread mesh Leader-eligible End Device Designed for low power May be powered or sleepy May be router-eligible if powered + + + Many One Up to 31 Up to 512 = per Active Router Thousands of Devices per Network (16k) 18
Thread Border Router The Border Router Is usually a subset of Router Eligible Device Has at least one additional interface than IEEE 802.15.4 (e.g.: Wi-Fi, Ethernet, USB) Facilitates IP packet forwarding to and from the Thread network to home LAN or upstream IP infrastructure Can be multiple Border Routers in a Thread Network The Border Router Can be a specialized networking device End Device Router Eligible THREAD Router Leader Border Router THREAD Link Wireless Access Point (WAP) Home Gateway Or can be embedded in a consumer product Thermostat Appliance 19
Thread Router Eligible Device A Router Eligible Device can play multiple roles at runtime Leader If it is the initial device in the network partition, or when the current leader is unavailable Router Eligible End Device (REED) Immediately after joining a network through an existing Active Routers or if the network has sufficient connectivity and does not need more routers End Device Router Eligible THREAD Router Leader Border Router THREAD Link Active Router A REED requests the Leader for it to become an Active Router when the network has relatively limited connectivity. e.g.: when total number of existing Active Routers is < 16 A Router Eligible Device is regularly a device meant to remain mains powered and always on 20
21 Robust: No Single Point of Failure
Thread End Devices An End Device Does not have routing capabilities Communicates through a parent Active Router, but does not use data polling Cannot become a router (is not router eligible) An End Device can be mains powered but pe.ri.odically turned off or has a high capacity battery with recharge A Low Power End Device End Device Router Eligible THREAD Router Leader Border Router THREAD Link Does not have routing capabilities Is a Sleepy End Device (SED), mostly having its radio transceiver turned off Communicates through a parent Active Router, and uses data polling to receive packets Cannot become a router (is not router eligible) A Low Power End Device has a limited capacity battery, usually non rechargeable (e.g.: coin cell) 22
NXP s Thread Hardware Offering NXP Kinetis KW2xD, KW41Z Thread Router / REED / End Device Tower Board and Freedom Board Kinetis SDK and FreeRTOS NXP Kinetis KL46 + MCR20A Transceiver Thread End Device Freedom Board Kinetis SDK and FreeRTOS KW41Z Supports All Thread Components End Device Thread Router Leader Border Router Thread Link + NXP i.mx6 UltraLite EVK + FRDM-KW24D or FRDM-KW41Z Thread Border Router / Cloud gateway Provides IP data routing and infrastructure integration i.mx6ul EVK & Freedom Board Runs Linux operating system NXP Kinetis K64F + MCR20A Transceiver Border Router with Ethernet & upcoming Wi-Fi support (QCA400x) Freedom Boards Kinetis SDK and FreeRTOS 23 The most complete Thread end to end platform available!
KW41Z/21Z Thread Device Type Code Estimates Application Thread Stack 802.15.4 MAC/PHY KW41Z End Device 256kB Flash 30kB RAM Application Thread Stack 802.15.4 MAC/PHY KW41Z Router Device 320kB Flash 50kB RAM Application Thread Stack 802.15.4 MAC/PHY KW41Z SPI / UART Border Router 320kB Flash 50kB RAM 24 i.mx6ul
25 THREAD + BLE
Example: BLE + Thread Software Block Diagram 26 PUBLIC
BLE + Thread Multi-Protocol 1. 802.15.4 wants to send a message. It uses SW API to determine the time until the next BLE connection event. 2. Time was not sufficient, so transfer is scheduled after the BLE connection event. 3. 802.15.4 ends the transfer. 4. 802.15.4 starts a packet reception. 5. BLE connection event arrives. It takes control over the radio and 802.15.4 reception is aborted. BLE 802.15.4 1 3 5 27 PUBLIC 2 4
Multi-Protocol Application Door Lock using Thread and Bluetooth Low Energy Smart Door Lock contains KW41Z Multi-Protocol Radio Bluetooth Low Energy Thread (802.15.4) Thread Network Direct and Network Controlled and Monitoring Out-of-band commissioning of device on Thread network using BLE Control directly from BLE enabled phone Control and monitoring using cloud connected Thread mesh network Smart Door Lock BLE Direct Communication 28
Thread + BLE KW41 Demo Application BLE UART to Thread Shell Thread Network BLE Direct Communication FRDM-KW41Z 29
THREAD LARGE NETWORK TESTING (LNT) 30
Thread Large Network 250 Distributed Setup 26 26 26 26 26 50 26 20 24 31
Thread Large Network 250 Distributed Setup 32
Thread Large Network Tests 250 nodes Device Attach Time (without commissioning) Power up all devices. Each device will send a Beacon Request frame trying to join the network. Measure time for child to attach to parent node Attach time average: 89 seconds, min: 1.5 seconds, max: 533 seconds NWK recovery time after the leader is removed Remove the leader from the network. Wait for the network to recover 10 minutes NWK recovery time after power down Start with a functional/stable Thread network A reset command is issued (equivalent to a power cycle) Wait until all the nodes are functional/stable in the network 10 minutes 33
Devices (%) Thread Large Network Tests 250 nodes Unicast Message Latency Send unicast ICMP-Echo.Request with 10 bytes of payload to each device in a round robin fashion at 1 second interval. Collect RTT information for each device Unicast RTT - 10 bytes payload 50 45 40 35 30 25 20 15 10 5 34 0 RTT (ms) 20 40 60 80 100 150
35 HANDS-ON STARTS
Thread What you need Hardware Setup : - Freedom KW41 x 2 - musb Cable x 2 - USB Hub x 1 Software Setup : - MCUXpresso IDE -SDK_2.2_FRDM-KW41Z - Teraterm or any Hyperterminal program ( Baud rate (115K), 8 bit, Parity ( none), stop ( 1bit), FlowControl( None) Network Name : Group_x Network pass phrase : Passphrase_x Bluetooth name : BLE_Group_x 36
Thread What you need KW41 Freedom Board x 2 Micro USB x 2 USB Hub x 1, in case, your PC do not have enough USB port. Hardcopy of this hands-on exercise x 1, in case you need to follow up on the sequence. Hyperterminal Program. In this exercise, we used Teraterm. If you have your own preferred Hyperterminal program, then it is still OK. Teraterm in the USB Thumbdrive MCUXpresso KW41 SDK x 1 in the USB Thumbdrive 37
Thread Preparation of IDE, Install SDK ( Imported) Create your own project directory for a new workspace 38
Thread Preparation of IDE, Install SDK ( Imported) Import existing project - From File Tab menu - Choose Import - From Import Menu, choose General Existing Projects into Workspace - Select the root directory - Browse to your project directory and press OK - Please make sure that your workspace directory and the imported files are directory are the same, else it will have compile error as the toolchain searches for the relevant files 39
Thread Preparation of IDE, Install SDK ( Imported) Select the two items as shown - One project for Commisisoner and the other project for nodes - Press Finish 40
Thread Preparation of IDE, Install SDK ( Imported) In the Project explorer window, it should show 2 imported projects as selected earlier 41
Thread Preparation of IDE, Install SDK ( Imported) You need to drag and drop the relevant SDK into the Installed SDKs dialog Box 42
Thread Preparation of IDE, Install SDK ( Fresh project) Import projects from selected SDK Choose SDK_2.x_FRDM-KW41Z 43
Thread Preparation of IDE, Selection of Projects(Fresh project) Choose the right SDK Choose the right development frdmkw41z Shown here with the right SDK 44
Thread Preparation of IDE, Selection of Projects(Fresh Project) Choose the right project ble_thread_router_wireless_uart for Commisioner Choose the right project router_eligible_device For Node 45
Thread Preparation of IDE, Succesful import of projects(fresh) display here are the two imported projects 46
Thread - Change Network Name ( Hybrid, Commisioner) Select the right project, it is being highlighted Select the right file. Change the network name. Used the name that was given on the paper.. Calculate the number of characters of the given network name 47
Thread - Change PassPhrase( Hybrid, Commisioner) Select the right project, it is being highlighted Select the right file. 48 Calculate the number of characters of the given passphrase Change the passphrase to the one that was given on the paper.
Thread - Change Network Name ( Router) Change the network name. Used the name that was given on the paper.. Select the right project, it is being Highlighted. Now is the router project. Previously was Hybrid, Commisioner project Select the right file. 49 Calculate the number of characters of the given network name
Thread - Change PassPhrase( Router) Select the right project, it is being Highlighted. Now is the router project. Previously was Hybrid, Commisioner project Select the right file. Change the passphrase to the one that was given on the paper. 50 Calculate the number of characters of the given passphrase
Thread - Change BLE name ( Hybrid, Commisioner) Select the right project, it is being Highlighted. We switch back to Hybrid Commisoner project. Select the right file. 51 Calculate the number of characters of the given BLE name Change the BLE name to the one that was given on the papaer.
Thread - Using more than a single Channel number ( Hybrid) Select the right file. To scan and create the network using more than 1 channel. 52
Thread - Using more than a single Channel number ( Node) Select the right file. To scan and create the network using more than 1 channel. 53
Thread Compile on Hybrid, Commisioner project Select the Hybrid Commsioner project again and compile 54
Thread Compile on Hybrid, Commisioner project At the end of the compilation, if you see the.axf file generated as shown, it means successful built, if not, something is wrong. Take note of the file name of the generated.axf. it is the Hybrid Commisoner project 55
Thread Compile on Node project Select the node and compile 56
Thread Compile on Node project At the end of the compilation, if you see the.axf file generated as shown, it means successful built, if not, something is wrong. Take note of the file name of the generated.axf. it is the Node project 57
Thread Downloading process Before downloading starts, please pull out both the Hybrid Commisoner and the Node USB cables from your PC The MCUXpresso will get confused if both of them are connected together at the same time and the launch configuration of your projects will get corrupted. 58
Thread - KW41 Board ( Commissioner & Node ) Reset button Temperature sensor button Caution : be careful not to press The rest of other button. Don t pressed this button. Will activate Other joining process 59
Thread Download Hybrid Commisioner project Select the Hybrid Commisioner project With the Hybrid Commisisoner Freedom board Connected to your PC, click this Debug. It will compile again and download the debug file (.axf) to the Freedom Board 60
Thread Download Node project Select the Node project Pull out the Commisioner Freedom Board first before downloading the node built compiled.axf file With the Node Freedom board Connected to your PC, click this Debug. It will compile again and download the debug file (.axf) to the Freedom Board 61
Thread - Creation of a new network (Hybrid, Commisioner) Network successfully started -- Connect the Hybrid Commisioner Board to the PC with a USB cable -- Launch Hyperterminal Teraterm -- choose the right COM port and used 115Kbs, then pressed reset button on the Freedom board -- Type thr create 62
Thread - Joining the Created network ( Nodes) -- Connect the Node Board to the PC with a USB cab -- Launch a 2 nd Hyperterminal, Teraterm window, choose the right setting 115Kbs -- Pressed the reset button on the Freedom Board -- Type thr join Node successfully joined the network 63
Thread - After a node has joined ( Commissioner, Hybrid) If the Node has successfully joined the network, you would see at the Commisioner s Hyperterminal windows, a Joiner accepted message 64
Thread - KW41 Board ( Commissioner & Node ) Reset button Temperature sensor button Caution : be careful not to press The rest of other button. Don t pressed this button. Will activate Other joining process 65
Thread - Executing an action, temperature reading ( Node) -- Pressed the temperature sensor button on the node Freedom board -- On the Node Hyperterminal window, you should see the local temperature readout display. Temperature reading readout locally 66
Thread - temperature receiving ( Commisioner) -- Switch to the Hybrid Commisioner Hyperterminal windows. -- You should be the same temperature reading sending over from the node and with Ipv6 information of the sender ( in this case, the node).. Temperature reading display over Thread network and at the same time telling who has sent them ( Ipv6) 67
Thread Thread + BLE Tool kit ( sending customized data) We need to make changes to this file 68
Thread Thread + BLE Tool kit ( sending customized data) Add in this section of the code 69
Kinetis BLE tool kit apps ( if we have more time) There will be many appearing. Choose the one that is yours ( BLE name) ( in slide 44) 70
Kinetis BLE tool kit apps ( sending customized data) Type thr data 71
Thread BLE tool kit apps ( Commissioner s reception) Commisioner hybrid receive command data from Smartphone and display local temperature readout locally. 72
Thread BLE tool kit apps ( Node s reception) Nodes receive temperature reading from Commisioner + telling who send over, in this case, it is the Commissioner.. 73