Kinetis Software Development Kit Knowledge Base

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Kinetis Software Development Kit Knowledge Base

Labels
  • General 62

Discussions

Sort by:
This document provides the guidelines to create a toggle LED application in the FRDM-K64F by using the KDS 1.1.0 + KSDK 1.0.0 and Non Processor Expert usage. This is helpful to understand how to create a project for KDS that uses the KSDK.   This document is assuming that KDS 1.1.0 and KSDK 1.0.0 are installed under a Windows OS system.   After the installation of KDS the environment variable “KSDK_PATH” must be defined. Under “System Properties” go to “Environment Variables…” located in the “Advance” tab. Add the new variable under “User variables…”. The name should be “KSDK_PATH”. The path is the same where by default the KSDK is installed. In this case the path is “C:\Freescale\KSDK_1.0.0”. The KSDK patch must be installed before to proceed with any project creation. To do this click in “Help” menu and then “Install New Software…“ option. Click in the “Add…” button and then “Archive” button. Look for the file “C:\Freescale\KSDK_1.0.0\tools\eclipse_update\SDK_1.0.0-GA_Update_for_Eclipse.zip” and click “Ok” button. Select the “Eclipse Update for KSDK 1.0.0-GA” option from the options and then press the “Next” button. Next step is to create a new KDS project. Go to “File>New>Kinetis Design Studio Project” option Then give a name; easy one, to remember what it does. Then press “Next” Chose the board to be used. In this case we are using the FRDM-K64F. Now press “Next”. Check the "Kinetis SDK" check box. Make sure that "Processor Expert" is not checked. Project is now created and it is ready to include the source code.   All the KSDK examples include the "board" folder. It is necessary to do the same for this new project. To add it just right click in the project just created and chose "Import". Select "File System". Look for the board folder in the following path: C:\Freescale\KSDK_1.0.0\boards\   Chose the C and H files only from the "frdmk64f120m" folder. Just like this: Then the folder "frdmk64f120m" is added to the project structure. Following is to add the KSDK library in the compiler. To add it you need to give a right click in the project and click in "Properties". Under "C/C++ Build" menu go to "Settings". Then click in "Miscellaneous" under "Cross ARM C++ Linker". If you did it correctly then you will see this:      Click in add object button   and add the library here. The default path is "C:\Freescale\KSDK_1.0.0\lib\ksdk_platform_lib\kds\K64F12\Debug\ksdk_platform_lib.a". Now, let’s toggle an LED. It is necessary to include the boards.h file: #include "board.h"    A GPIO pins enum needs to be created. We are using the RGB connected to the PORTE, specifically the pin 26 (PTE26). The enum then should look like this: enum _gpio_pins { kGpioLED4  = GPIO_MAKE_PIN(HW_PORTE, 0x1A),//PTE26 }; Make sure you are giving the pin 26 as hexadecimal value. In this case the 26 is 0x1A and that is the value we give as second parameter to the GPIO_MAKE_PIN macro. Add the calling to the function hardware_init()a just after the variable definition in the main() function. After this, now call the function that is necessary to configure the pin direction: GPIO_DRV_SetPinDir(kGpioLED4, kGpioDigitalOutput);    Finally, to write the desired value to the LED use this function: GPIO_DRV_WritePinOutput(kGpioLED4, value);    The entire should code looks like this: #include "fsl_device_registers.h" #include "board.h"   enum _gpio_pins { kGpioLED4  = GPIO_MAKE_PIN(HW_PORTE, 0x1A),//PTE26 };   static int i = 0;   int main(void) { short value = 1;    /* Write your code here */ hardware_init();   GPIO_DRV_SetPinDir(kGpioLED4, kGpioDigitalOutput);   /* This for loop should be replaced. By default this loop allows a single stepping. */ for (;;) {   for (i = 0; i<0xFFFFFF; i++) { }   value = value^1; GPIO_DRV_WritePinOutput(kGpioLED4, value);   } /* Never leave main */ return 0; }   Compile and ready to test. See the green LED blinking in the FRDM-K64F board.
View full article
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 Kinetis MCUs. 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 can be downloaded from the following location: http://freescale.com/ksdk   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 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.   First download and install the latest release of Kinetis SDK from http://freescale.com/ksdk   Then select one of the five IDEs that Kinetis SDK supports: Kinetis Design Studio 2.0 IAR Embedded Workbench for ARM 7.20.2 MDK-ARM Microcontroller Development Kit (Keil) 5.11 ARM GCC 4.8.3 Atollic TrueSTUDIO for ARM 5.2 Note that Kinetis Design Studio and ARM GCC are code sized unlimited and will also run on Linux.   Then take a look at the documentation in the /doc folder, in particular the Release Notes and the Getting Started with Kinetis SDK (KSDK) documents. The Release Notes contain an overview of Kinetis SDK, supported devices, details on the directory structure, and known issues.   Also note the basic Kinetis SDK directory structure. More details can be found in the Release Notes: demos – 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 demos folder, check out the “hello_world” project at \demos\hello_world\<ide>\frdmk64f\hello_world.eww of it for a simple hello world type app. Use the Getting Started with KSDK Guide for details on how to compile and run the demo for your particular IDE.   Also check out the Kinetis SDK FAQ for information on other boards supported by Kinetis SDK, MQX RTOS and other RTOS support, USB support with KSDK, and much much more.   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 or Segger JLink debug interfaces with the board instead.   Debugging with CMSIS-DAP/mbed Interface: The FRDM-K64F board uses the CMSIS-DAP/mbed interface by default as it is using OpenSDAv2. The KSDK 1.1 demo projects should be setup to use the CMSIS-DAP debug interface by default for the FRDM-K64F projects.   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 in Appendix C of the Getting Started with KSDK 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   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 your project is trying to use the P&E Micro or JLink interface. Change the debug interface in your IDE to use CMSIS-DAP. Or else change the firmware in the OpenSDAv2 circuit to the proper firmware as described in Appendix C of the Getting Started with KSDK document.   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.
View full article