Getting to Know the FRDM-KL25Z

After quite some time, I finally gave up trying to get to know the FRDM-KL02Z Cortex-M0+ platform. It’s user base is practically non existent and software platforms don’t seem to want to know either. So I finally got myself the FRDM-KL25Z instead.

Like the KL02Z, the KL25Z is a Freescale (now NXP) Kinetis L series, ARM Cortex-M0+ microcontroller. The big difference between them is the amount of program flash, SRAM and GPIO/peripheral connections. The FRDM-KL02Z has 32K flash, 4K SRAM, runs at up to 48MHz and the MCU is the 32QFN package. In Contrast, the FRDM-KL25Z has 128K flash, 16K SRAM, also runs at 48MHz, the MCU is the 80LQFP package and also comes with USB OTG on chip. The KL25Z also has more than twice the GPIO capacity of the KL02Z. The boards themselves aren’t too different from one another. Both feature a tri-colour LED, 3-axis accelerometer, capacitive touch slider and an OpenSDA circuit for programming/debugging, with the KL25Z also featuring a USB OTG mini 5-pin socket.

First thing’s first: my programming skill isn’t enough for me to throw myself in to the bare-metal ocean, so I need a paddling pool to get me started. Enter mbed. mbed is an online development suite for various ARM Cortex microcontrollers. Think of it like the Arduino IDE, but far more powerful. This is also helpful, as both mbed and the FRDM-KL25Z have quite a broad user base, so help is at hand should I need it. And it is thanks to this, that after a few hours of noodling that I was able to use GPIO and the capacitive touch slider for some exploratory learning. Here is the code I used for my test:

#include "mbed.h"
#include "TSISensor.h"
#include "TouchButton.h"

DigitalInOut    LEDGRN( PTB8 );
DigitalInOut    LEDRED( PTB9 );

int main() {
    TouchButton TButton;
    LEDGRN = 0;
    LEDRED = 0;
    int key = 0;
    while( 1 ) {
        key = TButton.PresedButton();
        if( key == 2 ) {
            LEDGRN.input();
            LEDRED.output();
            wait_ms( 500 );
        }
        else if( key == 4 ) {
            LEDGRN.output();
            LEDRED.input();
            wait_ms( 500 );
        }
        else {
            LEDGRN.input();
            LEDRED.output();
            wait_ms( 500 );
            LEDGRN.output();
            LEDRED.input();
            wait_ms( 500 );
        }
    }
}

It’s not much, I know; I must start somewhere. But to break it down for other newbies like myself: There are two LEDs (red and green) connected to PTB9 and PTB8 respectively. They will flash alternately with a 500ms delay, until you touch the lower 25% or the upper 25% of the capacitive touch slider. When this happens, either the red OR the green LED will remain on, whilst the other is off. It’s simple, yes. It also demonstrates how easy it is to use the mbed suite for rapid prototyping and learning. Thumbs up from me.

Last, but not least, my video demonstration on Youtube:

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s