element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Freedom development platform
  • Products
  • Dev Tools
  • Freedom development platform
  • More
  • Cancel
Freedom development platform
Blog Getting Started with KSDK 2.0: [How to use the SDK with Kinetis Design Studio using FRDM-K64F freedom board]
  • Blog
  • Forum
  • Documents
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Freedom development platform to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: bheemarao
  • Date Created: 17 Mar 2016 9:12 PM Date Created
  • Views 3168 views
  • Likes 4 likes
  • Comments 10 comments
  • ksdk2.0
  • frdm-k64f
  • kds3.0.0
Related
Recommended

Getting Started with KSDK 2.0: [How to use the SDK with Kinetis Design Studio using FRDM-K64F freedom board]

bheemarao
bheemarao
17 Mar 2016

This document / tutorial show the steps how to use the SDK2.0 with Kinetis Design Studio v3.0.0 implementation using FRDM-K64F freedom board.

Unlike previous SDK's, with the SDK v2.0 it only needs a generic 'new project wizard' inside KDS.

 

KSDK V2.0

 

  Kinetis SDK v2 is a collection of comprehensive software enablement for NXP Kinetis Microcontrollers that includes system startup, peripheral drivers, USB and connectivity stacks, middleware, and real-time operating system (RTOS) kernels. The Kinetis SDK also includes getting started and API documentation along with usage examples and demo applications designed to simplify and accelerate application development on Kinetis MCUs.

image

The Kinetis SDK Builder allows you to get a customized SDK based on your specific evaluation platform or Kinetis MCU. Build your SDK now.

To quickly create new Kinetis SDK projects, or to clone existing projects, use the Kinetis SDK Project Generator.

All software is provided free-of-charge as assembly and C source code under permissive and open-source licensing. Support is provided through the Kinetis SDK Community Forum.

 

Below are the steps we are following for this tutorial:

 

01.     Kinetis Design Studio (KDS):

We assume KDS3.2.0 has been installed in your computer or follow below steps to install it:

A new release of Kinetis Design Studio (KDS) is available: the version v3.2.0

The KDS v3.2.0 is an update with includes all existing updates to the v3.0.0 release. So instead downloading and installing v3.0.0 and then apply all updates, it is recommended that you use the v3.2.0 version instead. There is no need to uninstall an existing KDS v3.0.0: the new v3.2.0 is installed in a separate directory and can be used side-by-side with the previous version.

You can download latest version of KDS from Here or direct download from below link:

https://nxp.flexnetoperations.com/control/frse/download?element=7490587

 

02.     Downloading a Kinetis SDK Package

  1. Go to Welcome to Kinetis Expert | Kinetis Expert
  2. Login with your user NXP name/account and Click on 'Build an SDK' button as shown below

 

image

 

3.If this is your first configuration: select board/processor you want to use

image

4. Customize the SDK version, toolchain and Host OS and Build the SDK as shown in above picture

5. Check the Software vault and download the file as shown below

image

 

image

