Kinetis SDK FAQ

Document created by Anthony Huereca Employee on Dec 1, 2014Last modified by Diana Torres on Feb 28, 2017
Version 14Show Document
  • View in full screen mode

This document will cover some of the most commonly asked questions about Kinetis Software Development Kit (Kinetis SDK). Anything requiring more in-depth discussion/explanation will be put in a separate thread.

All new questions should go into their own thread as well.

The variable KSDK_PATH is mentioned in several answers. This is the path into which Kinetis SDK was installed. With the current 1.2 release of Kinetis SDK, this would be equivalent to C:\Freescale\KSDK_1.2.0

 

 

What is the Kinetis Software Development Kit?

Kinetis SDK is a free software framework that was created to make it easier for developers to create applications for Freescale’s line of Kinetis microcontrollers. It ensures there’s a common and thoroughly tested software framework for Kinetis devices that you can then use to build your application on top of. Let Kinetis SDK provide the basic startup code and drivers, so that you can spend more time creating your specific application code.

 

The two most significant features of Kinetis SDK are:

  • Hardware Abstraction Layer (HAL) – A common API used to abstract hardware accesses into functional accesses
  • Peripheral Drivers – High-level drivers that make use of the HAL API to implement higher level functionality for common peripheral use cases.

 

Additionally there are several other features:

  • System Services – Code for utilizing specific Kinetis features which includes a clock manager, low-power manager, hardware timer, and interrupt manager
  • ARM CMSIS Core and DSP standard libraries
  • CMSIS compliant register header files
  • Sample code for accessing accelerometers and audio codecs on Freescale evaluation boards
  • Stacks and middleware for USB, Ethernet, and filesystems.
  • Many examples and demo code to showcase how to use Kinetis SDK

 

This sounds great! Where can I download it and find more documentation and information?

http://freescale.com/ksdk

 

How do I get started using Kinetis SDK?

First read the Kinetis SDK 1.2 release notes to learn about the software. You will also want to check to make sure your Kinetis device is supported by Kinetis SDK. If you don't see your device in the KSDK 1.2 release notes, check to see if one of the stand-alone releases available includes it.

 

Once you’ve selected the appropriate installer for your device, either the mainline or one of the stand-alone releases, install it on your computer. The default path for the mainline Kinetis SDK 1.2 is C:\Freescale\KSDK_1.2.0


You will also need to install one of the compilers that Kinetis SDK supports.

If you are not sure, we recommend starting with Kinetis Design Studio since it is free and also runs on Linux.

 

Then read the Getting Started with Kinetis SDK (KSDK) v1.2.pdf document. It can also be found in <KSDK_PATH>/doc. It will have details about Kinetis SDK and there will be a section for getting up and going with your particular IDE to run the hello_world demo application. Note that you will need to compile the Kinetis SDK platform library first before you can compile the demos.

 

You can then run one of the other demo applications included with Kinetis SDK to see examples of how to use the HAL and Driver APIs.

 

If you are using Kinetis Design Studio, also make sure to follow the directions in Appendix A of this document to update Kinetis Design Studio to work with Kinetis SDK: https://community.freescale.com/docs/DOC-102612

 

How do I run the demo projects that are included with Kinetis SDK?

First read the Getting Started with Kinetis SDK (KSDK) v1.2.pdf document. You will need to import and compile the KSDK platform library, and then import and compile the particular demo project.

 

Where can I find specific instructions on a particular demo?

For details on a specific demo, including any board jumper settings and to check if the demo will run on your particular board, refer to the Kinetis SDK v1.2 Demo Applications User's Guide.pdf found in the <KSDK_PATH>/doc folder.

 

How does Kinetis SDK fit in with other Freescale enablement?

Kinetis SDK is a key component going forward in all Freescale Kinetis enablement. It replaces the bare-metal sample code examples. Freescale’s MQX RTOS will now use KSDK drivers for supported devices, instead of the classic MQX-specific drivers. And it will use the KSDK startup and board support code.

 

Processor Expert, a GUI tool for software configuration and code generation, now uses the KSDK HAL and Drivers to implement its code for KSDK supported devices. And the mbed platform also uses Kinetis SDK underneath for devices supported by Kinetis SDK.

 

Kinetis SDK Details:

 

What exactly am I getting when I download and install Kinetis SDK?

The default installation path for KSDK 1.2 is at C:\Freescale\KSDK_1.2.0

 

