Showing results for 
Search instead for 
Did you mean: 


No ratings



This document has links to videos to give tutorials on how to getting started *from scratch* with the freedom board.    In these tutorials we build projects with bare metal code to see how things work!   It includes the basics on how to get clocks running,  lights blinking and interrupts firing *from scratch*. For more code/peripheral examples that use a "bare metal" approach,  check out the page on the FRDM-TFC board.


While working with a large number of Freedom boards in a course,  it was observed that the InitClockRoutines would *sometimes* not work.    *Some* of the crystals on the freedom boards do NOT like "HIGH_GAIN" mode.   The new code is uploaded to this page but you could also change the code yourself:

  pll_init(8000000, HIGH_GAIN, CRYSTAL, 4, 24, MCGOUT);


  pll_init(8000000, LOW_POWER, CRYSTAL, 4, 24, MCGOUT);

Projects From Scratch for the Freedom Board with Codewarrior 10.3

Projects From Scratch - Part 2 - Importing other projects

Using the Freescale Header Files and Blinking the LED

Source code for video (Codewarrior 10.3) is in the attached files at the bottom of this document.

Clock Distribution

Source Code for the Clock Distribution video is in the attached files at the bottom of this document...

Interrupts Part 1 - Background

Interrupts Part 2 - ARM Systick Timer

Source Code for the ARM Systick Timer video is in the attached files at the bottom of this document.

Interrupts Part 3 - TPM (Timer Pulse Width Modulator) Overflow

Source Code for the TPM Overflow Interrupts video is in the attached files at the bottom of this doc...


This is Great !! Many, many Thanks to  eli_hughes for creating a tutorial page for this platform.

I think it is a great Idea , as many new comers to arm will have a jump start in development, + it is a value ad-don as your code is not generated automatically, so you really have to dig to learn . :smileyhappy:


-->>Can you please add some videos on life cycle of the code from compilation to execution , and

-->>It will be a huge help if you can add a video on how to create a bare bone project using gcc tool-chain with eclipse, as Code Warrior uses Open-Source GCC. :smileyhappy:

Thanks A lot .. ..

Thanks!   Spread the word!

I'll do my best on the videos.   I need to finish the parts I started.

Search for "FRDM-TFC".    You will find some bare metal stuff there as well!

Thank you very much!

I got this the other day and couldn't get it work with processor expert. This cleared out a lot of things for me :smileyhappy:. It's exactly what I was searching for.

Wating for the virtual COM port tutorial :smileygrin:

Thanks! I'll get to the other stuff soon.

If you are in a hurry, there is some example code of how to use the virtual com port through the SDA interface on the "FRDM-TFC" page.

Thank you for such a thorough introduction to KL25Z board !!

Thanks so much for all the time it must have taken to put this material together!

One question about clock distribution -

In theory, I understand why your change to pll_init()'s vdiv from 24 to 4 would slow down the LED blink rate. However, I wasn't able to get the example to work. I added a breakpoint to that line and found that it was returning 0x42, which according to the README is the following error:

0x42 - VDIV outside allowed range

I looked into mcg.c and noticed that its error checking is actually quite strict, ensuring that vdiv_val is between 24 and 50. In the end, I couldn't really get any values other than 48MHz to work, with all the checks it does. What am I doing wrong that you're doing right?


I should note that I did try changing to LOW_POWER and I still didn't see the blink rate change.

I am in the process of re-doing these videos to be CMSIS compatible.   I'll take a look when A get a moment.  For now you will just have to use at 48MHz.   Not sure what I did different in that video.

Hi Eli,

Thanks a lot for those tutorial. they are very useful since I started to play with the "Kinetis Design Studio" with "KSDK_1.3.0", and I develop a prototype with the "MKL34Z64VLL4" Kinetis MCU. it is a 100pin MCU and I populated with around 12 LEDS on some GPIO, I use a similar structure as the tutorial "Using the Freescale Header Files and Blinking the LED", and it is very similar, the only difference is that my code looks a little bigger, and instead of playing with two LEDS I am playing with 12 LEDs. Well my program compiles without errors or warnings, but once my program goes once pass on the main loop, it got stock for some reason while debugging, and when I paused it, I noticed that the program get stocked on the following lines:


    ldr    r0, =DefaultISR

    bx r0

Those lines belong to the "startup_MKL34Z4.s" file, and I don't have any clue how to fix it, could you help me please?.

Thanks a lot.

Can you post your main loop?

that is the default interrupt handler that gets populated in the IRQ table.   Did you enable an interrupt for something?    Please post your project if you can.

Hi Eli,

Sorry for this delayed reply, I found the issue to what i was asking you before. The issue what that I was enabling the same PORT where the NMI pin is, so this pin was left floating and some cross-talking voltage was generating some kind of interruption, once I assign a GPIO function to the NMI pin the problem went away.  But Thanks a lot for your help

Version history
Revision #:
1 of 1
Last update:
‎01-13-2013 05:43 AM
Updated by: