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:
So far the composite msd_cdc demo from ksdk 1.3 just supports ram disk application, to have the SD card support just as the dev_msd demo, you have to go through the following steps: Add platform/composite/src/sdcard/fsl_sdhc_card.c and platform\drivers\src\sdhc\fsl_sdhc_irq.c to the project. Add project including path: platform\composite\inc and platform\drivers\inc. Change usb\example\device\composite\msd_cdc\disk.c as attached file      Change usb\example\device\composite\msd_cdc\disk.h as attached file      Change usb\example\device\composite\msd_cdc\hardware_init.c as attached file. Compile the demo and let it go, the PC would recognize the MSD and CDC device,  but might need you install the CDC driver, use the one from the folder of "C:\Freescale\KSDK_1.3.0\examples\twrk60d100m\demo_apps\usb\device\cdc\virtual_com\inf". With SD card inserted , you may see the removable disk, and format the disk just like below: Copy a ~50M file to this disk eject the disk after done, and then pull and plug the device again, you may verify the copied file with fc.exe command This solution has been tested on TWR-K60D100M with TWR-SER, both bm and mqx examples are verified ok, please kindly refer to the attached files for more details.
View full article
This community post describes how to combine the ADC and DMA using KSDK to simulate a flexible peripheral storing the ADC results into a buffer stored in memory.   In this configuration the MCU uses less resources, only using one ADC and the hardware (DMA) chainging the ADC channel and filling up the memory buffer with the results of the ADC. This way the MCU does not need to read the ADC result register being everything done automatically.                        KSDK The Kinetis Software Development Kit (SDK) is 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 is complimentary and includes full source code under a permissive open-source license for all hardware abstraction and peripheral driver software.   KINETIS_SDK   FRDM-K64M The FRDM-K64F is an ultra-low-cost development platform for Kinetis K64, K63, and K24 MCUs. The FRDM-K64F hardware is form-factor compatible with the Arduino™ R3 pin layout, providing a broad range of expansion board options. Features: MK64FN1M0VLL12 MCU (120 MHz, 1 MB flash memory, 256 KB RAM) for more information see FRDM-K64F   DMA to Emulate ADC Flexible Scan To emulate flexible scan it is necessary to configure the DMA to change the input ADC channel. The channel numbers are defined in the ADC_mux array. The conversion results are stored in the ADC0_resultBuffer array with the following order:   ADC0_CH12. ADC0_CH13. ADC0_CH23.   The Kinetis K series of microcontrollers also offers a powerfulDMA peripheral with up to 16 channels that can be combined with the ADC to allow the scanning of more than two channels.   System overview ADC Flexible Scan mode requires two DMA channels for one ADC converter. DMA channel 1 with a higher priority transfers the resultant ADC data from the ADC0_RA register to a memory buffer. DMA channel 0 with a lower priority transfers the next ADC channel setting (input multiplexer channel) from the constant buffer. The following figure depicts the application Figure 1. Depicts the application Flow diagram: The example code that accompanies this application note demonstrates a continuous scan conversion from three ADC channels. Each channel is measured four times, so the result buffer size is 3 × 4 = 12 (the real buffer size is 16, to demonstrate that only 12 data field parts are written). The ADC works in hardware trigger mode, with the LPTMR timer serving as the trigger source. Scanning is executed in continuous mode; thus, after a major loop has finished, the result buffer pointer address_0 is reloaded and the conversion begins again from the start buffer address. To calculate and change the frequency, check the macro INPUT_SIGNAL_FREQ to change the frequency value in Hz. The DMA1 is triggered by the ADC, and the DMA0 is triggered by the eLINK of minor   loop of DMA1. In this example the frequency is set to10 Hz, and is the number of samples is 10.   Figure 2. Flow diagram Configuration with SDK Configure the ADC (functions and structures):   The ADC initialization in the application is shown on the following code snippet.   The ADC is in interruption mode. Trigger by LPTMR (HW trigger)                                     Trigger for eDMA enable                                     Fist channel input is 0x0C.  Channel ADC_SE12                                     Select the channel in chnNum                             /*      * Initialization ADC for      * 12bit resolution, interrrupt mode, hw trigger enabled.      * normal convert speed, VREFH/L as reference,      * disable continuouse convert mode.      */ ADC_DRV_StructInitUserConfigForIntMode(&adcUserConfig);     adcUserConfig.hwTriggerEnable = true;     adcUserConfig.continuousConvEnable = false;     adcUserConfig.dmaEnable = true;      ADC_DRV_Init(instance, &adcUserConfig, &gAdcState);      /* Install Callback function into ISR. */    ADC_DRV_InstallCallback(instance, 0U, adc_chn0_isr_callback);      adcChnConfig.chnNum = ADC_INPUT_CHAN;     adcChnConfig.diffEnable = false;     adcChnConfig.intEnable = true;     adcChnConfig.chnMux = kAdcChnMuxOfA;      /* Configure channel0. */     ADC_DRV_ConfigConvChn(instance, 0U, &adcChnConfig);     /* Configure channel1, which is used in PDB trigger case. */      return 0;           To use the DMA driver, follow these steps:   1.  Initialize the DMA module: EDMA_DRV_Init();   2.  Request a DMA channel: DMA_DRV_RequestChannel(); 3.  Configure the TCD:  EDMA_DRV_PrepareDescriptorTransfer(); and EDMA_DRV_PushDescriptorToReg(); 4.  Register callback function: EDMA_DRV_InstallCallback(); 5.  Start the DMA channel: EDMA_DRV_StartChannel(); NOTE: the next two functions are optional for stop and free DMA channel 6.  Stop the DMA channel: EDMA_DRV_StopChannel(); 7.  Free the DMA channel: dma_free_channel().   Initialize the DMA module: EDMA_DRV_Init();   In this function you can select the eDMA channel to use and this function initializes the run-time state structure to provide the eDMA channel allocation release, protect, and track the state for channels. This function also opens the clock to the eDMA modules, resets the eDMA modules and initializes the module to user-defined settings and default settings.   chnDMA1.channel= kEDMAChannel1; chnDMA0.channel=kEDMAChannel0;   userConfig.chnArbitration = kEDMAChnArbitrationFixedPriority; userConfig2.chnArbitration= kEDMAChnArbitrationRoundrobin; userConfig.notHaltOnError = false; userConfig2.notHaltOnError = false;     EDMA_DRV_Init(&state, &userConfig); EDMA_DRV_Init(&state2, &userConfig2);          Request a DMA channel: DMA_DRV_RequestChannel();   This function allocates eDMA channel according to the required channel allocation andcorresponding to the eDMA hardware request, initializes the channel state memory provided by user and fills out the members.   This function provides two ways to allocate an eDMA channel: statically and dynamically. In a static allocation, the user provides the required channel number and eDMA driver tries to allocate the required channel to the user. If the channel is not occupied, the eDMA driver is successfully assigned to the user. If the channel is already occupied, the user gets the return value kEDMAInvalidChn, this is request a channel in a static way, In a dynamic allocation, any of the free eDMA channels are available for use. eDMA driver assigns the first free channel to the user.   //request ADC1// uint8_t requestDMA1 = EDMA_DRV_RequestChannel(kEDMAChannel1, kDmaRequestMux0ADC0, &chnDMA1); if(kEDMAInvalidChannel==requestDMA1)                      {                      printf("EDMAInvalidChannel 1 .  the request is failed.");                      } //request DMA0// uint8_t requestDMA0 = EDMA_DRV_RequestChannel(kEDMAChannel0, kDmaRequestMux0AlwaysOn63, &chnDMA0); if(kEDMAInvalidChannel==requestDMA0)                      {                      printf("EDMAInvalidChannel 0.  the request is failed.");                      }       DMA configurations: is shown on the following code snippet. (edma_transfer_config_t) TCD is a configuration structure, inside has a parameters to change for different types to transfers data.  srcAddr: memory address  pointing to the source data destAddr: memory address pointing to the destination address srcTransferSize: Source data transfer size. destTransferSize: Destination data transfer size. srcOffset: Sign-extended offset applied to the current source address form the next-state value as each source read/write is completed. destOffset: Sign-extended offset applied to the current destination address form the next-state value as each source read/write is completed. srcLastAddrAdjust: Last source address adjustment. destLastAddrAdjust: Last destination address adjustment. Note here it is only valid when scatter/gather feature is not enabled. srcModulo: Source address modulo. destModulo: Destination address modulo.                             minorLoopCount: Minor bytes transfer count. Number of bytes to be transferred in each service request of the channel. majorLoopCount: Major iteration count.   //////////configuration and ELINK DMA channel 1 //////////////////////////////////////////////////////////////////////////////////////////////////////////////        config[kEDMAChannel1].srcAddr = (uint32_t)(&ADC0_RA);  /*!< Memory address pointing to the source data. */        config[kEDMAChannel1].destAddr = (uint32_t)(&ADC0_resultBuffer[0]);/*!< Memory address pointing to the destination data. */        config[kEDMAChannel1].srcTransferSize = kEDMATransferSize_2Bytes;   /*!< Source data transfer size. */        config[kEDMAChannel1].destTransferSize = kEDMATransferSize_2Bytes;  /*!< Destination data transfer size. */        config[kEDMAChannel1].srcOffset = 0;         /*!< Sign-extended offset applied to the current source address to                                            form the next-state value as each source read/write is completed. */        config[kEDMAChannel1].destOffset = 2;        config[kEDMAChannel1].srcLastAddrAdjust = 0;    /*!< Last source address adjustment. */        config[kEDMAChannel1].destLastAddrAdjust = -24;   /*!< Last destination address adjustment. Note here it is only valid when scatter/gather feature is not enabled. */        config[kEDMAChannel1].srcModulo = kEDMAModuloDisable;       /*!< Source address modulo. */        config[kEDMAChannel1].destModulo = kEDMAModuloDisable;       /*!< Destination address modulo. */        config[kEDMAChannel1].minorLoopCount = 2;    /*!< Minor bytes transfer count. Number of bytes to be transferred                                             in each service request of the channel. */        config[kEDMAChannel1].majorLoopCount = 12;    /*!< Major iteration count. */   stcdDmaChn1.NBYTES.MLNO=0x02; /////////////////////////////Elink on/////////////////LINKCH/////major loop chn1// stcdDmaChn1.BITER.ELINKNO= (DMA_BITER_ELINKNO_ELINK_MASK|0x0000|0x0C); stcdDmaChn1.CITER.ELINKNO= (DMA_CITER_ELINKNO_ELINK_MASK|0x0C); stcdDmaChn1.ATTR= (DMA_ATTR_SSIZE(1)|DMA_ATTR_DSIZE(1)); stcdDmaChn1.CSR=(DMA_CSR_MAJORLINKCH(0)|DMA_CSR_MAJORLINKCH_MASK | DMA_CSR_INTMAJOR_MASK);   uint16_t statusChnn1 = EDMA_DRV_PrepareDescriptorTransfer(&chnDMA1, &stcdDmaChn1, &config[kEDMAChannel1], true, false);   if(kStatus_EDMA_Success == statusChnn1)        {          statusChnn1 = EDMA_DRV_PushDescriptorToReg(&chnDMA1, &stcdDmaChn1);        }         EDMA_DRV_PrepareDescriptorTransfer(); This function sets up the basic transfer for the descriptor.   EDMA_DRV_PushDescriptorToReg(); This function copies the software TCD configuration at for the hardware TCD. You needs fill up the structure stcd, and this function do transfer  all structure data in  DMA registers, is use a especial configuration In this case, the structure is filling up to configuration ELINK mode. The ELINK mode is a configuration of eDMA for triggers other DMA channel in each minion loop transfer is complete.   This is a registers of structure,  the mask to enable put on ElINKON mode  and for select channel to link and for put on the major loop to finishing trigger channel. stcd.BITER.ELINKNO= (DMA_BITER_ELINKNO_ELINK_MASK|0x0000|0x0C); stcd.CITER.ELINKNO= (DMA_CITER_ELINKNO_ELINK_MASK|0x0C);         DMA_BITER_ELINKNO_ELINK_MASK it’s a mask to active the channel-to-channel linking on minor-loop complete. As the channel completes the minor loop, this flag enables linking to another channel, defined by theLINKCH field. The link target channel initiates a channel service request via an internal mechanism You can see more information in Reference manual. ///////configuration DMA channel0 ///////////////////////////////////////////////////////////////////////////////////////     config[kEDMAChannel0].srcAddr = (uint32_t)(&ADC_mux[0]);     /*!< Memory address pointing to the source data. */        config[kEDMAChannel0].destAddr = (uint32_t)(&ADC0_SC1A);   /*!< Memory address pointing to the destination data. */        config[kEDMAChannel0].srcTransferSize = kEDMATransferSize_1Bytes;   /*!< Source data transfer size. */        config[kEDMAChannel0].destTransferSize = kEDMATransferSize_1Bytes;  /*!< Destination data transfer size. */        config[kEDMAChannel0].srcOffset = 1;         /*!< Sign-extended offset applied to the current source address to                                            form the next-state value as each source read/write is completed. */        config[kEDMAChannel0].destOffset = 0;        config[kEDMAChannel0].srcLastAddrAdjust = -3;    /*!< Last source address adjustment. */        config[kEDMAChannel0].destLastAddrAdjust = 0;   /*!< Last destination address adjustment. Note here it is only valid when scatter/gather feature is not enabled. */        config[kEDMAChannel0].srcModulo = kEDMAModuloDisable;       /*!< Source address modulo. */        config[kEDMAChannel0].destModulo = kEDMAModuloDisable;       /*!< Destination address modulo. */        config[kEDMAChannel0].minorLoopCount = 1;    /*!< Minor bytes transfer count. Number of bytes to be transferred                                             in each service request of the channel. */        config[kEDMAChannel0].majorLoopCount = 3;    /*!< Major iteration count. */         uint16_t statusChnn0 = EDMA_DRV_PrepareDescriptorTransfer(&chnDMA0, &stcdDmaChn0, &config[kEDMAChannel0], true, true);        if(kStatus_EDMA_Success == statusChnn0)        {               statusChnn0 = EDMA_DRV_PushDescriptorToReg(&chnDMA0, &stcdDmaChn0);        }         The function drivers in main file:          hardware_init();        dbg_uart_init();        OSA_Init();        init_adc(ADC_INST); init_trigger_source(ADC_INST);        config_DMA();   Open your terminal (baud rate 115200)    The results will appear on the terminal software.   Figure 3. Screen serial You can also see the results in the debugger window. Figure 4.  result buffer Steps to include ADC Flexible Scan software to KSDK   In order to include this demo in the KSDK structure, the files need to be copied into the correct place. The adc_dma_demo folder should be copied into the <KSDK_install_dir>/demos folder. If the folder is copied to a wrong location, paths in the project and makefiles will be broken. When the copy is complete you should have the following locations as paths in your system: <KSDK_install_dir>/demos/ adc_dma_demo /iar <KSDK_install_dir>/demos/ adc_dma_demo /kds <KSDK_install_dir>/demos/ adc_dma_demo /src In addition, to build and run the demo, it is necessary to download one of the supported Integrated Development Enviroment (IDE) by the demo: Freescale Kinetis Design Studio (KDS) IAR Embedded Workbench   Once the project is opened in one of the supported IDEs, remember to build the KSDK library before building the project, if it was located at the right place no errors should appear, start a debug session and run the demo.
View full article
Hi all,   Please find attached document describing how to get started with FreeRTOS and KSDK1.2 using KDS3.0.   For information about creating a new KSDK project with MQX please see the following document. How To: Create a New MQX RTOS for KSDK Project in KDS   Regards, Carlos
View full article
Sharing a porting guide for the USB CCID demo from using EMVSIM module on K8x/KL8x to more general UART-ISO7816 module on Kinetis K devices. The demo has been tested with K64 tower board and one internal tower card named as TWR-ISO7816, MK64 is connected directly with smart card connector without using external PHY.   Attached the porting guide and associated demo code based on KSDK2.0.   When running the demo code, you will see console log similar as in attached log file. After installing driver according to the readme file with the USB CCID demo, you will see something as follows in device manager for smart card. Then you can use the PC test tool "Snooper" to talk to smart card.     Hao Original Attachment has been moved to: USB_CCID_MK64.zip Original Attachment has been moved to: USB-CCID-log.txt.zip
View full article
Examples for current KSDK 1.3 are located under C:\Freescale\KSDK_1.3.0\examples examples for middleware (tcpip, filesystem) under C:\Freescale\KSDK_1.3.0\middleware   There are more examples, which were created:   KSDK 1.3 Rainbow color using FTM PWM with KSDK 1.3 How to use printf() to print string to UART in KDS3.0 + KSDK1.3 Driving 16x2 LCD using KSDK drivers Integrating NFC Controller library with KSDK KL43Z support for sLCD and Touch sense using KDS3.0 +KSDK1.3.0 + Processor expert   KSDK 1.2 Using DMA to Emulate ADC Flexible Scan Mode with KSDK Writing my first KSDK1.2 Application in KDS3.0 - Hello World and Toggle LED with GPIO Interrupt Controlling speed in DC motors and position in servomotors with KSDK [FTM + GPIO] Line scan camera with KSDK [ADC + PIT + GPIO] A simple way to detect the track's center for the Freescale Cup Smart Race FatFs + SDHC data logger with KSDK in Kinetis Design Studio Segment LCD Example for KSDK KSDK GPIO driver with Processor Expert DAC Sinus Demo (using PEx + KSDK 1.2 + KDS 3.0) How to start customized KSDK project based on KSDK demo code   KSDK 1.1 An example project for FIR function implement on KV31 with SDK and CMSIS How to toggle LED in KDS 2.0 with KSDK 1.1.0 and Processor Expert KSDK SPI Master-Slave with FRDM-K64F Configuring Kinetis Software Development Kit (KSDK) to measure distance with ultrasonic transducers A demo project of USB HID bi-directional generic device for Kinetis SDK 1.1.0 Configuring Kinetis Software Development Kit (SDK) to measure distance with infrared (IR) sensor Writing my first KSDK Application in KDS - Hello World and GPIO Interrupt   KSDK 1.0 Writing your first toggle LED application with FRMD-K64F + KDS 1.1.0 + KSDK 1.0.0 Non-Processor Expert Low Power Application Using the SDK KSDK I2C EEPROM Example
View full article
The latest Kinetis SDK 1.1.0 supported HID bi-directional communication, the new API USB_Class_HID_Recv_Data() can be used to receive data from USB HOST. But without demo and test tool, customer still has no idea about how to enstablish such kind of communication in their application. I create a simple demo derived from existed hid_keyboard project, together with basic endpoint read/write test by Bus Hound. The demo is built and tested on my FRDM-K64F and can be port to other USB Kinetis device as well. Working steps: 1) Unzip attached code and project to C:\Freescale\KSDK_1.1.0\usb\example\device\hid folder. 2) Compile project (IAR) and download to FRDM-K64F via CMSIS-DAP debugger. 3) Open Bus hound, enter "Devices" table and uncheck all box and check "auto select hot plugged devices". 4) Plug USB cable and connects to PC, will found the device is checked in bus hound device tree. 5) Double click device, and select OUT endpoint to send 16 bytes to device. 6) Observe the g_OUT_ep_buf[]'s change in firmware (Demostrate receive function only)
View full article
Recently one of our customers reported an issue when he tried to run "dspi_edma_demo" with KSDK 1.0 on K22F freedom board. He connected SPI signals between master and slave according to the demo user guide on freedom board, but the demo was not working.   I reproduced the issue on freedom and found this is due to incorrect documentation in demo user guide.   The connection table shown in demo user guide for K22F freedom board is as follows. This is not correct.   It should be the following table instead.  Master Connects to Slave Signal Pin Name Board Location Pin Name Board Location SS PTD0 J6 Pin 8 -> PTD4 J2 Pin 6 SCK PTD1 J6 Pin 5 -> PTD5 J2 Pin 12 Data Out PTD2 J6 Pin 6 -> PTD7 J2 Pin 10 Data In PTD3 J6 Pin7 -> PTD6 J2 Pin 8   Also, the associated pin mux configuration in pin_mux.c file should be changed from the original workaround one in red to the original commented one.   void pin_mux_SPI(uint32_t instance)   {     switch(instance) {       case 0:                             /* SPI0 */         /* PORTD_PCR0 */         PORT_HAL_SetMuxMode(g_portBaseAddr[3],0u,kPortMuxAlt2);         //PORT_HAL_SetMuxMode(g_portBaseAddr[2],4u,kPortMuxAlt2);   /*** Temporary work around until next board spin. ***/         /* PORTD_PCR3 */         PORT_HAL_SetMuxMode(g_portBaseAddr[3],3u,kPortMuxAlt2);         //PORT_HAL_SetMuxMode(g_portBaseAddr[2],5u,kPortMuxAlt2);   /*** Temporary work around until next board spin. ***/         /* PORTD_PCR1 */         PORT_HAL_SetMuxMode(g_portBaseAddr[3],1u,kPortMuxAlt2);         //PORT_HAL_SetMuxMode(g_portBaseAddr[2],6u,kPortMuxAlt2);   /*** Temporary work around until next board spin. ***/         /* PORTD_PCR2 */         PORT_HAL_SetMuxMode(g_portBaseAddr[3],2u,kPortMuxAlt2);         //PORT_HAL_SetMuxMode(g_portBaseAddr[2],7u,kPortMuxAlt2);   /*** Temporary work around until next board spin. ***/         break;   }   }  
View full article
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
Hello community,   This document 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 make the line scan camera with KSDK works step-by-step. This document is intended to be an example for the ADC, the PIT and the GPIO peripheral drivers usage.   The required material to run this project is: Line scan camera (the project supports up to two cameras). FRDM-KL25Z based on the Kinetis Microcontroller KL25Z. FRDM-TFC shield. Mini-USB cable. TFC camera wire.   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 Line scan camera with KSDK [ADC + PIT + GPIO] explains how to implement an application to acquire the data provided by the line scan camera. The result of this document is the project BM-KSDK-FRDM_KL25Z-LINE_SCAN_CAMERA.   The video below shows the line scan camera working.     If you are interested in participate in the Freescale Cup you could take a look into the groups University Programs, The NXP Cup Technical Reports The NXP Cup - Mexico, The NXP Cup - Brazil, The NXP Cup - China, The NXP Cup - Malaysia, The specified item was not found., The NXP Cup - North America, The specified item was not found., The NXP Cup - Taiwan, The NXP Cup EMEA.       Best regards, Earl Orlando Ramírez-Sánchez Technical Support Engineer Freescale Semiconductor
View full article
Hello dear community:   The attached document is an introductory guide to the Clock configuration system and Power manager system in KSDK v1.3 and its configuration using Processor Expert.   Some topics covered:   - KSDK Clock Manager system- Clock manager notification framework - Clock switch callbacks - KSDK Power Manager system - Power manager notification framework - Power mode switch callbacks - Creating and managing clock/power configurations with Processor Expert. - Managing custom clock/power callbacks with Processor Expert.   There is also an example project attached created for the FRDM-KL27Z board, but it can be taken as reference to use a different evaluation board or custom board. This project was developed by colleague Adrian Sanchez Cano.   I hope you find it useful. In case of any doubts please do not hesitate to ask.   Regards! Jorge Gonzalez
View full article
Just today release new KSDK version 1.2. and KDS 3.0! Download here   For more details please visit our websites Software Development Kit for Kinetis MCUs|Freescale and Kinetis Design Studio Integrated Development |Freescale   What´s new   Added device family support:   MK10D10 MK66F18 MKL34Z4 MK11DA5 MKL02Z4 MKL36Z4 MK20D10 MKL14Z4 MKL43Z4 MK21DA5 MKL15Z4 MKV40F15 MK21FA12 MKL16Z4 MKV43F15 MK26F18 MKL17Z4 MKV44F15 MK30D10 MKL17Z644 MKV45F15 MK40D10 MKL24Z4 MKV46F15 MK50D10 MKL25Z4 MKW01Z4 MK51D10 MKL26Z4 MKW21D5 MK52D10 MKL27Z4 MKW22D5 MK53D10 MKL27Z644 MKW24D5 MK65F18 MKL33Z4 MK24F12 MK63F12   Added Peripheral support: AOI ENC FLEXBUS FLEXIO LMEM VREF XBAR PWM   Documentation   Kinetis SDK v.1.2.0 Release Notes http://cache.freescale.com/files/soft_dev_tools/doc/support_info/KSDK120RN.pdf?fsrch=1 Kinetis SDK v.1.2 API Reference Manual http://cache.freescale.com/files/soft_dev_tools/doc/support_info/KSDK12APIRM.pdf?fsrch=1 Kinetis SDK v.1.2 Demo Applications User's Guide http://cache.freescale.com/files/soft_dev_tools/doc/support_info/KSDK12DEMOUG.pdf?fsrch=1 Getting Started with Kinetis SDK (KSDK) v.1.2 http://cache.freescale.com/files/soft_dev_tools/doc/support_info/KSDK12GSUG.pdf?fsrch=1 MQX™ RTOS for Kinetis SDK 1.2.0 Release Notes http://cache.freescale.com/files/soft_dev_tools/doc/support_info/MQXKSDK120RN.pdf?fsrch=1   Porting an MQX RTOS Application to MQX RTOS for Kinetis SDK http://www.freescale.com/files/soft_dev_tools/doc/support_info/MQXKSDKPUG.pdf   for KDS 3.0. please don´t forget visit New Kinetis Design Studio V3.0.0 available   Enjoy! Iva
View full article
For downloading this tool please go to Software Development Kit for Kinetis MCUs|Freescale   Features mentioned in Release Note:   The following features are available with the KSDK Project Generator 1.0 GA 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 2.0, KSDK 1.3.0 and 1.2.0 (and is needed to install KSDK 1.2/KSDK 1.3) 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 HAL or Platform library level projects Libraries in standalone projects tailored to device package KDS, IAR EWARM, Keil MDK, and/or Atollic TrueSTUDIO IDE projects Advanced Generate of KSDK ‘demo_apps’ Clones Clone projects located in ‘demo_apps’ folders for each development board Linked to KSDK installation or standalone clones   Known issue for cloning example as standalone project: Please see my workaround here KSDK Project Generator - BUG workaround   Enjoy this tool ! Any feedback is welcome!   Best Regards, Iva
View full article
At the moment the best way to create a new KSDK example project is copying one of the existing projects in the /demos folder and renaming all the files and text to the new name. I've created a simple script that does all the work for you.   To run, just place the .exe or Perl script in the C:\Freescale\KSDK_1.0.0\demos folder and run. By default it'll copy the "hello_world" project to a new directory, and change all the "hello_world" text and files names to your new project name. Pretty straight forward, but much easier and less prone to error than doing it by hand. I've attached both the Perl source and a .exe created from that perl script. There is a command line option to specify the project to be copied, but by default it uses the hello_world one.   Hope you find it useful!
View full article
The SAR-ADC of KM family supports using 4 triggering signals to trigger SAR-ADC, for the KM sub-family with PDB, it is okay to use PDB. But for the KM family without PDB module, it is difficult to generate  4 triggering signals to trigger SAR-ADC. The DOC introduce how to use quadTimer to generate 4 sequential triggering signals to trigger SAR-ADC so taht the SAR-ADC can get 4 samples in one conversion.
View full article
Kinetis SDK v2 is here! Introducing Kinetis SDK v2 The first steps with KSDK How to start with KSDK* List of published examples: KSDK list of examples* List of published documents: KSDK list of documents* * All of the source code placed in spaces above is for example use only. NXP does not accept liability for use of this code in the user’s application.
View full article
Hello KSDK friends:   This time I want to share with the community a project using FatFs and the SDHC + I2C drivers provided with the Kinetis SDK platform. This is a baremetal project with no RTOS.   If you are a follower of colleague Erich Styger's MCU_on_Eclipse blog, then you might be familiar with the demo application, which consists of a data logger to store the accelerometer values of a FRDM-K64F on-board FXOS8700CQ (accelerometer/magnetometer) to a Micro SD Card.   The difference is that this demo project is implemented with KSDK v1.2 platform, using the next components:   - FatFs: Generic File System used in embedded systems. - SDHC peripheral driver: To handle the SD Card commands. - SD Card driver: Part of the KSDK composite drivers. - I2C peripheral driver: Used to communicate with the on-board FXOS8700CQ. - other peripheral drivers and systems: Clock System, GPIO driver, etc.   2 attachments are included with this post:   1) Demo project for KDS (created with KDS v3.0.0). 2) Document with a detailed description of how the project was created.   If when importing the project KDS asks you to add compiler search paths, just select "No". Paths are already configured.   IMPORTANT: The project can be placed in any location, but the next conditions must be met before building the project:   - Build the K64F KSDK platform library KDS project. The "Debug" build configuration is used. If not familiar with this, please refer to "Getting Started with Kinetis SDK (KSDK) v.1.2.pdf" in KSDK doc folder: C:\Freescale\KSDK_1.2.0\doc.   - Check that the build variable {KSDK_PATH} is pointing to your KSDK v1.2 installation (Project -> Properties -> C/C++ Build -> Build Variables):       RUNNING THE DEMO   1- Load the application to the FRDM-K64F. 2- Connect the PC to the FRDM-K64F OpenSDA micro USB port. 3- Open a terminal software and connect to the OpenSDA Virtual COM port. Configure the terminal for a baud of 115200. 4- Reset the board. You will see this message:     5- Insert micro SD Card. Now terminal should look like this:     6-  Accelerometer values will start to be printed to terminal and logged to SD Card each second.   A safe remove mechanism is implemented. Press SW3 in FRDM-K64F until you see the message shown below:     Keep SW3 pressed until SD Card is removed.   7- Now with a PC you can open the file LOG_DATA.txt:     The file can also be opened by a software such as Excel to graph the results:     I hope you like this demo!   Regards. Jorge Gonzalez
View full article
Hello KSDK team!   I created helpful tutorial, how to install new version of KSDK.   1) Go to www.nxp.com/ksdk and click to Download button 2) Now choose the Kinetis SDK v2 & v1.3 click Download button 3) At the moment you are redirected to the Kinetis Expert Site, please go to Build an SDK 4) Please, sign in and click Sign in 5) Select MCU for the work and click Select Configuration 6) Selected MCU is supported by KSDK 2.0, you can download the package, choose the toolchain and Operation System. (Also you can add µC/OS-II and µC/OS-III to your package), click on Build SDK Package 7) Done, check Software Vault tab 😎 Please, go to Preferences 9) Please, fill the Preferences and don´t forget Save 10) After successful filling Preferences you are able to see the package in the window 11) Read the Software Terms and Conditions and agree with them 12) Save the package and you can start with KSDK 2.0   SDK API Documentation v.2.0 is located Kinetis SDK 2.0 API Reference Manual: Introduction Enjoy KSDK 2.0!   All feedbacks are very welcome!   Best Regards, Iva
View full article
Because of proliferating questions to “how can I work with copy of KSDK example” or “I am not successful with creation new MQX project with SDK, what I do wrong?”   I decided to do this this short step by step tutorial.   To do this procedure is needed the script, which creates Anthony Huereca and bat file created by me. Thanks to it is possible to create copy of any example which is based on KSDK. This script allows to work with real copy of KSDK example, which is choosen. It can be called like working copy. It is possible to edit any example and  build on this demo user´s own application. It is also much easier than e.g. creating new MQX project, which is quite lengthy process – always must think of correct settings paths, including libraries etc. In this situation is everything copyied (compiler settings, linker, preprocessor…) First of all is describe the utilization of the script. The script renames the original name of the demo to new one. So, user gets full-fledged copy. The main essence of the matter is that the script must be in location with other examples. I hope it helps a lot of us. Iva
View full article
Introducing Kinetis SDK v2 Kinetis SDK v2 is available on www.nxp.com/ksdk web page. Click on Build your SDK now to customize the KSDK based on your selection of device or evaluation hardware, RTOS, build system and more.   (Did you see the announcement of MCUXpresso IDE, SDK and Config Tools?  Kinetis SDKv2 is being renamed to MCUXpresso SDK and expanding to cover LPC devices as well.  Check out the MCUXpresso SDK webpage and Community for more information.)   What's New in Kinetis SDK v2? As was true for KSDK v1, v2 is a collection of comprehensive software enablement for NXP Kinetis Microcontrollers. It includes system startup, peripheral drivers, USB and connectivity stacks, middleware, and real-time operating system (RTOS) kernels. The Kinetis SDK also includes getting started and API documentation (online, PDF) along with usage examples and demo applications. However, v2 features several new components and improvements upon v1.   Note: The Kinetis SDK v2.0 Transition Guide provides more details about the differences and things to consider when moving from KSDK v1 to v2.   Updated Peripheral Drivers KSDK v2 eliminates the separate HAL and Peripheral Driver, replacing these two layers with a single driver for each peripheral. The single driver provides both the low-level functionality of the HAL and the non-blocking interrupt-based functionality of the Peripheral Driver. Peripheral drivers in KSDK v2 also eliminate external software dependencies on an OSA, Power Manager, and Clock Manager.  This makes the drivers easier to configure and more suitable for usage outside of the KSDK environment.   Simplified Folder Structure The folder structure of KSDK v2 has been simplified. The image below shows the folder structure for a KSDK v2 build for FRDM-K64F. The boards folder has been elevated to the top level and contains folders for all supported evaluation hardware. Specific board folders contain demo application, driver examples, middleware examples, and RTOS examples—all designed and tested to run on that specific board. The CMSIS folder contains the ARM® CMSIS vendor-independent hardware abstraction layers for Cortex®-M devices including CMSIS-CORE include files and CMSIS-DSP source and libraries.   The devices folder has also been elevated to the top level.  This folder contains sub-folders for each supported Kinetis MCU device.  KSDK v2 does not have a separate platform library.  All peripheral drivers can be found in the drivers folder contained within each device. Here you’ll find all the drivers for the given device.  This greatly simplifies include path requirements and makes it easy to determine which drivers apply to which devices.   You’ll also find middleware, and rtos folders at the top level that contain subfolders with source code for all middleware components and RTOS kernels supported.   RTOS Support One of the most notable changes in KSDK v2 is the focus on FreeRTOS.  All RTOS examples now use the FreeRTOS kernel.  Micrium μC/OS-II and μC/OS-III kernels are also pre-integrated into the KSDK (under an evaluation license).  RTOS peripheral driver wrappers for FreeRTOS and uC/OS-II & III are also provided that leverage native RTOS services (with no OSA).  These are provided for use as-is or as examples for how to integrate KSDK drivers and middleware with other Operating Systems.   The MQX kernel, stacks and middleware have been removed from the Kinetis SDK.  However, MQX Software is still a supported software suite from NXP that is available in the MQX RTOS and MQX for KSDK v1.3 products. New ports of MQX following the “Classic” architecture (i.e. similar style to MQX v4.x) will soon be available for newer Kinetis devices.  From here forward, the Kinetis SDK will focus on open-source RTOS solutions.   Middleware KSDK v2 features a few new and updated middleware packages. The USB stack is new and now offered under an open source, permissive license. lwIP and FatFS are retained as open source solutions or TCP/IP communications and filesystem support, respectively. There are also two optional cryptography packages, available separately, that have been pre-integrated and tested with the Kinetis SDK: wolfSSL and mbedTLS.   Supported Devices A complete list of support devices has been published in the new MCUXpresso Community.     Toolchain Support KSDK v2 supports the latest versions of: Kinetis Design Studio IAR Embedded Workbench Keil MDK Atollic TrueSTUDIO GNU GCC command line usin CMake   Project Generators Kinetis Design Studio (KDS) and Kinetis SDK v2 An update is available for KDS v3.x that adds a Kinetis SDK v2.x New Project wizard.  See this KDS Community post for details on installing the update.   Stand-alone KSDK Project Generator To quickly create new Kinetis SDK projects, or to clone existing projects, use the Kinetis SDK Project Generator   Configuration Tools Unlike KSDK v1, v2 does not have Processor Expert support available.  A new suite of configuration tools is being created that will build on KSDK v2 and will be rolled out throughout 2016.
View full article
This example project shows how to use CMSIS DSP functions to implement a digital filter. The project is based on Kinetis KV31F512.   It first generates a mixed signal which is composed by two sine waves.  Then it uses PDB to trigger DAC every 200 microsecond and output the signal through DAC, so that the mixed signal can be displaying on oscilloscope.   With QEDesign tool, a lowpass filter is designed, the filter coefficients are used directly to initialize the FIR function supplied by CMSIS DSP library. This example calls the FIR functions in CMSIS DSP lib, and the filtered signal is output though DAC module.
View full article