Inside that directory, you’ll find the full source code for the various KSDK components (HAL, drivers, system services, header files, etc) as well as demos, documentation, and higher level stacks like our USB stack, lwIP, FatFS, and various RTOS kernels.

 

Some of the key directories are:

  • examples – SDK examples and demos
  • doc - Documentation
  • lib – SDK libraries projects, and where the compiled library .a files are generated
  • platform – SDK driver and HAL source code, linker files, and startup code

 

Section 5 of the Kinetis SDK v1.2 release notes lists the different components and where they are located in the Kinetis SDK directory structure.

 

What Kinetis devices/boards are supported by Kinetis SDK?

In KSDK 1.2, the following boards are supported:

  • FRDM-K22F
  • FRDM-K64F
  • FRDM-KL02Z
  • FRDM-KL03Z
  • FRDM-KL27Z
  • FRDM-KL43Z
  • FRDM-KL25Z
  • FRDM-KL26Z
  • FRDM-KL46Z
  • FRDM-KW24
  • MRB-KW019032xx
  • TWR-K21D50M
  • TWR-K21F120M
  • TWR-K22F120M
  • TWR-K24F120M
  • TWR-K60D100M
  • TWR-K64F120M
  • TWR-K65F180M
  • TWR-KL43Z48M
  • TWR-KV10Z75M
  • TWR-KV31F120M
  • TWR-KV46F150M
  • TWR-KW24D512
  • USB-KW24D512

 

Kinetis SDK also supports many of the subfamiles that these boards support. So for instance, if you're interested in the K02 device, use the FRDM-K22F for evaluation but use the K02 libraries provided to write code which will run on the K22F since it is a superset device. The subset devices supported are all listed in the Release Notes.

 

The KSDK 1.2 release can be found at http://freescale.com/ksdk

 

Which version of Kinetis SDK do I install? I see that there are Mainline and Standalone Releases. What's the difference?

If the device you are interested in is listed in the previous question, download the Mainline release appropriate for your computer (Windows/Linux/Mac).

 

If your device is listed as a Standalone install, you just need to use that Standalone installer. These are releases for new devices that did not make into KSDK 1.2 but will be rolled into later releases. Note that installing "Kinetis SDK Mainline 1.2" is not a pre-requisite as these truly are 'standalone' releases and include all the standard KSDK features and code:

  • KL33Z for the FRDM-KL43Z

 

These standalone releases can be found under the Downloads tab on the KSDK website. You may need to select "All Downloads" to see them.

 

How do I determine if my particular Kinetis device is supported by Kinetis SDK and which board it is associated with?

Section 4, “Supported Development Systems”, of the Kinetis SDK release notes lists the specific Kinetis devices that are supported by that release of Kinetis SDK. The table can also be used to determine which evaluation board is associated with your particular Kinetis device. Each of the stand-alone releases will also have their own table like this in their release notes.

 

When will device XYZ be supported by KSDK?

Most new Kinetis devices will launch with Kinetis SDK support. Support for some older Kinetis devices will be added over time in new releases. Those older devices selected for porting will be announced on the Community once a release date is confirmed. In the meantime, use the bare-metal sample code and MQX support already available for those legacy devices.

 

I don’t see my device in either the Kinetis SDK 1.2 release or the stand-alone releases. Can I just port Kinetis SDK to my device?

There are several key components that would be missing to do a port to a different family, like header files and start up files, and thus it is discouraged and is not supported by Freescale. Support for some older Kinetis devices is being added in future releases, and most Kinetis devices released in the future will have Kinetis SDK support at launch.

 

What compilers are supported by Kinetis SDK?

In Kinetis SDK 1.2 the following compilers are supported:

 

Kinetis Design Studio and ARM GCC are code sized unlimited and will also run on Linux. If you do not already have a preferred compiler, we recommend starting with Kinetis Design Studio.

 

What exactly is the HAL?

The Hardware Abstraction Layer (HAL) creates an abstraction layer for hardware accesses.  For example, instead of digging into a reference manual to figure out which bit in which register bit is used to enable the UART transmit feature, you can just call UART_HAL_EnableTransmitter(…). The HAL is stateless and is intended to cover the entire hardware functionality.

 

Where is the source code for the HAL?

You can find the source for the HAL at <KSDK_PATH>\platform\hal.

 

