This document introduces new freedom development board FRDM-KL28Z and demonstrates the bubble application And how to import the existing project of Kinetis SDK V2.0(for FRDM-KL28 using the kinetis Design Studio version 3.2.0 implemented using FRDM-KW40ZFRDM-KW40Z
It demonstrates basic usage of the on-board accelerometer to implement a bubble level. A bubble level utilizes two axes to visually show deviation from a level plane (0 degrees) on a given access. This demo uses the FTM/TPM to modulate the duty cycle of two onboard LEDs to gradually increase LED intensity as the board deviates from a level state.
FRDM-KL28Z Description:
The KL28Z is a sub-family of 32-bit Kinetis microcontrollers based on the ARM CortexR-M0+ processor. It is an extension of the existing L series MCU family, with additional memory. The KL28Z sub-family provides up to 96 MHz (HSRUN mode) CPU performance. It supports ultra low power, up to 512 KB Flash with 128 KB SRAM and integrates functions such as USB with crystal-less recovery.
The FRDM-KL28Z hardware is a Freedom development board assembled with the following features:
- MKL28Z512VLL7 MCU (96 MHz, 512 KB Flash, 128 KB RAM, 32 KB ROM,100 LQFP package)
- 3-Axis Digital Angular Rate Gyroscope, FXAS21002CQ (U2)
- Accelerometer and magnetometer, FXOS8700CQ (U10)
- OpenSDA: On-board serial and debug adapter (U7)
- I/O headers for easy access to MCU I/O pins
- Ambient light sensor (Q1)
- Flexible power supply options: USB, coin cell battery, external source
- Capacitive touch slider
- Reset push button (SW1)
- NMI and LLWU buttons (SW2, SW3)
- RGB LED (D2)
The FRDM-KL28Z hardware is form-factor compatible with the Arduino R3 pin layout, providing a broad range of expansion board options. The on-board interfaces include an RGB LED, a 6-axis digital sensor (combining a 3D accelerometer and 3D magnetometer), a 3-axis digital angular rate gyroscope, an ambient light sensor, and a capacitive touch slider.
Prerequisite:
1. KDS3.2.0 installed on your computer
(You can download latest version of KDS from Here or direct download from below link:)
2. Install the boot loader driver with OpenSDA_V2_1.bin from below segger link:
https://www.segger.com/downloads/jlinkopensda
3. The freedom hardware board i.e FRDM-KL28Z
Below are the steps involved in this demo activity:
Step-1: Install the boot loader driver with OpenSDA_V2_1.bin to freedom board
Step-2 Kinetis SDK V2.0 configuration generation for FRDM-KL28Z
Step-3 Import the example project from the downloaded SDK
Step-4 Build your project and execute it
We will proceed to our demo
Step-1 Install the boot loader driver with OpenSDA_V2_1.bin to freedom board:
The FRDM-KL28Z board comes loaded with the mbed/CMSIS-DAP debug interface from the factory. However, this interface is not supported with the KL28 family in the current version of KDS. In order to use the KDS IDE to download and debug, you need to install the J-Link OpenSDA v2.1 application.
To install the JLink OpenSDA v2.1 application on the FRDM-KL28Z board:
1. Download JLink OpenSDA v2.1 from below SEGGER website [https://www.segger.com/downloads/jlinkopensda/OpenSDA_V2_1.bin]
2. With the board unpowered, hold down the Reset button on the FRDM-KL28Z and plug in a mini-B USB cable into the “SDA USB” USB port on the board.
3. Release the Reset button.
4. The board will enumerate as a “DAPLINKBOOT” drive.
5. Drag and drop the application .bin file you just downloaded into this drive.
6. Do a power cycle, and now the board will be running the JLink OpenSDA application.
After loading the boot loader to your hardware board you can check the same at your computer’s device manager as shown below:
Step-2 Kinetis SDK V2.0 configuration generation for FRDM-KL28Z
Refer to my earlier blog on getting SDK V2.0 for FRDM-KL28Z
Kinetis SDK V2.0 configuration generation for FRDM-KL28Z
SDK has been stored at location “C:\Users\brao\Downloads\SDK_2.0_FRDM-KL28Z”
SDK_2.0_FRDM-KL28Z is the sdk package
Step-3 Import the example project from the downloaded SDK
These steps show how to open and build a demo project in KDS IDE for FRDM-KL28Z.
Open KDS 3.2.0 from default workspace
Select File->Import from the KDS IDE menu. In the window that appears, expand the "Project of Projects" folder and select "Existing Project Sets". Then, click the "Next" button.
Click the "Browse" button next to the "Import from file:" option.
Now direct the path of SDK V2.0 as shown in step-2
“C:\Users\brao\Downloads\SDK_2.0_FRDM-KL28Z\boards\frdmkl28z”
You will find “demo_apps” folder in which few application demos can be found
Click on finish and proceed further
You can browse the application code in bubble.c file in workspace as shown
Step-4 Build your project and execute it
Connect your board and follow below steps:
To build the project click on hammer button as shown:
Open debug configuration from below shown window
Now proceed by clicking Debug button
You will see the debug window as shown below:
Press Resume button to start executing the project
Open hyperterminal window of your choice, i have putty terminal:
As shown earlier the port number can be detected from device manager
Open a serial terminal on PC for OpenSDA serial device with these settings:
- 115200 baud rate
- 8 data bits
- No parity
- One stop bit
- No flow control
The bubble application demonstrates basic usage of the on-board accelerometer to implement a bubble level. A bubble level utilizes two axes to visually show deviation from a level plane (0 degrees) on a given access. This demo uses the FTM/TPM to modulate the duty cycle of two onboard LEDs to gradually increase LED intensity as the board deviates from a level state.
When the board is programmed, simply tilt the board to see the LED illuminate. One LED color indicates X-axis angle while another indicates Y-axis angle. When the example runs successfully, you can see the similar information from the terminal as below.
You can see the project execution on the terminal as shown below:
You will see the change of LED brightness when change angles of board