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:
Very simple, but very often asked question - how can I import example in KSDK general? The easiest way is import .wsd file, it is a set of all needed files for your project.   1. Open KDS, go to Project Explorer Window and by right click select Import option 2. Choose Existing Projects Sets option 3. Click on Browse and select the project, which you would like to work. In case of KSDK 2.0 go to C:\Freescale\<ksdk2.0_package>\boards\frdmk64f\demo_apps\lwip\lwip_tcpecho\freertos\kds   4. You will see the demo project successfully imported in your Project Explorer window and now you can compile and execute demo project.   Enjoy! Iva
View full article
Documentation for current KSDK 1.3 is located under C:\Freescale\KSDK_1.3.0\doc Application Notes and another documents are located under Software Development Kit for Kinetis MCUs|NXP   There are more documents, which were created:   KSDK 2.0 How to: install KSDK 2.0 Introducing Kinetis SDK v2 Using Kinetis Design Studio v3.x with Kinetis SDK v2.0   KSDK 1.3 How to add SD card support in the composite msd_cdc demo[KSDK 1.3] KSDK Clock configurations and Low Power modes with Processor Expert New Kinetis SDK Project Generator v2 is available! KSDK Project Generator - BUG workaround KSDK 1.3 Documents Plugin in KDS - is available now! KSDK 1.3.0 Documents Plugin for KDS 3.0.0   KSDK 1.2 Interrupt handling with KSDK and Kinetis Design Studio Creating a New USB project with KSDK and Processor Expert support in KDS IAR MQX TAD solution for "Unknown error" in Task error code (with KSDK) How to Add lwIP to KDS3.0 Project How to: Create a New FreeRTOS for KSDK1.2 Project in KDS3.0 How to Create a C++ Project Using MQX RTOS for KSDK1.2 How to implement a USB Device MSD demo based on KSDK PEx components and KDS 3.0 How to: execute the demo HVAC on lwIP TCP/IP Stack in KSDK Kinetis SDK FAQ Adding TAD shell in KSDK shell demo FRDM-KL43Z and KL33Z - standalone package New KSDK 1.2. is available! Getting started with KSDK: Building the demo applications   KSDK 1.1 KSDK 1.1 Release How to create copy of KSDK example in KDS UART Example with KSDK   KSDK 1.0 Create new KSDK Projects Kinetis SDK and FRDM-K64F Sharing one documentation issue in KSDK 1.0 demo user guide
View full article
Hello KSDK community:   The Kinetis Software Development Kit is intended to ease evaluation, prototyping and development with Kinetis MCUs. Apart from the Peripheral Drivers, HAL layer, System Services, RTOS abstraction and software stacks, KSDK implements a robust hardware interrupt mechanism.   The attached document is intended to explain the interrupt handling mechanism of KSDK platform and how to use it for baremetal KSDK or "MQX for KSDK" projects. Some of the topics covered are:   >> Interrupt manager >> Installing vector table in Flash or RAM >> Interrupt priorities >> Peripheral IRQ files (fsl_<peripheral>_irq.c) >> Installing, defining or registering ISRs >> Callbacks >> MQX hardware interrupts system >> Interrupts and callbacks with Processor Expert   The last chapter explains the considerations of interrupt handling when using Kinetis Design Studio in 4 different cases:   1) KSDK baremetal project 2) KSDK baremetal + Processor Expert project 3) MQX for KSDK project 4) MQX for KSDK + Processor Expert project   I hope this document is useful for all of you who have already adopted KSDK as development solution.     /*** UPDATE July 1, 2015 ***/   Document updated for KSDK v1.2 and KDS v3.0.0     Regards! Jorge Gonzalez
View full article
Download from Software Development Kit for Kinetis MCUs|NXP   How to: install KSDK 2.0 Using Kinetis Design Studio v3.x with Kinetis SDK v2.0   Kinetis SDK 2.0 API Reference Manual: Introduction   For older versions KSDK, KDS: Kinetis Design Studio Videos, Part 1: Installation of KDS and Kinetis SDK Kinetis Design Studio Videos, Part 2: Installation of OpenSDA Firmware on Freedom Board Kinetis Design Studio Videos, Part 3: Debugging with Kinetis Design Studio Kinetis Design Studio Videos, Part 4: Using Processor Expert in KDS   Installing Kinetis SDK into KDS Kinetis Design Studio V3.0.0- User´s Guide   other documentations you can download from Software Development Kit for Kinetis MCUs|NXP
View full article
This document includes two chapters , chapter 1 is about how to use printf() to print string in KSDK1.3 project , the usage in project without MQX has been introduced on another document, you can find it here : https://community.freescale.com/docs/DOC-104349 , so in this DOC I only introduce how to use the printf() in KSDK MQX- Lite and KSDK MQX-Standard project .   Chapter 2 introduces how to check which UART port is used when use printf() to print string on the FRDM board and TOWER board .   In sum, only the project of “MQX standard” use it own driver for printf(), so we need delete the driver “fsl_debug_console”. In other SDK+PE projects , they all use the driver of “fsl_debug_console” for printf().
View full article
Problem: Unknown error in Task error code column (in Task List view from MQX TAD) is displayed when debugging MQX project in IAR with KSDK.   Cause: This error means that TAD cannot find mqx.tad file with messages for error codes. In this case code 0x0 means MQX_OK, so it might lead user to believe there is some error with task but it is not. IAR TAD was made before first KSDK release, so there is no way for IAR TAD to find mqx.tad file because it isn’t part of KSDK. It works only when classic MQX is also installed on computer.   IAR TAD finds mqx.tad file this way (written as example for MQX 4.2): It takes _mqx_version_number defined as hex number 0x04020000 in “mqx\source\kernel\mqx.c” Looks into windows registry key of specified MQX version “HKEY_LOCAL_MACHINE\SOFTWARE\Freescale\FreeScale MQX\4.2” Takes its path variable "PATH"="C:\\Freescale\\Freescale_MQX_4_2" Tries to find mqx.tad file in directory specified in PATH or in its child folder "\tools\tad\" (e.g. C:\Freescale\Freescale_MQX_4_2\tools\tad\mqx.tad)   Solution: Use of fake registry key, which will point to classic MQX installation or some blank directory with only mqx.tad file (e.g. C:\fake_mqx\mqx.tad or better C:\Freescale\KSDK_1.2.0\tools\tad\mqx.tad). This registry key must use MQX version specified in used KSDK (for KSDK 1.2 and 1.3 it is 0x05000200, for 1.1 0x05000001 and for 1.0 0x04010000). Registry key might look like this: Then TAD translates error codes to messages successfully and path to mqx.tad file can be checked in Check for errors view under Show MQX TAD Diagnostics. Attached is example registry key with \tad\mqx.tad structure for placing into KSDK\tools directory.
View full article
Hello community,   This document is the continuation of the document Line scan camera with KSDK [ADC + PIT + GPIO] which shows the ease of use of the peripheral drivers from Kinetis SDK applied to the Freescale Cup smart car. This time I bring to you a document which explains how to control the speed in DC motors and the position in servomotors with KSDK step-by-step. This document is intended to be an example for the TPM and the GPIO peripheral drivers usage.   The required material to run this project is: A Servomotor (the project supports up to two servomotors, one servomotor is included in the smart car kit). Two DC motors (included in the smart car kit). FRDM-KL25Z based on the Kinetis Microcontroller KL25Z. FRDM-TFC shield. Mini-USB cable.   This material can be bought in The Freescale Cup Intelligent Car Development.         The document Create a new KSDK 1.2.0 project in KDS 3.0.0 explains how to create a new KSDK project for the KL25Z MCU. The result of this document is the project BM-KSDK-FRDM_KL25Z. The document Controlling speed in DC motors and position in servomotors with the FRDM-KL25Z and the Kinetis SDK [FTM + GPIO] explains how to implement an application to control the motors. The result of this document is the project BM-KSDK-FRDM_KL25Z_LINE_SCAN_CAMERA-SERVO-DC_MOTORS.   If you are interested in participate in the Freescale Cup you could take a look into the groups University Programs, The Freescale Cup Technical Reports TFC - Mexico, TFC - Brazil, TFC - China, TFC - Malaysia, TFC - Japan, TFC - North America, TFC - India, TFC - Taiwan, The Freescale Cup EMEA.   Best regards, Earl Orlando Ramírez-Sánchez Technical Support Engineer Freescale Semiconductor
View full article
There was a macro definition issue in the flexcan driver of ksdk 2.0, the macros of RX_FIFO_STD_MASK_TYPE_B/C were defined based on maco FLEXCAN_ID_STD(id), for example: #define FLEXCAN_RX_FIFO_STD_MASK_TYPE_B_HIGH(id, rtr, ide) \ (((uint32_t)((uint32_t)(rtr) << 31) | (uint32_t)((uint32_t)(ide) << 30)) | \ (FLEXCAN_ID_STD(id) << 16)) /**< Standard Rx FIFO Mask helper macro Type B upper part helper macro. */ but FLEXCAN_ID_STD(id) is defined for flexCAN Message Buffer structure, so FLEXCAN_ID_STD(id)  is a value of "id" left-shifted by 18,  according to the spec. while for RX FIFO ID table structure, the spec of Type B/C is different. so we should use the value of id directly to define the type B and type C Rx Frame Identifier. For example, #define FLEXCAN_RX_FIFO_STD_MASK_TYPE_B_HIGH(id, rtr, ide) \ (((uint32_t)((uint32_t)(rtr) << 31) | (uint32_t)((uint32_t)(ide) << 30)) | \ ((id & 0x7FF) << 19)) /**< Standard Rx FIFO Mask helper macro Type B upper part helper macro. */   This patch doesn't affect FlexCAN operation related with message buffers , neither with RX FIFO A type ID table.   Please kindly refer to the attachment for details.   Sorry for the inconvenience that has caused.   -Kan
View full article
Hello community,   This document is the continuation of the documents Line scan camera with KSDK [ADC + PIT + GPIO] and Controlling speed in DC motors and position in servomotors with KSDK [FTM + GPIO] which show the ease of use of the peripheral drivers from Kinetis SDK applied to the Freescale Cup smart car. This time I bring to you a document which explains an easy way to detect the track's line from the data acquired with the linear camera.   The required material to run this project is: A Servomotor (the project supports up to two servomotors, one servomotor is included in the smart car kit). Two DC motors (included in the smart car kit). Line scan camera (the project supports up to two cameras). FRDM-KL25Z based on the Kinetis Microcontroller KL25Z. FRDM-TFC shield. Mini-USB cable.   This material can be bought in The Freescale Cup Intelligent Car Development.         If you are interested in participate in the Freescale Cup you could take a look into the groups University Programs, The Freescale Cup Technical Reports TFC - Mexico, TFC - Brazil, TFC - China, TFC - Malaysia, TFC - Japan, TFC - North America, TFC - India, TFC - Taiwan, The Freescale Cup EMEA.   Best regards, Earl Orlando Ramírez-Sánchez Technical Support Engineer Freescale Semiconductor
View full article
Hi all,   there is a simple modification of ftm driver example based on KSDK 1.3, KDS 3.0 on FRDM-K22F.   enabling clocks for PORTs in hardware_init.c   void hardware_init(void) {    /* enable clock for PORTs */   CLOCK_SYS_EnablePortClock(PORTA_IDX);   CLOCK_SYS_EnablePortClock(PORTD_IDX);   CLOCK_SYS_EnablePortClock(PORTE_IDX);    PORT_HAL_SetMuxMode(PORTA,1u,kPortMuxAlt3);//red   PORT_HAL_SetMuxMode(PORTA,2u,kPortMuxAlt3);//green   PORT_HAL_SetMuxMode(PORTD,5u,kPortMuxAlt4);//blue    /* Init board clock */   BOARD_ClockInit();   dbg_uart_init(); } function for converting HSV to RGB color palette downloaded from hsv2rgb.cpp - shiftpwm - Arduino library to PWM many outputs with chained shift registers. - Google Project Hosting   setting ftm parameters for red, green and blue color, for red color: ftm_pwm_param_t ftmParamR = {         .mode                   = kFtmEdgeAlignedPWM,         .edgeMode               = kFtmLowTrue,         .uFrequencyHZ           = 24000u,         .uDutyCyclePercent      = 0,         .uFirstEdgeDelayPercent = 0,     };   setting PWM output for each color in infinite loop         FTM_DRV_PwmStart(BOARD_FTM_INSTANCE, &ftmParamR, 6);         FTM_DRV_PwmStart(BOARD_FTM_INSTANCE, &ftmParamG, 7);         FTM_DRV_PwmStart(BOARD_FTM_INSTANCE, &ftmParamB, 5);   forwarding parameters to hsv2rgb() hsv2rgb(hue,255,255,&red,&green,&blue,255);   changing hue and checking overflow of hue         hue++;         if(hue>=360)hue=0;   normalizing from 0-255 to 0-100 percent of PWM pulse width for each color         ftmParamR.uDutyCyclePercent = (uint8_t)(((float)red/255.0)*100.0);         ftmParamG.uDutyCyclePercent = (uint8_t)(((float)green/255.0)*100.0);         ftmParamB.uDutyCyclePercent = (uint8_t)(((float)blue/255.0)*100.0);   That´s all!   Importing example extract ftm_rainbow.zip to C:\Freescale\KSDK_1.3.0\examples\frdmk22f\driver_examples Go to KDS, import file and choose .wsd file After then don´t forget compile library first and then project.     I hope you will enjoy the demo 🙂   Iva
View full article
Hello KSDK fans:   As you may know, KSDK provides comprehensive software support for Kinetis MCUs to accelerate application development. Besides providing Hardware abstraccion layer and peripherals drivers it can be Processor Expert capable.   Here is an example on how to create a new project with KSDK and Processor Expert support.   It shows a simple USB HID example that is ready to add your application code by using either KSDK drivers or Processor Expert support.   I hope this can help you.   Regards,   Isaac Avila
View full article
Hello Kinetis world! Kinetis SDK is here to stay and with it there are good opportunities ahead, such as coding flexibility, portability, RTOS enablement, projects scalability and more. Right now this is a brand new solution introduced by Freescale, so a lot of tutorials, How-To's and demo codes are coming, in addition to those already in the KSDK installation. I wanted to share an example project developed with KSDK v1.0.0 and KDS v1.1.1, which uses a simple driver to communicate to an I2C EEPROM memory using a FRDM-K64F board. The driver is focused and was tested with a 256 Kbit memory (24xx256), but it should be compatible with the 64Kbit, 128 Kbit, 256 Kbit and 512 Kbit versions. This demo project demonstrates how to use the APIs of the KSDK I2C Master Driver. The connections are as next: Please notice this is not intended to be a robust driver for I2C EEPROMs. Instead consider it a basic demo code, but with time we could improve it. The attached pdf is an overview/explanation of the example, while the zip folder contains the project for Kinetis Design Studio v1.1.1. :smileyalert: Before the project can be successfully compiled, you need to have installed KSDK v1.0.0 (www.freescale.com/ksdk) and have the FRDM-K64F platform library already built. For instructions on how to build the platform library you can refer to Appendix A of the next document in KSDK installation folder: C:\Freescale\KSDK_1.0.0\doc\Kinetis SDK K64 User's Guide.pdf :smileyinfo: NOTE: Disregard IAR and Keil instructions and refer to KDS part. Importing and compiling the example project with KDS      1) Unzip the package. It is recommended to place it into your KDS workspace, but it can be located at any place.      2) From KDS go to File -> Import -> General -> Existing Projects into Workspace.      3) Check "Select root directory" and click on "Browse" to search for the location of the unzipped folder. Then click OK.      4) Mark the check box for "I2C_EEPROM_K64" and click on "Finish".      5) Go to Project -> Build Project or simply click on the hammer icon. Build process should finish with no errors. The project provides a default Debug Configuration to use with the Segger J-Link emulator firmware v2.0 installed in the FRDM-K64F. If you wish to use a different connection please refer to the next link: https://community.freescale.com/docs/DOC-101845 I hope you like this demo. Many thanks and credits to abigailinzunza, for her valuable help developing this project. Regards! Jorge Gonzalez
View full article
Created DAC Sinus example is PIT triggered with own buffer and is for FRDM-K64F.   adding analog component fsl_dac peripheral driver to project setting Voltage reference - Reference 2 for dac component (daConv1:fsl_dac) adding timer component fsl_pit peripheral driver to project setting period on 1 ms and enabling interrupts for timer component (pitTimer1:fsl_pit) setting buffer for sinusoidal in Sources -> Events.c #define DAC_TEST_BUFF_SIZE  (120U) uint16_t dac_buffer[DAC_TEST_BUFF_SIZE] =     {         0x7ff, 0x86a, 0x8d5, 0x93f, 0x9a9, 0xa11, 0xa78, 0xadd, 0xb40, 0xba1,         0xbff, 0xc5a, 0xcb2, 0xd08, 0xd59, 0xda7, 0xdf1, 0xe36, 0xe77, 0xeb4,         0xeec, 0xf1f, 0xf4d, 0xf77, 0xf9a, 0xfb9, 0xfd2, 0xfe5, 0xff3, 0xffc,         0xfff, 0xffc, 0xff3, 0xfe5, 0xfd2, 0xfb9, 0xf9a, 0xf77, 0xf4d, 0xf1f,        0xeec, 0xeb4, 0xe77, 0xe36, 0xdf1, 0xda7, 0xd59, 0xd08, 0xcb2, 0xc5a,         0xbff, 0xba1, 0xb40, 0xadd, 0xa78, 0xa11, 0x9a9, 0x93f, 0x8d5, 0x86a,         0x7ff, 0x794, 0x729, 0x6bf, 0x655, 0x5ed, 0x586, 0x521, 0x4be, 0x45d,         0x3ff, 0x3a4, 0x34c, 0x2f6, 0x2a5, 0x257, 0x20d, 0x1c8, 0x187, 0x14a,         0x112, 0xdf, 0xb1, 0x87, 0x64, 0x45, 0x2c, 0x19, 0xb, 0x2,         0x0, 0x2, 0xb, 0x19, 0x2c, 0x45, 0x64, 0x87, 0xb1, 0xdf,         0x112, 0x14a, 0x187, 0x1c8, 0x20d, 0x257, 0x2a5, 0x2f6, 0x34c, 0x3a4,         0x3ff, 0x45d, 0x4be, 0x521, 0x586, 0x5ed, 0x655, 0x6bf, 0x729, 0x794       }; uint16_t index = 0; void pitTimer1_IRQHandler(void) {   /* Clear interrupt flag.*/   PIT_HAL_ClearIntFlag(g_pitBase[FSL_PITTIMER1], FSL_PITTIMER1_CHANNEL);   /* Write your code here ... */    DAC_DRV_Output(FSL_DACONV1,dac_buffer[index++]);   if(index==DAC_TEST_BUFF_SIZE)       index = 0;  }‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍   FRDM-K64F with SALEAE   sinusoidal output     Enjoy! 🙂
View full article
Kinetis SDK 1.1.0 is now officially released! You can download it via the big "Download" button on the KSDK website at http://freescale.com/ksdk   There are Windows and Linux 32-bit and 64-bit installers available. KSDK 1.1 will install in a new directory, which by default is C:\Freescale\KSDK_1.1.0, and will not interfere with previous installations of KSDK except to (optionally) update the Windows KSDK_PATH variable used by Kinetis Design Studio.   A high-level overview of what's new in KSDK 1.1 can be found in the Kinetis SDK 1.1 Release Notes but the most significant changes are: Additional devices supported Atollic TRUEStudio 5.2 is now supported Driver, HAL, and Platform Updates   There were also some other notable changes: GCC Make System Directory layout CMSIS-DAP/OpenOCD debug configurations now provided by default for KDS MQX for KSDK now included as option in the KSDK installer MQX Kernel 5.0.1 now supports lightweight configuration option   Details: 1)      Additional Devices The following devices are supported by Kinetis SDK 1.1 FRDM-K22F FRDM-K22F-K02* FRDM-K22F-K02 64* FRDM-K64F FRDM-KL03Z FRDM-KL46Z TWR-K22F120M TWR-K22F120M-K02* TWR-K24F120M TWR-K60D100M TWR-K64F120M TWR-KV10Z75M TWR-KV31F120M TWR-KV31F120M-KV30*   *These boards do not physically exist, but you can use the associated board to develop code for the subset devices listed. 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.   2)      Atollic TRUEStudio 5.2 support   3)      Driver, HAL, and Platform Updates The HAL, Driver, and Platform code was updated with additional features, bug fixes, and enhancements. Several new peripherals are also supported which are listed in the Kinetis SDK 1.1 Release Notes. The Kinetis SDK v.1.1 API Reference Manual.pdf contains the latest KSDK API, and look at the updated demo projects for how to use the updated features like the power manager. There is now also the option to copy or not copy the vector table from ROM to RAM based on the linker file configuration using the ‘__ram_vector_table__’  argument in your IDE linker settings.   4)      GCC Make Changes Compiling with GCC now uses CMAKE.  Details on how to setup your system for compiling with GCC can be found in the GCC section of the <KSDK_path>/doc/Getting Started with Kinetis SDK (KSDK).pdf document. If you have "C:\MinGW\msys\x.x\bin" in your PATH variable (as required by KSDK 1.0.0), remove it to ensure that the new GCC build system works correctly.   5)      Directory Layout The HAL, Driver, and platform directory layout was slightly changed so that all the include files are now in a single directory instead of separate directories. This makes it simpler to add the include path into projects, and can also improve library compile times (by up to 50%). The KSDK platform library has also been slightly renamed to libksdk_platform.a   6)      CMSIS-DAP Debug Configuration OpenOCD debug configurations in Kinetis Design Studio are now provided by default for boards that use OpenSDAv2. OpenOCD makes use of the CMSIS-DAP debug protocol.   7)      MQX for KSDK Installer The Kinetis SDK 1.1 installer now includes options to install full MQX for KSDK support. The installation screen has also made it clearer during installation on how to select this option. There will no longer be a separate MQX for KSDK installer like there was for KSDK 1.0.   😎      MQX 5.0.1 Kernel Support of MQX Lite configuration and new example application rtos/mqx/examples/. There are provided options for creating tasks from statically allocated memory and application can define these tasks before MQX RTOS starts (using create_task() API). More changes are detailed in the MQX Release Notes in <KSDK_Path>/rtos/mqx/doc/Freescale MQX RTOS for Kinetis SDK Release Notes.pdf   This is just a high level overview of the changes, and should make developing applications using Kinetis SDK easier than ever.
View full article
Hello community:   This document shows how to integrate a basic NFC (Near Field Communication) library to a KSDK project and explain its use with a simple demo project.   INTEGRATING NFC CONTROLLER LIBRARY   These instructions are based in the files usually present in a KSDK project. If your project has a custom source file structure, just add the referenced code accordingly.   1- Open the file gpio_pins.c and add 2 pin configurations: 1 input pin called NFCCirqPin and 1 output pin called NFCCvenPin:   gpio_input_pin_user_config_t NFCCirqPin = {    .pinName = kGpioNFCCirq,    .config.isPullEnable = false,    .config.pullSelect = kPortPullUp,    .config.isPassiveFilterEnabled = false,    .config.interrupt = kPortIntDisabled, }; gpio_output_pin_user_config_t NFCCvenPin = {    .pinName = kGpioNFCCven,    .config.outputLogic = 1,    .config.slewRate = kPortSlowSlewRate,    .config.driveStrength = kPortLowDriveStrength, };‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍   2-  In the file gpio_pins.h add 2 extra elements to the gpio enumeration. Also add extern declarations for the 2 pins defined in the previous step.   NOTE: In this example the selected pins are PTB16 as IRQ and PTB17 as VEN. The pins depend on your routing from the Kinetis MCU to the NFC Controller board.   enum _gpio_pins {    kGpioLED1 = GPIO_MAKE_PIN(GPIOD_IDX,  5),  /* FRDM-KL43Z RBG LED Green LED */    kGpioLED2 = GPIO_MAKE_PIN(GPIOE_IDX, 31),  /* FRDM-KL43Z RBG LED Red LED   */    kGpioSW1 = GPIO_MAKE_PIN(GPIOA_IDX,  4),  /* FRDM-KL43Z SW1 */    kGpioSW3 = GPIO_MAKE_PIN(GPIOC_IDX,  3),  /* FRDM-KL43Z SW3 */    kGpioNFCCirq = GPIO_MAKE_PIN(GPIOB_IDX,  16), /* GPIO for NFCC IRQ pin */    kGpioNFCCven = GPIO_MAKE_PIN(GPIOB_IDX,  17), /* GPIO for NFCC VEN pin */ }; extern gpio_input_pin_user_config_t NFCCirqPin; extern gpio_output_pin_user_config_t NFCCvenPin;‍‍‍‍‍‍‍‍‍‍‍‍   3- In the file pin_mux.c define a function to configure the MUX setting of the required GPIO and I2C pins to interface with the NFC controller.   NOTE: The configured pins must correspond to the routing from the Kinetis MCU to the NFC controller board. In this case PTB16/PTB17 are set as GPIOs while PTE0/PTE1 are configured for I2C functionality. For I2C pins also check the MUX number in the device's Reference Manual (e.g. PTE0/PTE1 in KL43 have the I2C function in ALT6.   void configure_nfcc_pins(void) {    /** I2C_SDA **/    PORT_HAL_SetMuxMode(PORTE,0u,kPortMuxAlt6);    /** I2C_SCL **/    PORT_HAL_SetMuxMode(PORTE,1u,kPortMuxAlt6);    /* NFCC IRQ */    PORT_HAL_SetMuxMode(PORTB,16u,kPortMuxAsGpio);    /* NFCC VEN */    PORT_HAL_SetMuxMode(PORTB,17u,kPortMuxAsGpio); }‍‍‍‍‍‍‍‍‍‍‍   4- Add the prototype of the function to header file pin_mux.h.   /* ** =================================================== **     Method      :  configure_nfcc_pins */ /*! **     @brief **         Set mux configuration for I2C and GPIO pins **         to interface with the NFC Controller. */ /* ==================================================*/ void configure_nfcc_pins(void);‍‍‍‍‍‍‍‍‍‍‍   5- Add the NfcLibrary and TML folders with all its subfolders and files to your project's tree, so the library is part of the build. Also add the include paths to your compiler for the inc folders. Below an example with Kinetis Design Studio:                - Now the project is ready to use the NFC controller library. The library uses the next conditional compilation macros, add or remove these symbols from the compiler's preprocessor settings as required:   CARDEMU_SUPPORT: The NFC Controller host (MCU) emulates a contactless card which can be accessed by an external Reader/Writter. P2P_SUPPORT: The host MCU can establish a 2-way communication accesing to or sending information to an external Reader/Writter. RW_SUPPORT: With this mode the host can access a remote contactless tag/card via the NFC Controller. NCI_DEBUG: If defined, all information transfered between the host MCU and the NFC Controller Interface (commands, responses, notifications, data) is echoed to console for debug purposes.     DEMO PROJECT   The attached project is based on the application note AN11658 NXP-NCI NullOS integration example. So you can refer to the appnote for detailed information.   Software The project was developed with the next software versions:   - KSDK v1.3 - KDS v3.0.0 :smileyinfo: NOTES: -The KSDK platform library for the KL43 must be built before the example project. Otherwise the build fails due to library file missing (libksdk_platform.a). - Once the example project is imported please verify that the build variable PROJECT_KSDK_PATH is pointing to your KSDK v1.3 installation path.   Hardware - For the NFC part, I used the NFC Controller board from the OM5577, which is a demonstration kit for the PN7120 NFC controller Interface chip. - To interface with the NFC Contoller I used a FRDM-KL43Z Freedom board.     How to use the demo   R/W mode:   -  Placing a tag with a single text, URI or vCard NDEF record next to the NFC reader. Examples:                P2P mode:   - Bring an android phone with NFC enabled close to the NFC controller antenna and use the "beaming" feature. In the case below the NXP home page is "beamed" from the adroid phone's explorer:                     CARD EMULATION mode     For this mode it is required to remove the P2P_SUPPORT macro and rebuild/reprogram the project.   - Bringing an android phone set to read a NFC tag close to the NFC controller board:     I hope you like this document. Any questions or doubts please let me know in the comments.   Jorge Gonzalez NXP Technical Support
View full article
The USB stack in ksdk 1.3 has provided a macro of “USBCFG_DEV_ADVANCED_SUSPEND_RESUME” , while the RM says “suspend/resume is not implemented yet.”, but if you looks into the source code, you may find APIs like USB_Suspend_Service() which is reserved for further implementation, so users may use these APIs as a starting point to add suspend and resume feature in ksdk 1.3. The test is based on FRDM-KL27Z, dev_hid_mouse_bm demo. And before we modify the device stack, we have to clone a copy of this demo. Set USBCFG_DEV_ADVANCED_SUSPEND_RESUME to 1 to releases APIs related with suspend and resume features. But we will have the following errors after compile, that is because remote resume function is not supported by KL27. so we should disable it for this device, with the help of #if USBCFG_DEV_ADVANCED_SUSPEND_RESUME == 1 && FSL_FEATURE_USB_KHCI_HOST_ENABLED == 1. For example, like below: 2.Further implement USB_Suspend_Service() and USB_Resume_Service() to let them notify the upper layer application on the event of suspend/resume. With reference of USB_Error_Service() and Don’t forget to add two more events for suspend and resume. 3.USB module has two types of resume interrupt , one is sync resume , issued by the bit of ISTAT[RESUME] bit, the other is async resume, issued by the bit of TRC0[USB_RESUME_INT], so we have to monitor these two interrupt status flag in the ISR, as below: And so we have modify the resume and sleep interrupt services for supporting the async resume interrupt as below: 4.Modify application and add code to handle suspend and resume event, in this case, such kind of events are handled in USB_App_Device_Callback() 5.Verify the hid_mouse demo with USB 2 CV tool from usb.org Select the FS device with VID 15a2 from the list. Test passed! if you print some messages on the event of suspend and resume, you will see something like below from the Terminal channel. 6. Now we can add low power mode switch function in the main application code to meet the suspend current limitation specified by USB spec, with reference of power_manager_hal_demo for frdmkl27z, and for this case, add code in USB_App_Device_Callback() of mouse.c to tell the main application when to enter low power mode. Please also note Don’t enter low power mode in this callback function, as it is called by the interrupt service, so if the device enter low power mode during interrupt, that would prevent the following resume interrupt happen, so the device never wake up! For more details on the implementation, please refer to the attached mouse.c 7.Test low power mode current:   Before test, please do the following modification to the FRDM-KL27Z board: Please note, if your board has the following jumpers, no need to remove R7,R21 and R83, just keep J19 and J22 open during the test. Select the low power mode you are going to test from the Ternimal: Leave KL27 USB port (J10) open and power the board with USB SDA port, that would make the device enter suspend interrupt out of reset. And you may also see the current vary with power mode switch with the help of USB 2 CV tool. I have tested wait, stop and vlps modes, the current measured under these modes are shown as below: Wait: Stop: VLPS: So it is recommend using VLPS mode during USB suspend mode as it far below the suspend current specified in USB spec (500uA). 8. Patch and demo code Please replace the following files with the attached one, as well as the mouse.c in dev_hid_mouse_bm demo. Recompile the stack and application code. C:\Freescale\KSDK_1.3.0\usb\usb_core\device\include\MKL27Z644 usb_device_config.h C:\Freescale\KSDK_1.3.0\usb\usb_core\device\sources\controller usb_dev.h usb_dev.c usb_framework.c C:\Freescale\KSDK_1.3.0\usb\usb_core\device\sources\controller\khci device_khci_interface.c khci_dev.c khci_dev.h C:\Freescale\KSDK_1.3.0\usb\usb_core\device\include usb_device_stack_interface.h C:\Freescale\KSDK_1.3.0\examples\frdmkl27z\demo_apps\usb\device\hid\hid_mouse mouse.c
View full article
Hello Kinetis users!   I thought this would be the best place to share this code.  Attached is an example of how to use the power manager in the 1.0.0 release of the Kinetis SDK.  It is essentially the legacy low power demo ported to the SDK.  Now, the SDK doesn't provide functions to de-initialize the pins so some of it is a little messy, but it should still help to show you how to use the power manager and how to get in and out of low power modes.    The supported platforms are:   FRDM-K22F FRDM-K64F TWR-K22F120M TWR-K64F120M TWR-KV31F120M   To install the demo, simply unzip the file to the "demos" folder of your SDK installation.  All of the links in the demo are relative so you shouldn't have any trouble.  However, if you do experience any issues, please let me know so that I can correct the issues.    To run the demo, simply build and download the application (a guide of how to do this is provided in the device specific User's Guide in your SDK installation).  Then perform a power-on reset (you always want to do that when working with low power applications) and connect a terminal utility with the following settings:   - 19200 baud rate - 8 data bits - No parity - 1 stop bit - No flow control   Then follow the on-screen instructions.    As a reminder to those wishing to understand low power operations and the Kinetis devices a little more, we do have an Application Note out there to help explain low power operations:  AN4503 Power Management for Kinetis and ColdFire+ MCUs.  This Application Note is in the process of being updated with Kinetis SDK information and is scheduled to be re-published sometime this year.    Enjoy! Chris
View full article
When you need to create copy/clone of i.g. web_hvac example for FreeRTOS as standalone project, you can face this issue. It is impossible to work with the copy. Why? There is missing folder for RTOS and LIB.   ISSUE: You start to clone example There is missing folder for RTOS Also missing library ksdk_freertos_lib which is needed for the example Impossible to compile the project, because folder mentioned above are missing in the project WORKAROUND: Just add the folder rtos from C:\Freescale\KSDK_1.3.0 The same for the library, you add to the folder from C:\Freescale\KSDK_1.3.0\lib Import .wsd file Wsd file was successfully imported, library is included Build successful finished   I hope this helps you. Iva
View full article
Because I receive feedback from customers, that it is sometimes complicated to execute this demo, I created short tutorial how to set it and execute it in KDS 3.0.0.   1. Physical connection In case of TWR-K64F, is needed TWR-SER and correctly set jumpers. and for TWR-K64F is needed to set jumper J6 to pins 1 and 2.   Be sure, that the TWR-SER and TWR-K64F is correctly connected (by white line) 2. Network configuration For changing IP address, please go to Network and Sharing Center, choose Change adapter settings Right click on Properties and change the IP address (TCP/IPv4) to 192.168.2.100   3.  Downloading the demo to TWR-K64F Go to KDS, File - Import and browse the demo, which is located at C:\Freescale\KSDK_1.2.0\examples\twrk64f120m\demo_apps\web_hvac\web_hvac_mqx\kds Import all libraries and the demo project and see imported sets in Project Explorer Debug the libraries first and then the project. Be sure, what debugger is used on the board and set the debugger. And now go to Resume!   4. Test the connection Go to cmd and ping to 192.168.2.102 (address of HVAC Server)   5. HVAC Web Server.Go to browser and type the address 192.168.2.102, you will see page for HVAC Web Server. Go to HVAC Demo - HVAC Status and now you can observe the temperatures by pressing button. There are set combinations which means see below. LED1: Simulate the Fan’s state LED2: System in the Heat mode LED3: System in the Cool mode LED4: Simulate the heart beat, increase real temperature (i.e., by hair dryer) to see the LED4 go faster and decrease temperature to see it slow down. So, if is needed increased temperature, push the first button (SW1) and Fan and Heat mode run. LED1 and LED2 will be light on and the temperature will increase.   Enjoy! Iva
View full article