For a good example of how the HAL is implemented, look at the <KSDK_PATH>\platform\hal\src\dspi\fsl_dspi_hal.c and <KSDK_PATH>\platform\hal\inc\fsl_dspi_hal.h files. Notice how most of the HAL API is just macros for accessing the SPI registers, or else simple functions for calculating the baud rate and other simple features like that.

 

Is there a library for the HAL that I can pull into my project?

There is a device and compiler specific library available that you can pull into your own custom project at <KSDK_PATH>\lib\ksdk_hal_lib.

 

You will need to compile the library first as KSDK does not come with pre-compiled libraries.

 

What are the peripheral drivers?

The peripheral drivers are built on top of the HAL to provide a set of easy-to-use interfaces to handle high-level data and stateful transactions. They cover the most common use-cases, but may need to be optimized for your particular application.

 

Where is the source code for the drivers?

You can find the source for the KSDK drivers at <KSDK_PATH>\platform\drivers.

 

For a good example, take a look at <KSDK_PATH>\platform\drivers\src\dspi\fsl_dspi_master_driver.c. You can see how the driver API is implemented by making calls to the HAL API and using structures defined by the SPI driver.

 

Is there a library I can pull into my project to use the drivers?

The KSDK Platform library contains both the drivers and the HAL. This is the library most of the KSDK demo projects pull in. Device and compiler specific project files for this library can be found at <KSDK_PATH>\lib\ksdk_platform_lib

 

You will need to compile the library first as KSDK does not come with pre-compiled libraries.

 

Where are the HAL and Driver APIs documented?

The Kinetis SDK API Reference Manual describes all the HAL and Driver APIs, and it can be found in the <KSDK_PATH>/doc folder.

 

How do I create my own Kinetis SDK application?

The easiest way is to copy an already existing project. However if you are using Kinetis Design Studio, you can also create one from scratch using the New Project Wizard.

 

To copy an already existing demo project, see this thread: Create new KSDK Projects

 

To create a totally new project with Kinetis Design Studio, see this thread: Writing my first KSDK Application in KDS - Hello World and GPIO Interrupt

 

To create a MQX project that works with Kinetis SDK, see this thread: How To: Create a New MQX RTOS for KSDK Project in KDS

 

A full featured KSDK project creation tool is under development and should be released in Q2 2015.

 

Where can I find information on the Kinetis SDK low power manager?

See this thread: Low Power Application Using the SDK

(Note: The demo was created for KSDK 1.0)

 

What changed between KSDK 1.0 and KSDK 1.1?

See this thread: KSDK 1.1 Release

 

What changed between KSDK 1.1 and KSDK 1.2?

See this thread: New KSDK 1.2. is available!

 

Can I install a new version, or standalone version, of KSDK without it affecting my already existing version?

Yes. Each new release of KSDK, including standalone releases, will be installed into a unique directory. The only thing to be aware of is the (optional) update the global Windows KSDK_PATH variable used by Kinetis Design Studio. See Appendix B of this document: Writing my first KSDK Application in KDS - Hello World and GPIO Interrupt

 

Do I need to recompile the platform library every time I change my demo application?

After the initial compilation, you will only need to recompile the platform library for your device if you change something in the HAL, Drivers, or other source code that makes up the platform library. The platform project is included as part of the workspace when opening up a demo as a convenience for that initial compile. If you only change the code for the demo application, you do not have to recompile the platform library every time.

 

Is there training available for Kinetis SDK?

There are some presentations at the Designing with Freescale event webpage:

http://www.freescale.com/webapp/Download?colCode=DWF14_AMF_SDS_T0127

http://www.freescale.com/webapp/Download?colCode=DWF14_AMF_SDS_T0805

 

Also make sure to read through the Kinetis SDK 1.2 Release Notes as there is a lot of very useful information in there as you get started using Kinetis SDK.

 

Many more app notes and community posts are being created to further showcase how to use Kinetis SDK.

 

RTOS:

 

Does Kinetis SDK supports RTOSs?

Yes. Several different RTOS kernels can be ran on top of Kinetis SDK. This was done to solve the biggest trouble of porting a particular RTOS to a new device, in that new drivers and startup code needs to be developed. Kinetis SDK provides that solution, so that the RTOS kernel features can sit on top of Kinetis SDK.

 

What RTOS kernels are supported with Kinetis SDK?

Freescale MQX

FreeRTOS

