element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Members
    Members
    • Benefits of Membership
    • Achievement Levels
    • Members Area
    • Personal Blogs
    • Feedback and Support
    • What's New on element14
  • Learn
    Learn
    • Learning Center
    • eBooks
    • 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
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Dev Tools
    • Manufacturers
    • Raspberry Pi
    • RoadTests & Reviews
    • Avnet Boards Community
    • Product Groups
  • 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
Freedom development platform
  • Products
  • Dev Tools
  • Freedom development platform
  • More
  • Cancel
Freedom development platform
Blog Introduction to KSDK Project Generator 2.2 tool and how to create new project using KL28Z [Create a project using KSDK Project Generator and toggling an LED on FRDM-KL28Z NXP Freedom Development Platform]
  • Blog
  • Forum
  • Documents
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Freedom development platform requires membership for participation - click to join
Blog Post Actions
  • Subscribe by email
  • More
  • Cancel
  • Share
  • Subscribe by email
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: bheemarao
  • Date Created: 3 Oct 2016 1:08 AM Date Created
  • Views 421 views
  • Likes 0 likes
  • Comments 0 comments
  • frdm-kl28z
  • ksdk project generator 2.2
Related
Recommended

Introduction to KSDK Project Generator 2.2 tool and how to create new project using KL28Z [Create a project using KSDK Project Generator and toggling an LED on FRDM-KL28Z NXP Freedom Development Platform]

bheemarao
bheemarao
3 Oct 2016

The KSDK Project Generator requires the user to install an instance of KSDK 1.2.0, 1.3.0 or 2.x before generating new projects. Visit www.nxp.com/ksdk to get the Kinetis SDK.

 

Features of KSDK Project Generator 2.2:

The following features are available with the KSDK Project Generator 2.2 tool:

  • Cross platform
    • Operates on Windows, Linux, and Mac OSX
    • Developed in 32-bit Python 2.7 on Windows 7, Ubuntu 14.10, OSX 10.10 & 10.11
  • Supports KSDK 1.2.0, 1.3.0 and 2.x
  • Quick Generate of development board based KSDK projects
  • Advanced Generate of New KSDK based projects
    • Device or development board based
    • Linked to KSDK installation or standalone
    • RTOS support ( when project with FreeRTOS is created part of source code is licensed with GPL-2.0 WITH the FreeRTOS GPL exception license)
    • HAL or Platform library level projects (for KSDK 1.2, 1.3)
    • Libraries in standalone projects tailored to device package (for KSDK 1.2, 1.3)
    • KDS, IAR, Keil MDK, and/or Atollic TrueSTUDIO IDE projects
    • Generation of standalone or linked cloned project

image

Getting started with KSDK project Generator:

 

Download the KSDK_Project_Generator.zip package from KSDK web page,

http://www.nxp.com/webapp/Download?colCode=KSDK-PROJECT-GENERATOR-TOOL&Parent_nodeId=1465840412864730157257&Parent_pageType=product

Unzip the package to a location of your choice on your host machine.

image

To run, open up the folder for your operating system (in my case it’s Windows) and execute the ‘KSDK_Project_Generator’ application.

image

Once the application is running, make sure to point the tool to a valid KSDK 1.2.0, 1.3.0 or 2.0.0 installation.
I have installed the SDK 2.0.0 for KL28Z board at below location:
 

“C:\NXP ksdk2.0 workspace\SDK_2.0_FRDM-KL28Z”

image

You will be prompted to the new project generated as shown below: and click on Open Project Folder
image
Now your project is created at folder
“C:\NXP ksdk2.0 workspace\SDK_2.0_FRDM-KL28Z\boards\frdmkl28z\user_apps”
image
Now open your project from KDS tool as shown below:
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.

image

Click the "Browse" button next to the "Import from file:" option.

Now direct the path of SDK V2.0 as shown

“C:\NXP ksdk2.0 workspace\SDK_2.0_FRDM-KL28Z\boards\frdmkl28z\user_apps”

image
After successfully importing the project to your workspace the complete setup looks as shown below:
image
Now we will try to toggle all the three LED’s connected to the board.
image
image
Add below lines in main.c file
 

#include "fsl_debug_console.h"
#include "fsl_port.h"
#include "fsl_gpio.h"
#include "fsl_common.h"
#include "board.h"
#include "pin_mux.h"
#include "clock_config.h"

int main(void) {

  BOARD_InitPins();
  BOARD_BootClockRUN();
  BOARD_InitDebugConsole();

 volatile int delay;

  PRINTF("LED blinking project\n\r");

 // Enable GPIO port for the red LED
  CLOCK_EnableClock(kCLOCK_PortE);
  CLOCK_EnableClock(kCLOCK_PortC);

  PORT_SetPinMux(PORTE, 29U, kPORT_MuxAsGpio); //RED
  PORT_SetPinMux(PORTC, 4U, kPORT_MuxAsGpio); //Green
  PORT_SetPinMux(PORTE, 31U, kPORT_MuxAsGpio); // Blue

  LED_RED_INIT(LOGIC_LED_OFF);
  LED_GREEN_INIT(LOGIC_LED_OFF);
  LED_BLUE_INIT(LOGIC_LED_OFF); 


 for(;;) { /* Infinite loop to avoid leaving the main function */

         LED_RED_ON();
                PRINTF("RED LED on project\n\r");
                delay = 5000000;
                while(delay--);
         LED_RED_OFF();
         PRINTF("RED LED OFF project\n\r");
                delay = 5000000;
                while(delay--);

         LED_GREEN_ON();
         PRINTF("GREEN LED on project\n\r");
                delay = 5000000;
                while(delay--);
         LED_GREEN_OFF();
         PRINTF("GREEN LED OFF project\n\r");
                delay = 5000000;
                while(delay--);

         LED_BLUE_ON();
                PRINTF("BLUE LED on project\n\r");
                delay = 5000000;
                while(delay--);
         LED_BLUE_OFF();
         PRINTF("BLUE LED OFF project\n\r");
                delay = 5000000;
                while(delay--);

  }
}

 
Code Explanation:
 

PORT_SetPinMux(PORTE, 29U, kPORT_MuxAsGpio); //RED

 
The above function set the portE-29 pin as output and similar with PortE-31 and PortC-4
 

LED_RED_INIT(LOGIC_LED_OFF);

The above function initialises the red led in off condition
Similar the case with Green and Blue led initialisation
 

  LED_RED_ON();
                PRINTF("RED LED on project\n\r");
                delay = 5000000;
                while(delay--);

        

          LED_RED_OFF();
         PRINTF("RED LED OFF project\n\r");
                delay = 5000000;
                while(delay--);

The above lines will switch on RED LED (LED_RED_ON();) and prints the status on hyperterminal and delays for some interval
LED_RED_OFF(); will switch off the led and prints the status on hyperterminal and delays for some interval
 
Save the file and compile it by pressing the hammer button or “Build Project” option
image
It will build with no errors:
image
Now we will execute our project by configuring it for debug
image
Make sure the board is loaded with segger J-link driver, it appears in the debug configuration as shown:
image
Then press on resume button to execute:
image
You will see all the 3 led’s toggles sequentially
 
The same output can be seen in hyperterminal as shown:
image
 
I have enclosed the project for future reference and quick evaluation
 
Below is the video output execution of this project:
You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image
 
Happy working with KSDK project generator using FRDM-KL28Z image
Attachments:
LED-1.rar
  • Sign in to reply
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 © 2023 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

  • Facebook
  • Twitter
  • linkedin
  • YouTube