This Document was extracted from Anthony Huereca blog published at Freescale Community Forum https://community.freescale.com/docs/DOC-100718 with his agreement.
Kinetis SDK is a new complimentary software offering from Freescale for Kinetis microcontrollers. The Kinetis software development kit (SDK) provides an extensive suite of robust peripheral drivers, stacks, middleware and example applications designed to simplify and accelerate application development on any Kinetis MCU. The addition of Processor Expert technology for software and board support configuration provides unmatched ease of use and flexibility. The Kinetis SDK includes full source code under a permissive open-source license for all hardware abstraction and peripheral driver software.
Kinetis SDK is currently in beta, and can be used with FRDM-K64F or TWR-K64F120M. More boards will be supported in future releases. Note that because the SDK is in beta, certain features and API naming conventions may change before the General Availability (GA) release scheduled for summer 2014.
This document goes over the basics of starting with Kinetis SDK and common troubleshooting tips.
Getting Started with Kinetis SDK and FRDM-K64F
The FRDM-K64F is a new fully featured Freescale Freedom board with a 120MHz Cortex M4 based Kinetis K64 MCU. The board also features Arduino hardware compatibility, an accelerometer and magnetometer (Freescale’s FXOS8700CQ), and push buttons/LEDs, plus an Ethernet port, microSD port, and OpenSDAv2 for debugging.
Also note that only IAR and GCC are supported currently by the beta version of the SDK, though more IDEs will be supported in later releases. For now we’ll use the IAR compiler.
First download and unzip the beta release (FSLKSDK_1_0_0_BETA) of the Kinetis SDK software from http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=KINETIS_SDK
Take a look at the documentation in the /doc folder, in particular the Release Notes and the K64 User Guide. The Release Notes has an important note about a possible issue when debugging in IAR so be sure to read the last section.
Also note the basic Kinetis SDK directory structure. More details can be found in the Release Notes:
- apps – SDK examples and demos
- boards –board specific files
- lib – where the compiled SDK libraries reside
- platform – SDK driver and HAL source code, linker files, and startup code
Since all the examples are in the apps folder, check out the “hello_world” project at \KSDK_1.0.0-Beta\apps\hello_world\iar\frdmk64f120m\hello_world.eww of it for a simple hello world type app.Use Section 4.1.1 of the K64 User Guide for instructions on how to build the application. The platform_lib.a SDK library which provides the drivers and HAL layer is already pre-compiled.
Debugging Kinetis SDK on FRDM-K64F:
Typically, debugging is done via the OpenSDAv2 circuit built onto the FRDM-K64F board. Make sure to use the USB connector to the left of the Ethernet port, J26. By default the FRDM-K64F uses the CMSIS-DAP/mbed interface as the debug protocol. However it is also possible to use the P&E Micro debug interface on the board instead. As mentioned before, there is a potential issue with debugging with IAR if a project is allowed to exit out of main(). This may cause issues when connecting via the debugger again when using the CMSIS-DAP/mbed interface. Because of this, there is a P&E Micro app available for OpenSDAv2 that comes with the Kinetis SDK zip file that can be loaded onto the OpenSDAv2 circuit on the board. The CMSIS-DAP/mbed interface app is being updated to fix this issue. When debugging, you may get a warning about missing source files. You can ignore those as they are caused by using the pre-compiled SDK platform library. Look down below in the Troubleshooting section for how to get rid of these messages.
Debugging with CMSIS-DAP/mbed Interface:
The FRDM-K64F board uses the CMSIS-DAP/mbed interface by default as it is using OpenSDAv2. However the IAR projects in the beta version of Kinetis SDK use the P&E Micro debug interface. This will be changed for later version of the Kinetis SDK, but to use the default OpenSDAv2 debug interface, you’ll need to change the project’s debug interface to CMSIS-DAP. Instructions for this are in Appendix B of the K64 User Guide.
Debugging with P&E Micro Interface:
To debug using the P&E Micro interface, the P&E Micro OpenSDAv2 app needs to be loaded onto the OpenSDAv2 circuit. Instructions for loading and using this app are inSection 4.1.2 in the K64 User Guide. Use the DEBUG_K64F_MBED_PEMICRO_V108.BIN file that came inside the Kinetis SDK zip file.If you want to return to the original CMSIS-DAP/mbed interface, you can find a binary app to drag-and-drop onto the OpenSDAv2 bootloader on the FRDM-K64F mbed page.Firmware FRDM K64F - Handbook | mbed
Troubleshooting:
I’m using the CMSIS-DAP/mbed debug interface with IAR, and I can’t connect to my board anymore with an error: “Fatal error: Probe not found. Session aborted!”:There’s an issue as described in the Kinets SDK release notes where the debugger can become non-responsive if the code is allowed to exit the main() function when using the CMSIS-DAP interface with OpenSDAv2. To recover the board you have a few options:
- Load the P&E Micro interface app onto OpenSDAv2, and then flash a known good program
- The board should still enumerate as a mass storage device, and you can drag-and-drop a known good program onto the board. You may have to hit the reset button a few times to get it to properly enumerate though. A known good hello_world program has been attached to this post.
This will be fixed in future versions of the CMSIS-DAP/mbed interface app. In the meantime, make sure to put a while(1) loop in your code before exiting main(). Also check out the blog entry on this issue on MCU on Eclipse
When I start debugging, I get a warning message that it “Could not find the following source file: D:\mcu-sdk-re\rc3_2_release\Kinetis_SDK\platform\hal\pit\fsl_pit_hal.h”:
This is caused by using the pre-compiled SDK library, which was built on a different directory structure than what is on your particular computer.
To fix, recompile the Kinetis SDK platform library by following the directions in Appendix A of the Kinetis SDK K64 Users Guide.pdf
The serial port is not enumerating:
If using the default CMSIS-DAP/mbed interface, you must first install the mbed Windows serial port driver before it will enumerate on Windows properly. It should work in Mac OS and Linux without a driver.
When I start debugging, I get an error message that says “Undected. Disconnect/Connect USB cable. Click Refresh List”:
The likely problem is that the FRDM-K64F has the default CMSIS-DAP/mbed firmware, and the IAR project is trying to use the P&E Micro interface. Use the instructions inAppendix B of the K64 User Guide to change the debug interface in IAR to use CMSIS-DAP. Or else change the firmware in the OpenSDAv2 circuit to the P&E Micro firmware.
When compiling the Kinetis SDK platform library in IAR 7.10.x, I the following error messages: Error[Pm056]: all if, else if constructs should contain a final else clause (MISRA C 2004 rule 14.10):
This is caused by a MISRA C 2004 rule violation. The beta Kinetis SDK was built using IAR 6.70, but the MISRA C checks were changed when IAR moved to 7.10.x which is why this comes up in IAR 7.10.x.
This error can be fixed by disabling MISRA C checking in the project settings.
Right click on the platform_lib project, and under the General Options category, scroll over (using the arrow keys on the right) to the MISRA-C-2004 tab, and uncheck “Enable MISRA-C”.
When debugging with the P&E Micro OpenSDAv2 app, I get an error that says “Error reading data from OpenSDA hardware. E17925”
This is being investigated and seems to affect IAR 7.10.x and CW10, but not earlier versions of IAR. In the meantime, use the CMSIS-DAP/mbed interface app instead.