Micrium uCOSII

Micrium uCOSIII

 

How do I get these RTOSs with Kinetis SDK?

Starting with Kinetis SDK 1.2, all the RTOSs are included by default with the installation.

 

If using Kinetis SDK 1.1, during installation process, there will be a screen asking if you would like to install 'Kinetis SDK Basic', 'KSDK+MQX', or 'KSDK+RTOS Kernels'. If you are only interested in MQX, use the middle option. If you are interested in other RTOS kernels (including MQX) select the last option which will take you to a new screen to select which RTOSes you are interested in.

 

If using Kinetis SDK 1.0, you must select the "Custom" option during installation to select a RTOS kernel.

 

Why don’t I have an <KSDK_PATH>/rtos folder? Where are the RTOS kernels at?

See the above answer. You will need to run the KSDK installer again, select to modify the installation, and this time select an RTOS install option.

 

What else do I get when selecting the MQX RTOS option?

When selecting the MQX RTOS option, the MQX RTCS Ethernet stack and MQX MFS Filesystem stack will be installed as well. These are more fully featured stacks than the 'lwIP' and 'FatFS' stacks provided by default with Kinetis SDK. These RTCS and MFS stacks require MQX to run, and full source code is provided.

 

What is the difference between MQX for KSDK and 'classic' MQX 4.2?

MQX for KSDK is the future of MQX, and it was developed to leverage Kinetis SDK features like startup code and drivers. The biggest difference is the drivers, as MQX for KSDK uses the KSDK drivers which are significantly different than the classic MQX drivers. The startup code is also different as MQX for KSDK relies on the KSDK startup files. However the kernel API and how to you start and manipulate tasks, semaphores, events, etc, are the same between the two versions.

 

A full porting guide between classic MQX and MQX for KSDK is now available.

 

How can I learn how to create a new MQX for KSDK project for Kinetis Design Studio?

A tutorial can be found here

 

Where can I find more information on MQX for KSDK?

http://freescale.com/mqx/ksdk

Beta version of MQX RTOS for Kinetis SDK - Now Available

MQX with KSDK and Processor Expert

 

What is the OSA?

The Operating System Abstraction (OSA) layer is an optional feature that allows a user application to use the same API regardless of which RTOS is being used. This can be used to make code more portable. An example of this can be found in the <KSDK_PATH>/demos/i2c_rtos demo, which uses almost the exact same source code to do a demo using I2C communication when using baremetal, MQX, FreeRTOS,  uCOSII, or uCOSIII.

 

Do I have to use the OSA?
No, it is optional. You can always call the particular RTOS API directly. For example, if you were using the MQX kernel, you have the option to call either the OSA API call for a time delay (OSA_TimeDelay) or the MQX API call (_time_delay).

 

You can see how the OSA layer implements the OSA_TimeDelay() function for MQX by opening the file <KSDK_PATH>\platform\osa\src\fsl_os_abstraction_mqx.c, and on line 662 you’ll see that all the OSA is doing is calling MQX’s own _time_delay() API.

 

Note that some drivers make use of the bare-metal OSA implementation for certain functionality (like delays or semaphores).

 

USB:

 

What USB stack is included with Kinetis SDK?

The USB stack is developed by Freescale and is a continuation of the 5.0 Beta bare-metal stack. The stack in Kinetis SDK has more features, and Kinetis SDK is where USB development work will be focused in the future.

 

You may also see it referenced as the “Unified USB stack” since this same USB stack is used by both bare-metal KSDK and by MQX for KSDK. This makes it simpler to add RTOS support to an already existing USB application.

 

What classes does the Kinetis SDK USB stack support?

It supports Audio, CDC, HID, MSD, and PHDC classes in both Host and Device modes. Some composite class support is also provided.

 

How do I compile a USB demo?

There are two libraries that need to be compiled before a USB demo will compile properly.

  • Host or Device USB Library at <KSDK_PATH>\usb\usb_core\<host or device>\build\<compiler>\<board>\
  • KSDK Platform library at <KSDK_PATH>\lib\ksdk_platform_lib\

 

Then one of the USB demos can be compiled at <KSDK_PATH>\usb\example\<host or device>\<class>\<example project>

 

Troubleshooting:

 

I’m seeing an error about missing a missing ksdk_platform_lib.a or libksdk_platform.a file when I try to compile a demo

