This document is part of a series:
Hello Freedom users
I spent sometime evaluating all the Freedom boards that Freescale has launched up to now, but I would like to re-focus on the Freedom FRDM-KL05Z, which has been launched early 2013 as it remains the easiest and cheapest solution to jump in the ARM Cortex-M world.
If you are a 8/16-bit MCU user (Microchip PIC, Atmel AVR, TI MSP430) looking for a simple and cheap platform to evaluate the capabilities of the ARM Cortex-M entry-level cores, this board featuring the Kinetis KL05, based on a 32-bit ARM Cortex-M0+ core (the latest released by ARM in 2012) and designed for low-power applications is made for you.
You can currently purchase the FRDM-KL05Z from the french store of Farnell for just 6,94€ so this board is really the cheapest one of the Freescale Freedom board portfolio.
1. Quick introduction of the Freescale Kinetis KL05 device inside the Kinetis Family
Kinetis L-Series MCUs are targeting Low-Power applications with an ARM Cortex-M0+ core clocked up (till now) to 48MHz (means up to 45DMIPS).
This family of MCUs can be powered as low as 1.71V (means 1.8V +/-5% tolerance) considering that all peripherals and writing flash are available at the lowest voltage supply (vs other competitors).
It includes nine low-power modes and low-power peripherals to provide power optimization based on application requirements.
The table below gives a quick overview of the Kinetis L-Series and the KL05 positioning
Then the block diagram below gives a detailed view of the peripherals embedded in the KL05 MCU featured on the FRDM-KL05Z
The FRDM-KL05Z is based on a MKL05Z32VFM4 device, which is a 32KB Flash, 4KB RAM, 32 QFN version.
Package is the same for every Freedom board, ie a compact and recyclable cardbox, inside which is slipped the Quick Reference Card.
This card is printed on a glossy paper and shows two high-resolution pictures of the board:
- one with callout to easily locate the components on the board
- another with Arduino R3 header (single-row) Pin-out
The USB cable is not included in the bundle to maintain a competitive resale price, but it is a classical USB to mini-USB so it should not be a problem.
The FRDM-KL05Z features the MKL05Z32VFM4 microcontroller from the KL0 family, which is a tiny brother of the MKL25Z128VLK4 embedded in the FRDM-KL25Z.
Compare to the KL25, the KL05 has no USB OTG controller, embeds less memory (Flash 32KB vs 128KB / RAM 4KB vs 16KB) and features a smaller package (32QFN vs 80LQFP).
The crystal populated on the FRDM-KL05Z is a 32.768KHz (vs 8MHz on the FRDM-KL25Z), so the solutions should have lower-power capabilities with the ability to work in low-power run modes (slow run for example @4MHz) from the external oscillator. It is especially useful to save power in active mode for applications with reduced computation needs.
The rest of the board features are similar to the FRDM-KL25Z:
- OpenSDA multimode interface for serial communications, flash programming and debug over USB
- 3-axis digital output accelerometer, Freescale MMA8451QR1
- Touch slider electrode
- RGB LED
- Reset button
Multiple mentions on the Quick Reference Card (‘Download tools and documentation under Jump Start Your design at’ or ‘Learn more at’ or ‘For more information visit’) encourage you to download the documentation and materials at www.freescale.com/FRDM-KL05Z
The Freescale webpage is splitted in five tabs: Overview, Documentation, Downloads, Buy/Specifications and Training & Support.
The Quick Start Guide giving basic instructions to properly connect the board is included in the Quick Start Package named FRDM-KL05Z_QSP.zip available in the Downloads section. This package also includes OpenSDA applications to reprogram the multimode Debug interface and Precompiled Project Examples to download using the Flash Programmer mode.
FRDM-KL05Z schematics are located in the Downloads section and the board User-Manual providing a detailed description of each feature implemented on the board is accessible from the Documentation tab.
3. First board connection to the computer
As mentioned in the Quick Start Guide, no drivers are required, when you plug for the first time the board to your computer.
Connect one end of the USB cable to an USB port of your computer and the other end to the OpenSDA USB connector of the FRDM-KL05Z. The board will be powered by this USB connection.
Your computer should detect four new peripherals and automatically installed the right drivers:
- USB Composite Device
- OpenSDA - CDC Serial Port
- USB Mass Storage Device
- FSL/PEMICRO MSD USB Device
FRDM-KL05Z comes with the OpenSDA application mass-storage device (MSD) Flash Programmer preinstalled, so a new removable storage drive labeled FRDM-KL05Z will appear in your file explorer.
You can check in Device Manager that the devices have been properly identified. If the OpenSDA - CDC Serial Port is not correctly detected some backup drivers SERCDC89.INF are available in the FRDM-KL05Z drive.
The demo pre-flashed in the Kinetis KL05 MCU will change the color of the RGB LED during one cycle.
When the color of the LED is not changing anymore, the accelerometer demo will start. Simply change the angle the board to change the color of the RGB LED based on the accelerometer measurement.
The touch feature has also been implemented, so the position of your finger along the capacitive slider will modify the brightness of the LED.
4. Reprogram the MCU with the OpenSDA Flash Programmer application
As mentioned previously, FRDM-KL05Z comes with the OpenSDA application mass-storage device (MSD) Flash Programmer preinstalled.
To reprogram the KL05 target, simply copy-paste or drag’n drop any Raw binary or Motorola S-record files into the FRDM-KL05Z drive from your file explorer. The corresponding project will be programmed directly into the flash of the KL05 MCU and executed automatically.
Let’s try it out, with some Precompiled Examples from the FRDM-KL05Z Quick Start Package.
The new application is now running on the FRDM-KL05Z !!
Note: It is not necessary to unplug and reattach the USB cable before reprogramming starting from the MSD Flash Programmer OpenSDA application v1.03 to reprogram repeatedly.
5. Debug a project example using the right OpenSDA application
To go further and compile your first FRDM-KL05Z project, a Sample Code package named KL05Z_SC.zip is available in the Downloads section of the FRDM-KL05Z webpage. This bundle includes a Sample Code Guide and several Project Examples (following the path \klxx-sc-baremetal\build) for the three major compilers supporting the Kinetis family: IAR EWARM, KEIL MDK-ARM and Freescale CodeWarrior for MCU.
This list of toolchain is not comprehensive and the Kinetis family is supported by the other tool vendors of the ARM ecosystem like Atolic TrueStudio, Emprog Thunderbench, Coocox CoIDE, GreenHills Multi, GNU … and of course the new free IDE of Freescale, Kinetis Design Studio (KDS), based on Eclipse and going to be released in October (it is currently downloadable at www.freescale.com/kds in beta version).
The FRDM-KL05Z is also supported by the mbed online development platform from ARM (like the FRDM-KL25Z, the FRDM-KL46Z and the FRDM-K64F).
Like any Kinetis MCU, the KL05 is also enabled by Freescale Processor Expert, an automated code generator tool with a Graphic Setup Interface of the core and the peripherals.
Processor expert is downloadable for free at www.freescale.com/processorexpert either embedded in the Codewarrior for MCU toolchain or separately as a standalone tool named Microcontroller Driver Suite.
Note: I will publish later some FRDM-KL05Z tutorials to create some simple projects in few steps thanks to the ease of use of Processor Expert and the mbed tools.
First you need to choose which IDE toolchain you want to evaluate to open the right project and upload the right OpenSDA Debug application:
- IAR Embedded Workbench for ARM v7.10 (or later) is available either in 30 day limited version (30-day) or 16KB code size limited version (Kickstart) at www.iar.com/ewarm
- KEIL Microcontroller Development Kit for ARM v5.11 (or later) is available in 32KB code size limited version (MDK-Lite) at www.keil.com/arm/mdk.asp
- FREESCALE CodeWarrior for MCU v10.6 (or later) is available either in 30 day limited version (Evaluation Edition) or 64KB code size limited version (Special Edition) at www.freescale.com/cwmcu10
Next you need to choose an OpenSDA Debug application considering that IAR EWARM, KEIL MDK-ARM are compatible with all of them and FREESCALE CodeWarrior only with the PE Micro and the Segger tools.
- PE Micro Debug (selected by default in the project examples of the FRDM-KL05Z Sample Code Package) available in the Firmware Apps package downloadable from P&E Microcomputer Systems
Note: Please download and install the Windows/Linux drivers available on the same webpage before loading the application
- CMSIS-DAP (ARM unified debug interface) available in the OpenSDA Applications of the FRDM-KL05Z Quick Start Package FRDM-KL05Z_QSP.zip
- Segger J-Link v1 available at https://segger.com/opensda.html
Note: Please download and install the J-Link software package (including Virtual COM port) available on the same webpage before loading the application
To load a new OpenSDA application:
1. Start your Freedom board in BOOTLOADER mode: Connect one end of the USB cable to your computer, then keep Reset button pressed while plugging the other end of the USB cable to the OpenSDA USB connector of the board, then release it.
2. From your file explorer drag'n drop or copy-paste the right SDA file corresponding to the Debugger wished (MSD-DEBUG-FRDM-KL05Z_Pemicro_vxxx.SDA or CMSIS-DAP_OpenSDA.S19 or JLink_OpenSDA.sda) into the BOOTLOADER drive
3. Unplug and replug the USB cable
4. Check in Device Manager that drivers have been properly installed: 'Jungo/PEMicro OpenSDA Debug Driver' or 'USB controller/J-Link driver' or Not Available for CMSIS-DAP
To Open a Project Example from the Sample Code package:
- Launch IAR EWARM, then select File / Open / Workspace... and choose any project file eww from the folder KL05-SC\klxx-sc-baremetal\build\iar\ then click on Open
- Launch KEIL MDK-ARM, then select Project / Open Project... and choose any project file uvproj from the folder KL05-SC\klxx-sc-baremetal\build\keil\ then click on Open
- Launch CodeWarrior, then select File / Import / General / Existing Projects into Workspace then press Next, Select Root Directory Browse... and choose any project folder from KL05-SC\klxx-sc-baremetal\build\cw\ then click on OK select the whished project in the Projects window and click on Finish
Let's try it out with the project LED_Blink
To change the Debugger in the IDE toolchain:
- IAR EWARM: Press Alt+F7 or select Project / Options... choose Debugger and select the right Driver (PE Micro or CMSIS-DAP or J-Link), for PE Micro go to the PE Micro sub-menu and select the OpenSDA - USB Hardware Interface Type
- KEIL MDK-ARM: Press Alt+F7 or select Project / Options for target 'xxx'... choose the Debug tab and select the right driver Used (PE Micro or CMSIS-DAP or J-Link), for PE Micro click on Settings and select the OpenSDA Embedded Tower Debug - USB Port Connection Port and Interface Type
- CodeWarrior: Select Project / Properties and choose Run/Debug Settings and select OpenSDA (refering to the PE Micro debugger) or the Segger J-Link and press Apply
To compile a project example:
- IAR: Select Project / Clean then Rebuild All
- KEIL: Select Project / Clean targets then Rebuild all target files
- CodeWarrior: Select Project / Clean... then Build All
To debug a project:
- IAR: Select Project / Download and Debug and choose Debug / Go to run the project
- KEIL: Select Debug / Start/Stop Debug Session
- CodeWarrior: Select Run / Debug and select the wished debug interface in the popup window
I hope this deep FRDM-KL05Z was usefull for your purchase decision or your evaluation
FRDM-KL05Z is a very cheap and easy solution to start with 32-bit ARM Cortex-M0+ MCUs from the Freescale Kinetis portfolio which is wide of more than 1.000 derivatives (400x ARM Cortex-M0+ and 600x ARM Cortex-M4)
There is a lot of software enablement (IDE Toolchain, Code Generator, RTOS, middleware) around this evaluation platform that I will develop in my next tutorials.