Kinetis软件开发套件知识库

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Kinetis Software Development Kit Knowledge Base

标签

讨论

排序依据:
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
查看全文
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.
查看全文
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
查看全文
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
查看全文
This demo is based on adc12_polling example , and so far I just tested it with FRDM-KE15Z, so please download SDK_2.0_FRDM-KE15Z.zip from Welcome to MCUXpresso | MCUXpresso Config Tools before you try that demo.   After opening the project, you have to import edma and dmamux driver code as below: then you may replace adc12_polling.c with the attached one.   compiling and run, you may see the console output ADC results like this.   Hope that helps, -Kan Original Attachment has been moved to: adc12_polling.c.zip
查看全文
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
查看全文