There are two common cases where this happens:

  1) You must first compile the KSDK platform library for your device. The project files for the library are found in <KSDK_PATH>/lib/ksdk_platform_lib/<compiler>/<device>/

  2) Make sure the KSDK platform library you compiled is for the same target (Debug or Release) as the demo you are trying to compile. The Debug target has no optimization. The Release target uses full optimization.

 

Why is the “Kinetis SDK” checkbox unavailable when creating a new project in Kinetis Design Studio using the ‘Kinetis Design Studio Project’ Wizard?

This checkbox is only selectable if the device you selected on the previous screen is supported by Kinetis SDK.

 

Also make sure to follow the directions in Appendix A of this document to update Kinetis Design Studio to work with Kinetis SDK. You will need to update KDS with the KSDK 1.2 file to get the boards supported by KSDK 1.2 in the project wizard: Writing my first KSDK Application in KDS - Hello World and GPIO Interrupt

 

I’m trying to use a driver and keep falling into the default ISR in startup_<mcu>.s

Make sure to include an interrupt handler for the peripheral you’re using inside your project. By default, all the peripheral IRQ handlers go into a default handler that does an infinite branch. The easiest way to fix this issue is to add the C:\Freescale\KSDK_1.2.0\platform\drivers\src\<drivername>\fsl_<drivername>_irq.c file inside your project.

 

How do I change the default interrupt priority for a driver?

Use the CMSIS NVIC_SetPriority function. 

As an example from the i2c_rtos demo: NVIC_SetPriority(I2C0_IRQn, 6U);

 

I’m using a FRDM-KL03 and none of the KDS projects work

Due to the small RAM size of the KL03, the default toolchain in Kinetis Design Studio needs to be swapped out for the ARM GCC toolchain. Instructions are in the appendix of the “Kinetis SDK Freescale Freedom FRDM-KL03Z Platform User’s Guide.pdf” found in the KSDK KL03 installation inside the /doc folder.

 

I'm using IAR and I get the following error when I try to compile: Fatal Error[LMS001]: License Check failed. Use the IAR License Manager to resolve the problem. Found no license for ARM EW.MISRAC[LicenceCheck:2.13.4.627,RMS 8.5.0.0021, Feature ARM.EW.MISRAC, Version 1.05]. The specified license feature is needed to enable MISRA-C support.

This error occurs because the IAR projects are setup by default to enable MISRA-C checking, as KSDK is MISRA compliant. However the evaluation version of IAR doesn't support MISRA checking. To work-around this issue, right click on the project name that is giving the error, and select "Options...". Then under the "General Options" category, scroll over to the the tab on the far right that says "MISRA-C 2004". Then uncheck the box that says "Enable MISRA_C"

 

I'm seeing errors when using the SPI driver. What is the difference between the DSPI and SPI drivers?

See this thread

 

The I2C_RTOS demo isn't compiling properly. It says it is missing libksdk_platform_mqx.a (or some other library). What libraries do I need to compile for the I2C RTOS demo?

See this thread

 

I don't see any terminal output when using the power_manager_demo demo.

You need to adjust the baud rate of the terminal to 9600 due to some clock speed limitations necessary for this demo. See the \doc\Kinetis SDK v.1.2 Demo Applications User's Guide.pdf for more details.

 

I don't see any terminal output when using some of the FRDM-KL03 demos.

The following KL03 demos use a baud rate of 9600 due to some clock speed limitations necessary for those particular demos:

flash_demo

lptmr_demo

power_manager_demo

rtc_func

See the \doc\Kinetis SDK v.1.2 Demo Applications User's Guide.pdf for more details.

 

I’m seeing odd compile errors in Kinetis SDK, what could be going on?

If using KSDK 1.0 or KSDK 1.1, double check that the KSDK_PATH environment variable in Windows is pointing to the current installation of Kinetis SDK you’re trying to use. KSDK 1.2 does not make use of this environmental variable anymore. For details see Appendix B of this document Writing my first KSDK Application in KDS - Hello World and GPIO Interrupt

 

Where can I find a document of known issues?

Known issues can be found in the Kinetis SDK 1.2 Release Notes.

 

Additional issues found after the Kinetis SDK release can be found in the Kinetis SDK Software Errata document, if one is needed, on the “Documents” tab of the KSDK webpage.

 

Updated Jun-2015 for KSDK 1.2 Release.

1 person found this helpful

Attachments

    Outcomes