Blinking the Onboard LED on the Freescale FRDM-KL03Z

I had a lot of trouble getting started with this dev board so I thought I would summarize what I did to get the onboard led to blink.

You can get this board from Digikey or Mouser

Step 1: Download the IDE

I will be using the Kinetis Design Studio for this post which you can download here for free and install it.

You will also need the Kinetis SDK from here.  Until recently there wasn’t support for this dev board in the original SDK, but it appears to have been updated to work with this board.  When I installed mine I had to install a special KL03Z SDK.

Step 2: Create a Project

Go to File -> New -> Kinetis Design Studio Project

Name your project and click Next

Select the FRDM-KL03Z under Boards -> Kinetis

Click Next, then check the box for ProcessorExpert, Then hit Finish

Step 3: Configure the Project

I followed this guide up to the configuring pins part.  This is to make the project compile without warnings or errors.  There is also a link on this page on how to install the sdk if you have trouble with that part.

Step 4: Add McuOnEclipse to the IDE

We are using Processor Expert to make the code generation easier, but there is no function to delay or wait that I could find.  So I googled around a bit and found McuOnEclipse which adds a wait function which we will use to blink the led.

Guide here

Step 5: Add the Wait Component to Your Project

In the top bar select Processor Expert again and then click Show Views

Click on the tab for Components Library

Scroll down to Wait -> right click -> Add to Project

For more info on how to generate the Processor Expert code for the Wait command see this post.

Step 6: Write the Code

Very simple code to toggle the led on and off.

Under your Project expand the Sources folder and open the main.c file

Then just write this code where the comments say to write your code

while(1){

GPIO_DRV_TogglePinOutput(kGpioLED2);
WAIT1_Waitms(250);
}

Step 7: Install the SDA Debugger Firmware if you haven’t already

Go here and follow the install instructions.  I used this version:

Step 8: Configure the debugger

The steps can be found on page 24 of the attached pdf.  I am having trouble finding the original download for this pdf so I just attached it.

Kinetis SDK Freescale Freedom FRDM-KL03Z Platform User’s Guide

When uploading code just plug the board in with usb without holding down the reset button.

There is probably a better way to do this but it took me a long time to get to this point and wanted to make sure if I forget how to do it I have all the links in one place to follow.

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