6.Unpack the downloaded archive file to a folder (recommended into c:\nxp (e.g. (c:\nxp\SDK_v2.0-K64F) or into /nxp on other systems)

In my case i have copied into below shown folder:  “C:\NXP ksdk2.0 workspace\SDK_2.0_FRDM-K64F”

image

The Kinetis SDK architecture consists of five key components listed below.

 

  1. The ARM Cortex Microcontroller Software Interface Standard (CMSIS) CORE compliance device specific header files, SOC Header, and CMSIS math/DSP libraries.
  2. Peripheral Drivers
  3. Real-time Operating Systems (RTOS)
  4. Stacks and Middleware that integrate with the Kinetis SDK
  5. Demo Applications based on the Kinetis SDK

image

Installing Kinetis SDK v2.0 New Project Wizard in Kinetis Design Studio

 

First method:

project wizard for Kinetis SDK v2.0 to be installed with the ‘Install New Software‘ menu in Eclipse:

Start Kinetis Design Studio

Select Menu Help > Install New Software

image

 

Select KDS Update site

(Freescale KDS Update Site - http://freescale.com/lgfiles/updates/Eclipse/KDS)

Install the New Kinetis SDK 2.x Project Wizard

image

Second method:

For offline installation: the wizard can be downloaded from the https://www.nxp.com/kds web site under the Kinetis Design Studio V3.0.0 downloads, e.g. for Windows it is here:

https://nxp.flexnetoperations.com/control/frse/download?agree=Accept&element=6321017

image

 

Download this file and Unzip the archive and use Help > Install New Software menu to add Kinetis SDK V2.x wizard support to KDS V3.x.

Click 'Add' button and type Name = "New Kinetis SDK 2.x Project Wizard", Location = select: NPWforKinetisSDK2x.zip

image

 

And Confirm installation to proceed to install the  “NPWforKinetisSDK2x.zip”

 

‘New Project Wizard’ with SDK v2.0 and Kinetis Design Studio

 

With the example projects inside the SDK the Kinetis Design Studio is well supported. But what if I want to create a SDK project for my special board, or start with a ’empty’ SDK project?

Create new project

  1. Start Kinetis Design Studio

  2. Select the menu File > New  > Kinetis SDK 2.x Project

image

 

  3. Enter project name of your choice i have named as “K64F-RGB test” and Browse to the location “C:\NXP ksdk2.0 workspace\SDK_2.0_FRDM-K64F “

Select where you have unzipped the SDK package from previous step and press Next

image

  4. Select board or processor and press Finish as shown

image

Your project is now created as shown below:

imageimage

 

To check the project created is error free click on the hammer button to build the project as shown:

image

image

 

Now we will proceed to add our code to test RGB LED present on FRDM-K64F board:

LED on board is connected to port pin as shown:

RED LED -> PORTB-22

Green LED -> PORTE-26

Blue LED -> PORTB-21

 

All the hardware configurations have been defined in file <board.h> inside the ‘board’ folder

image

We need to Enable the clock to the PORT module that the LED is on using CLOCK_EnableClock() function and Setup the red LED pin as GPIO -> PORT_SetPinMux() and initialise the RGB to on/off condition using LED_RED_INIT() function.

Below is the C code written:

 

#include"board.h"
#include "pin_mux.h"
#include "clock_config.h"
#include "fsl_port.h"
#include "fsl_device_registers.h"
#include "fsl_debug_console.h"

/*!
 * @brief Application entry point.
 */
int main(void) {
  /* Init board hardware. */
  BOARD_InitPins();
  BOARD_BootClockRUN();
  BOARD_InitDebugConsole();
  
  
  // Enable the clock to the PORT module that the LED is on.
        CLOCK_EnableClock(kCLOCK_PortB);
        CLOCK_EnableClock(kCLOCK_PortE);

        // Setup the red LED pin as GPIO
       PORT_SetPinMux(BOARD_LED_RED_GPIO_PORT, BOARD_LED_RED_GPIO_PIN, kPORT_MuxAsGpio);
 PORT_SetPinMux(BOARD_LED_GREEN_GPIO_PORT, BOARD_LED_GREEN_GPIO_PIN, kPORT_MuxAsGpio);
       PORT_SetPinMux(BOARD_LED_BLUE_GPIO_PORT, BOARD_LED_BLUE_GPIO_PIN, kPORT_MuxAsGpio);

       //initialise the RGB to on/off condition
       LED_RED_INIT(LOGIC_LED_OFF);
       LED_GREEN_INIT(LOGIC_LED_OFF);
       LED_BLUE_INIT(LOGIC_LED_OFF);
       

  /* Add your code here */

  for(;;) { /* Infinite loop to avoid leaving the main function */
    __asm("NOP"); /* something to use as a breakpoint stop while looping */
    
    for(int i=0;i<=10000000;i++);
       LED_RED_TOGGLE();

       for(int i=0;i<=10000000;i++);
          LED_GREEN_TOGGLE();

          for(int i=0;i<=10000000;i++);
             LED_BLUE_TOGGLE();
  }
}

 

Now build the project to confirm it is working fine with no errors

image

image

You can see the project builds without errors

image

 

Now we will proceed to execute the project by debug process:

image

 

Make sure you have connected the K64F freedom board to USB port:

  Open debug configuration as shown below and press ‘Debug’

image

You will see below debug window:

image

Click on the resume button to ‘Run’ the project or ‘Step into’ and ‘Step over’ button for single stepping execution:

image

You can see RGB led glowing sequentially:

 

 

The project folder is attached along with this for quick evaluation

     Happy Start with KSDK2.0...  image image image image

Attachments:
K64F-RGB test.rar
K64F-RGB test-bin.rar
  • Sign in to reply
  • bheemarao
    bheemarao over 8 years ago in reply to nxavier

    Hi Nelson,

     

    If you import any example from “C:\NXP ksdk2.0 workspace\SDK_2.1_FRDM-K64F\boards\frdmk64f\demo_apps” from ksdk workspace or also if you create new project workspace it will create all the required folders like board, drivers, utilities, source..etc (as shown in below snap shot)

    image

    Out of which "board" folder consist of all board related hardware information like LED, button, debug uart port gpio pins, clock configuration

    "drivers" folder consist of all the peripherals header files like FTM, ADC , DAC, I2C, PIT, UART, WDT .... it will be having al the API to perform the operation

    "startup" folder consist of system configuration function and a global variable that contains

    the system frequency. It configures the device and initializations..

     

    "utilities" folder has files corresponding Definition to support advanced format specifier for printf scanf..debug console input and output operations..

     

    finally the folder “source” has main.c where we will be coding our applications in which we will be #defining the required header files as shown below and access the corresponding api’s from driver folder

     

    #include "board.h"

    #include "pin_mux.h"

    #include "clock_config.h"

    #include "fsl_debug_console.h"

    #include "fsl_device_registers.h"

    #include "fsl_lptmr.h"

    #include "fsl_gpio.h"

    #include "fsl_port.h"

     

    And inside main you need to initialise the hardware by calling the functions:

    BOARD_InitPins();

    BOARD_BootClockRUN();

    BOARD_InitDebugConsole()

     

    Enable the clock to the PORT module,

    Based on the required function to perform Setup the GPIO/timer... pins assigned to RGB led’s , initialise it

     

    Hope this helps you in proceeding further..

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • nxavier
    nxavier over 8 years ago

    Hi Bheema,

     

    I'm trying to understand programming with KDS for a K64F board so maybe this will be a very basic question for you.

     

    How do know what instructions must be put in the different files (e.g. board.h, pin_mux.c, etc) ?

    Is there any way to know the needed instructions and the sequence to be followed (e.g. initialize ports, then enable clocks, then...)?

    I went through the "board.h" file of your example and noticed a lot of definitions.

     

    I'm taking a look to the Kinetis SDK v.2.1 API Reference Manual but don't understant what to put where.

     

    Than you in advance

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • bheemarao
    bheemarao over 8 years ago in reply to nickppv2000

    Hi Pavel,

     

    Kinetis Expert provides a set of system configuration tools that help users of all levels with a Kinetis-based MCU solution. It is an expert on all things Kinetis.

    Instead of downloading huge packages with all-and-everything in it, I can build it ‘on demand’ online and get what I need, on demand from a web-based front end: The SDK V1.3 comes in an ‘all and everything’ package, with all the devices, IDE’s and operating systems supported.

    It is very positive that the SDK v2.0 does not libraries with prepackaged drivers as in v1.x: building the project is now much easier and simpler.

    Another very positive thing is that finally the directory structure has been greatly simplified: before there were directories needed for each driver. more differences has been mentioned in MCUonEclipse link given below:

    https://mcuoneclipse.com/2016/01/29/first-nxp-kinetis-sdk-release-sdk-v2-0-with-on-demand-package-builder/

     

    Best Regards

    Bheema Rao

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • nickppv2000
    nickppv2000 over 8 years ago

    I'm new to Kinetis and Freescale/NXP.

     

    What is the deal with Expert Project in KDS 3.x? How do I get Processor description in Kinetis 2.x project? 1.x expert project provides great feature set, is there way to have it in more recent versions?

     

    thanks

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • bheemarao
    bheemarao over 9 years ago in reply to sdorf

    Hi Shaul,

     

    Can you please try the same with mbed drivers and debug with single stepping, at my end it is working fine with mbed drivers (windows-7 PC).

     

    Best Regards

    Bheema Rao

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube