Kinetis Microcontrollers Knowledge Base

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

Kinetis Microcontrollers Knowledge Base

Discussions

Sort by:
The FRDM-KL25Z is an ultra-low-cost development platform enabled by Kinetis L Series KL1 and KL2 MCUs families built on ARM® Cortex™-M0+ processor. Features include easy access to MCU I/O, battery-ready, low-power operation, a standard-based form factor with expansion board options and a built-in debug interface for flash programming and run-control. The FRDM-KL25Z is supported by a range of Freescale and third-party development software. Features MKL25Z128VLK4 MCU – 48 MHz, 128 KB flash, 16 KB SRAM, USB OTG (FS), 80LQFP Capacitive touch “slider,” MMA8451Q accelerometer, tri-color LED Easy access to MCU I/O Sophisticated OpenSDA debug interface Mass storage device flash programming interface (default) – no tool installation required to evaluate demo apps P&E Multilink interface provides run-control debugging and compatibility with IDE tools Open-source data logging application provides an example for customer, partner and enthusiast development on the OpenSDA circuit Take a look at these application notes: USB DFU boot loader for MCUs Developer’s Serial Bootloader. Low Cost Universal Motor Drive Using Kinetis L family . Writing your First MQXLite Application Learn more...
View full article
Hello everyone, I have attached the audio recordings of the seminar. Each of them fits the presentations uploaded in the previous post.
View full article
Welcome to the FRDM-K64 mbed workshop, in this page you will find all the code examples we will review on this session. The program covers the following modules: GPIO Serial communication Interrupts PWM ADC I2C (Accelerometer) USB Ethernet Depending on how fast we advance during the session some of the modules might be skipped; however here you can find both the source code and binary files ready to be flashed into the FRDM-K64 development board. FRDM-K64Z120M The FRDM-K64 is fully compatible with the Arduino rapid prototyping system, the following image depicts the board's pinout, the green labels can be used directly into your mbed proyects, they have already been defined in the headers and libraries in order to make development easier. Sign up at mbed.org In order to create the projects covered on this session it is necessary to create an mbed user account, open the website and create a user account, if you have already signed up please log in. Mbed debugging application To enable the FRDM-K64 development board using the binary files generated by mbed it is necessary to update the board's firmware, follow the steps mentioned below in order to enable the board to be programmed: Press the board's reset button While pressing the reset button connect the board to your computer using the USB cable, it must be connected to the J26 USB connector. Once the unit has enumerated as "Bootloader", copy the 20140530_k20dx128_k64f_if_mbed.bin file into the unit Disconnect and reconnect the USB cable, the board must enumerate as "MBED" Serial communication driver To implement serial communication you need to install the serial driver in your computer, download the driver, once your board has enumerated as MBED execute the driver and wait for it to be finished, this might take a couple of minutes. Serial terminal In order to communicate with the board via serial port it is necessary to use a serial terminal, by default WIndows 7 and 8 do not have this application, XP does. If your OS does not feature a serial terminal, you can download the one at the bottom (Teraterm). ! Your board is now ready to be programmed using mbed!
View full article
分享自China-FAE team同事,在此谢过! 有客户需要bootloader功能,于是从网上下到最新版本的AN2295,发现里面添加了很多的内容,包括支持了很多新的器件,比如KM系列,但是真正把它在板子上跑起来,却花了2天时间,为了减少大家工作量,不在重蹈覆辙,我在这里share给大家,目前该代码在FRDM_KL25以及TWR-K60D100M上跑起来了。遇到的问题主要有如下几点: 问题1: 在工程中使用除法命令: a =a /100; 会报错: Error[Li005]: no definition for "__aeabi_uidiv" [referenced from D:\Customer\XinRuiYang\an2295sw_Kl25\src\Kinetis\IAR_6_4\Kinetis L Debug\Obj\bootloader.o] 原因是: 这里Lib选择的是None,说明没有使用任何库,所以不能使用除法。 打开库后,可能会占用比较大的空间,所以不推荐使用。 问题2: FRDM_KL25使用默认代码频率,波特率有问题,发送data = 0但是实际发送值为0x80,通过更改主频为48M,然后分频解决。附件有参考代码。TWR-K60100DM没有此问题。 问题3: FRDM_KL25板子,如果不使能BOOTLOADER_AUTO_TRIMMING这个宏,即不调用SlaveFrequencyCalibration();函数时, 代码上电不能直接运行,而使能该函数后,会一直进行校准频率,上位机无法通讯,查找代码发现: 上版代码为         #if BOOTLOADER_AUTO_TRIMMING == 1                       if(UART_GetChar() != BOOT_CMD_ACK)              {                SlaveFrequencyCalibration();              }                                        #endif 本版代码为:         #if BOOTLOADER_AUTO_TRIMMING == 1                         SlaveFrequencyCalibration();                     #endif 修改为上版代码,可以正常运行并跑起来。 但是不使能BOOTLOADER_AUTO_TRIMMING这个宏,代码依旧跑不起来,现象就是仿真时没有问题,可以正常跑起来,但是如果是上电直接运行,就不能正常通讯: 这个问题出在了USB插拔瞬间,KL25会收到一个数据,该数据并不是上位机下发的FC码,如果不使能BOOTLOADER_AUTO_TRIMMING这个宏,代码会误认为自己进入 等待上位机下发数据的状态机,导致通讯错误。在SlaveFrequencyCalibration(); 函数中,有软件复位功能,会让插拔稳定后KL25不在接收到异常数据,以此保证状态机的正确。 问题4: 仿真时全速跑起来时,指针经常回到__main,说明波特率有问题,代码进入SlaveFrequencyCalibration中,复位了。 AN2295引导MQX Keil工程 AN2295的文档已经说明如何修改CW IAR的工程以便让Bootlaoder引导,但是没有Keil工程的说明,这个就只能自己动手啦。 首先肯定会想到修改scf文件: #define USERFLASH_BASE_ADDR    0x00060000 #define INTFLASH_BASE_ADDR     0x00000000 #define INTFLASH_SIZE          (USERFLASH_BASE_ADDR - INTFLASH_BASE_ADDR) #define MY_ALIGN(address, alignment) ((address + (alignment-1)) AND ~(alignment-1)) LOAD_REGION_INTFLASH INTFLASH_BASE_ADDR INTFLASH_SIZE {     VECTORS INTFLASH_BASE_ADDR     {         vectors.o (.vectors_rom,+FIRST)         vectors.o (.cfmconfig)     }     CODE +0     {         * (InRoot$$Sections)      ; All library sections for example, __main.o,                                   ; __scatter*.o, __dc*.o, and * Region$$Table         * (KERNEL)         * (TEXT)         * (+RO)     }     RAM_VECTORS 0x1FFF0000 ; For ram vector table. Used when  MQX_ROM_VECTORS is set to zero.     {         vectors.o (.vectors_ram)     }     NOUSER +0     {         * (.nouser)     }     ROUSER MY_ALIGN(ImageLimit(NOUSER), 32)     {         * (.rouser)     }     RWUSER MY_ALIGN(ImageLimit(ROUSER), 32)     {         * (.rwuser)     }     DATA MY_ALIGN(ImageLimit(RWUSER), 32)     {         * (+RW)         * (+ZI)     }     USB_BDT MY_ALIGN(ImageLimit(DATA), 512)     {         * (.usb_bdt)     }     KERNEL_DATA_START MY_ALIGN(ImageLimit(USB_BDT), 0x10)     {         * (KERNEL_DATA_START)     ; start of kernel data     }     KERNEL_DATA_END 0x2000FFF0      ; RAM_END     {         * (KERNEL_DATA_END)     ; end of kernel data     }     ; mem_init writes a storeblock_struct at the end of kernel data,     ; max size 32 bytes, so use 0x100 offset     BOOT_STACK_ADDR 0x2000FEF0     {         * (BOOT_STACK)     } } 都是按偏移算的,应该只改INTFLASH_BASE_ADDR     0x00004000就O了,找了个最简单的工程:mqx\examples\hello,编译生成S19文件,通过bootloader下载进片子, 按reset后看屏幕,始终木有出现hello world,没办法,只能上debug了。 打开AN2295工程,加载调试环境,然后在JumpToUserApplication函数上下断点,中断后,单步执行到在__asm("mov pc, r1"); 函数,继续在汇编窗口点单步执行,之后就完全跟crack有点类似,一直点,直到芯片复位,说明之前点那一下是key point,然后对照map文件,于是找到了复位点: init_hardware->_bsp_initialize_hardware->_bsp_watchdog_disable();执行后会复位 不管啦,直接把它屏蔽掉,反正之前就已经关闭看门狗了。 重新编译,继续上。 还是没看到期待已久的hello world,肿么办? 重复上面的方法,发现又一个key point: _sched_start_internal 查看代码发现,这是一个系统call,应该是从vector 11调用的,查看下寄存器: SCB_VTOR 肿么变成0了,bootloader中已经改成0x4000了,什么时候变成0了....... 代码太多了,不知道从哪儿看起,内存断点是个好东西哈,IAR中没找见在哪儿下,算了,换Keil吧。 用Keil打开AN2295工程,加载调试,然后在0xE000ED08(SCB_VTOR )下写断点,直接run,等待中断吧: _time_set_timer_vector函数修改了SCB_VTOR, 大概路径是_bsp_enable_card->BSP_INTERRUPT_VECTOR_TABLE->BSP_TIMER_INTERRUPT_VECTOR 哈哈,找代码看看: __VECTOR_TABLE_ROM_START 是这个宏搞的鬼。 仔细对比代码,发现__VECTOR_TABLE_ROM_START 这个宏是通过条件编译区分开的,IAR是通过icf文件定义的 而Keil是通过#define 来实现的。好了,修改对应的值为0x4000,重新编译,下载,搞定,可以看到hello world喽。 总结一下,使用AN2295引导MQX Keil工程需要做以下3点修改: 1.scf文件INTFLASH_BASE_ADDR     0x00000000改为0x00004000 2.屏蔽_bsp_watchdog_disable()该函数 3.修改__VECTOR_TABLE_ROM_START为0x00004000.
View full article
On behalf of EarlOrlando​ Hello community, This document is intended to be a basic guide to get started with the eGUI. If you need a closer view about what this driver is, it is recommended to take a look into the eGUI Introduction document. Before starting, it is needed to download the library from the NXP eGUI website and it is recommended to take a look into the eGUI Reference Manual. For this document, a demo included in the eGUI drivers will be run and then modified to toggle a LED in the TWR-K70F120M board from the eGUI interface displayed in the TWR-LCD-RGB board. Contents. Introduction. 1. About this document. 2. Running the K70 demo on IAR. a. Compiling the TWR-K70F120M MQX libraries. b. Adding the SD card content. c. Download the application to the MCU. 3. Modifying the eGUI demo. a. Creating a new screen. i. Adding a new source file for the new screen. ii. Adding the screen header files. iii. Adding some macro definitions. iv. Defining screen attributes. v. Declaring the screen. vi. Defining a new string. vii. Adding the screen interfaces b. Opening the new screen. c. Creating a new button. d. Toggling the LED. 4. Conclusion. I hope you find this guide useful. Enjoy this guide, any feedback is welcome!
View full article
BSDL file for the MK20DN512VLL10.
View full article
  Hello Freedom community users Few weeks before, I produced for the Element14 community a full video review of the FRDM-KL46Z including all the steps to program and debug your first project example. Video has a length of less than 13 min so your evaluation of the Kinetis KL46 should be really quick and easy http://www.element14.com/community/community/designcenter/kinetis_kl2_freedom_board/blog/2014/06/17/frdm-kl46z-full-review-and-getting-started-in-video Enjoy Greg
View full article
I have definitely experienced some of the growing pains of using the Kinetis tools as they have underdone some changes.  I started tinkering with KDS last year when KSDK and MQX were separate packages.  I didn't mess around with it much, other than to prove that I could toggle some GPIO.  I then got more serious with KDS 2.0 and KSDK 1.1 when MQX was integrated into the installer.  I started with simple projects, and eventually got a pretty good demo put together that incorporated ethernet (using lwIP), RS485, Modbus TCP/RTU, motion control, and barcode reading.  Unfortunately, at that time there were some small issues with the KSDK 1.1 which prevented us from being able to easily write applications in C++.  I definitely think better in C++ than in C, so this was a bummer. I was quite excited when the C++ issues were fixed in KSDK 1.2.  So now I need to port my application from C to C++.  At this point, I am faced with two hurdles: Directly porting my currently-working application (written for KDS 2 / KSDK 1.1) doesn't work.  I have written some posts here about it and could use some help solving those problems. lwIP project that was working in KDS 2.0 with MQX and PEx no longer works in KDS 3.0 How do you force PEx to be totally C++ compatible? Adding HardFault handlers in KDS3/KSDK1.2? Figuring out how to call into C++ wrappers This post is about #2, where I believe I have a usable solution.  It's basically covered in Re: How to call C functions that use "restrict" keyword from C ?  but with a small twist or two.  I am currently using KDS 3, KSDK 1.2, and my project requires MQX Standard as well as Processor Expert.When you create a project like mine, you will likely go through the following basic steps: Create new project Enable KSDK and Processor Expert Change osa from BareMetal to MQX Change MQX from Lite to Standard Disable DbgCs1 Enable new fsl_uart in MQX settings and disable its pins Add OS_Task components and other PEx components Specify your CPU type in the C++ compiler settings, as shown below Generate code In addition to main.c, after you generate code, you'll also end up with os_tasks.c.  Your PEx components will have C code added to the Generated Code folder.  At this point, it should be possible to wrap components in C++ classes.  Tonight, I ran a simple test where I wanted one of my MQX tasks to blink an LED.  The LED blink code was wrapped in a simple C++ class, and in order to be able to create the C++ object to call into, you have to call it from C++ code! The solution ends up being pretty simple.  Rename main.c to main.cpp, and rename os_tasks.c to os_tasks.cpp.  Then generate code again.  Click on your Sources folder and hit F5.  You will see that main.c and os_tasks.cpp reappear, because they get re-created.  Right click on each of them and click Resource Configuration -> Exclude from Build. Click Select All, then Close.  This will prevent those files from being compiled.  Note that if you add more OS_Task components, you will need to manually update os_tasks.cpp accordingly. At this point, it's very simple to create a wrapper class and call it.  I wrote one called DebugLed.cpp: #include <DebugLed.h> #include "Cpu.h" #include "gpio_comp.h" namespace Peripherals { DebugLed::DebugLed() {   // TODO Auto-generated constructor stub } DebugLed::~DebugLed() {   // TODO Auto-generated destructor stub } void DebugLed::BlinkGreen() {   GPIO_DRV_SetPinOutput( LEDRGB_GREEN);   OSA_TimeDelay(150);                 /* Example code (for task release) */   GPIO_DRV_ClearPinOutput( LEDRGB_GREEN);   OSA_TimeDelay(150);                 /* Example code (for task release) */ } } /* namespace Peripherals */ (hopefully all of the code shows up when I post this!  I don't see all of it in the preview) Then you can instantiate the DebugLed object before the while(1) in your OS_Task: void Blink_task(os_task_param_t task_init_data) {   /* Write your local variable definition here */   Peripherals::DebugLed led; #ifdef PEX_USE_RTOS   while (1) { #endif     /* Write your code here ... */    led.BlinkGreen(); #ifdef PEX_USE_RTOS     } #endif    } /* END os_tasks */ #ifdef __cplusplus }  /* extern "C" */ #endif Build, debug, and set a breakpoint on your call into your C++ object, and it should hit it! It's a lot easier than I thought it would be.  I figured there would be more manual labor involved with the code generation aspect of it, but it seems to basically boil down to two files, and you don't even need to disable code generation for any of the PEx components, which means you can still use the GUI to change settings if necessary (even though manually changing the header is just as simple). When I get to the office tomorrow, I'll probably start wrapping more complex peripherals, but I really need to figure out the HardFault problem with my lwIP project.  If you have any suggestions, please visit my post: Adding HardFault handlers in KDS3/KSDK1.2? and comment if you can.  I hope my first document here on the Freescale Community was helpful to someone here!
View full article
Bootloader是一种面向用户应用程序的引导代码,可以在没有烧写器的情况下烧录用户程序,也可以用于在线更新程序。飞思卡尔提供了三种实现bootloader的方式,分别为: 1.预烧写在ROM中的bootloader     这种方式是MCU中内置了专用的ROM来存放bootloader,目前支持ROM型bootloader的Kinetis系列MCU包括KL03,KL17,KL27和KL43等。其中KL03和KL17的ROM bootloader包含SPI/UART/IIC三种接收方式,KL27和KL43还增加了USB的方式。 2.预烧写在FLASH中一次性bootloader     这种类型的bootloader在芯片出厂前预写在FLASH中,因此可以像ROM型bootloader一样直接使用。但与ROM型不同的是,上电后bootloader会从FLASH搬移到RAM 中运行,再将FLASH整片擦除并烧写用户程序,因此这种bootloader是一次性的。其优点是不需要片内ROM且方便量产烧写,缺点是无法支持以后的程序更新。目前支持预烧写在FLASH中一次性bootloader的Kinetis系列MCU包括K22、K24和KV3x等。 3.开放源码的bootloader     这种方式将FLASH空间分为两个部分,一部分用于存储bootloader代码;另一部分用于存储用户应用程序代码。这种方式的bootloader方便客户定制自己的代码。     目前飞思卡尔提供开放源代码的Kboot,支持UART/SPI/IIC/USB HID 几种接口方式,其网址链接为:     www.freescale.com/kboot     除了Kboot,还有以下独立版本的bootloader,包括:     1)AN2295(开发人员的串行引导加载程序)         文档下载地址为:http://cache.freescale.com/zh-Hans/files/microcontrollers/doc/app_note/AN2295.pdf         代码下载地址为:http://cache.freescale.com/files/microcontrollers/doc/app_note/AN2295SW.zip        另外FAE Yang Liang 对其进行了移植,目前已经支持FRDM-KE02,KE06,KL25,KL26,KL43,KL46, TWR-K60, KV4x, KV10.下载地址为:Kinetis/AN2295_Bootloader · GitHub     2)AN4767 (Kinetis E 系列上的UART Boot Loader 设计)         文档下载地址为:http://cache.freescale.com/zh-Hans/files/32bit/doc/app_note/AN4767.pdf         基于AN2295,没有提供代码。     3)AN4775 (Kinetis E 系列上的IIC Boot Loader设计)         文档下载地址为:http://cache.freescale.com/zh-Hans/files/32bit/doc/app_note/AN4775.pdf         代码下载地址为:http://cache.freescale.com/files/32bit/doc/app_note/AN4775SW.zip     4)AN4368 (USB 大容量存储设备主机引导加载程序)          文档下载地址为:http://cache.freescale.com/zh-Hans/files/microcontrollers/doc/app_note/AN4368.pdf          代码下载地址为:GitHub - Wangwenxue/USB_MSD_Host_Bootloader_K60: This is usb msd Bootloader for K60 (For K60)                                        GitHub - Wangwenxue/USB_MSD_Host_Bootloader_K64: This USB MSD bootloader for K64 (For K64)     5)AN4379  (Freescale USB大容量存储设备引导加载程序)          文档下载地址为:http://cache.freescale.com/zh-Hans/files/microcontrollers/doc/app_note/AN4379.pdf          代码下载地址为:http://cache.freescale.com/files/microcontrollers/doc/app_note/AN4379SW.zip     6)AN4764   (USB Human Interface Device Boot Loader for ColdFire Plus, Kinetis K, and Kinetis L MCUs)          文档下载地址为:http://cache.freescale.com/files/32bit/doc/app_note/AN4764.pdf          代码下载见附件     7)AN4370   (用于 MCU 的 USB DFU 引导加载程序)         文档下载地址为:http://cache.freescale.com/zh-Hans/files/microcontrollers/doc/app_note/AN4370.pdf         代码下载地址为:http://cache.freescale.com/files/microcontrollers/doc/app_note/AN4370SW.zip       8)AN4367   (用于 MCU 的 以太网引导加载程序)         文档下载地址为:http://cache.freescale.com/zh-Hans/files/microcontrollers/doc/app_note/AN4367.pdf?fromsite=zh-Hans         代码下载地址为:http://cache.freescale.com/files/microcontrollers/doc/app_note/AN4367SW.zip         最新的代码请到FNET官网下载:http://fnet.sourceforge.net/    9)Kinetis Bootloader to Update Multiple Devices in a Network - for Cortex-M0+         代码及文档下载地址为:https://community.freescale.com/docs/DOC-328168            
View full article
When you go with your laptop to a public place and you don't have a wi-fi connection available you can connect your cellphone in the USB port of your computer, turn on the USB tethering feature of your smartphone and you get full acess to the internet using your carrier data plan. The USB tethering uses the the RNDIS protocol and is easy to implement on a laptop.   But how to connect a Kinetis to the internet using a cellphone?   I'm sharing the the first version of the implementation I made of the RNDIS protocol.It's based in the KSDK 1.3 + MQX + LwIP and it can be used for reference in other projects. It's only a first release and I plan some additional implementation, bugfixes and support for other Kinetis boards in the near future but it already can be useful in some projects. Initially it only supports FRDM-K22F and FRDM-K64F but it can be implemented in any MCU with USB controller and enough FLASH. It's a low-cost and simple way to connect your MCU to the internet when you don't have a Ethernet cable available or an Wi-fi connection or a 4G module available in your board.   Introduction   This project implements the RNDIS protocol on the top of the USB Host Stack and in the bottom of the LwIP (TCP/IP stack). When a cellphone is connected to a freedom board, it acts as a USB device and the Freedom board acts as a host.   * Software implementation * Cellphone connected to a FRDM-K64F providing internet connection to the board   The user can design his own software in the top of the TCP/IP stack (LwIP) like if it's connected through an ethernet cable.   Demonstration   To run the demo you will need the KDS 1.3 (www.nxp.com/kds).   To load all the projects needed to your project you have to extract the .zip file and in KDS go to File -> Import, Project of Projects -> Existing Project Sets, and browse to the *.wsd file present in the folder:   USB_RNDIS\KSDK_1.3.0\examples\[your board]\demo_apps\lwip\usb_tethering_demo\usb_tethering_demo_mqx\kds   It will import all the needed project in to your workspaces so you will be able to build all the projects and flash it into your board.   With the application flashed, open a Serial terminal with 115200kbps, 8N1 for the CDC interface of OpenSDA.When the board starts, it will display:     Connect your cellphone in to the USB of the MCU. After connect the phone turn on the USB tethering feature and wait some seconds:   The Freedom Board will be connected to the internet. As an example, this demo connects to an HTTP server in the internet, download to MCU some data (Lastest news from an newspaper website) and displays it through the Serial connection.   You can modify this demo for your own application, using the TCP/IP and UDP/IP provided by the LwIP.   Typical Aplications   - Low-cost temporary internet connectivity to the MCU. - Remote updat (i.e.: bootloader through USB downloading the new firmware direct from the web) - Remote control - Remote diagnostics   Known Issues and Limitations: - This first version was only full implemented for FRDM-K22F and FRDM-K64F. I can implement for other boards through requests. - It was tested on Android Phones (Samsung Galaxy, Motorola G, Motorola X). I don't have a iPhone to test yet. - Some cellphones need additional current to detect that is attached to a host.A external power is needed in this situation.For FRDM-K64F I suggest to use the J27 footprint to provide 5V and short the diode D13. - Not all the RNDIS messages was implemented yet, only the most fundamental ones. - There's a flash size limitation due the size of the TCP/IP stacks ( that requires a considerably space of flash). It can adapted in the future for stacks with smaller footprint. - Only support KDS 3.0 at this time. And it only supports MQX at this time.   Let me  know if you have any question. Hope it can be useful!   1-      With the application flashed, open a Serial terminal with 115200kbps, 8N1 for the CDC interface of OpenSDA.When the board starts, it will display:
View full article
  1 Introduction    Previously we used sd card to upgrade the program. We have to insert the sd card into the computer every time, copy the program to the sd card, and then insert it into the sd card slot of mcu to update the program. This method seems to be a bit troublesome, so we implemented a more convenient method. It no longer needs to insert or remove the SD card from PC and MCU. Use the usb function of mcu to recognize mcu as a storage U disk. When we need to update the program, connect the MCU’s usb interface to PC. After the computer recognizes it, copy the program that needs to be burned in. Then the bootloader will recognize the file and then upgrade the application. Bootloader detects changes of the file, not the existence of the file. In other words, if the a000.bin file has already existed in the sd card, the application will not be updated. When this a000.bin is overwritten with another a000.bin, the operation of updating the application will be performed.   2  Bootloader’s implementation The schematic for SD card is shown below. The board uses SDHC module to communicate with SD card.                                                  Figure 1. Figure 1.Schematic for SD card   We use the 2.6.0 version of FRDM-K64F’s SDK. You can download the SDK in our website. The link is “mcuxpresso.nxp.com”.   The schematic for USB is shown below.                                                                                                        Figure 2. Schematic of USB   Bootloader uses SDHC, fatfs, usb, flash, So we should add files to support them. Our code is based on the example “usb_device_msc_sdcard_lite” that belongs to usb example.   In main code, the program will initialize the usb, sd and fatfs. Then the computer will communicate will MCU. Finally, PC will recognize the mcu as a u-disk.                Figure 3.u-disk The method of how to update the program and prepare the application has written in this document. You can refer it. https://community.nxp.com/docs/DOC-344903   Use a variable “wrFlag” to check the modification of the file. When we put file into the u-disk, this variable will be set.                                           Figure 4. Modification of flag When this variable is set, the program will open the “a000.bin”. Then update the application. Finally, go to the application.                      Figure 5. Update the application   3  Run the demo     Download this bootloader     Prepare a user application program. We use the “led blinky” as an example. Use it to generate the binary file. Name it as “a000.bin”. Put it into the u-disk. You will see some log in the uart.       The application will execute automatically
View full article
As general introduction on thread https://community.freescale.com/docs/DOC-328302 , I did a smart LED application with GoKit and FRDM-KL02. In this design, FRDM-KL02 will communicate with GoKit by WIFI, and control LED flash. Code Structure Code Basic Introduction In this project structure, you need to do following items on code. ü Add your functions, such as UART, LED, motor driver code. ü Add function running functions in protocol.c ü Add functions order in main loop. You can find my main.c and protocol.c as attachment. In this document, I would like to detail introduce function MessageHandle(), void MessageHandle(void) {                 pro_headPart    tmp_headPart; //Common command package                 memset(&tmp_headPart, 0, sizeof(pro_headPart));                 if(get_one_package)                 {                                                                              get_one_package = 0;                                 memcpy(&tmp_headPart, uart_buf, sizeof(pro_headPart));                                                                 //CRC error, send back error command                                 if(CheckSum(uart_buf, uart_Count) != uart_buf[uart_Count-1])                                 {                                                 SendErrorCmd(ERROR_CHECKSUM, tmp_headPart.sn);                                                 return ;                                 }                                 So, you can see that only get_one_package=1, we can receive frame completely.                                 switch(tmp_headPart.cmd)                                 {                                                              case       CMD_GET_MCU_INFO:                                                                 CmdGetMcuInfo(tmp_headPart.sn);                                                                                                                                     break;                                                                   case CMD_SEND_HEARTBEAT:                                                                 SendCommonCmd(CMD_SEND_HEARTBEAT_ACK, tmp_headPart.sn);                                                                                 break;                                                 case CMD_REBOOT_MCU:                                                                 SendCommonCmd(CMD_REBOOT_MCU_ACK, tmp_headPart.sn);                                                 case       CMD_SEND_MCU_P0:                                                                 CmdSendMcuP0(uart_buf);                                                                 break;                                                 case       CMD_REPORT_MODULE_STATUS:                                                                 CmdReportModuleStatus(uart_buf);                                                                 break;                                                 default:                                                                 SendErrorCmd(ERROR_CMD, tmp_headPart.sn);                                                                 break;                                 }                              } } After that, you can do operations mentioned in thread https://community.freescale.com/docs/DOC-328302. You can see smart LED device and been found.
View full article
This file was uploaded by the AN4652 author, and is changed from the original release. As far as I can see this file is not in the current zip for the appnote as of apr 25 2013
View full article
系统框图如下图示: 硬件设计支持如下扩展功能: (1)      USB、SD卡(SDHC接口) (2)      SWD调试+串口Printf。 (3)      SPI外设接口,支持NRF24L01、W5100、WIFI等。 (4)      两路差分ADC输入、一路DAC输出。 (5)      50M有源晶振,供MCU以及以太网PHY工作。 (6)      32.768K RTC时钟晶振。 (7)      SPI Flash、EEPROM(IIC接口) (8)      CAN接口。以太网应用。 (9)      TSI电容触摸按键。 (10)  GPIO:按键输入以及LED输出指示。 (11)  PWM输出。 (12)  FlexBus总线扩展: 扩展应用一:4.3寸LCD。 扩展应用二:FPGA扩展高速ADC采集。(设计进行中) 基于K60+SSD1963驱动4.3寸屏并移植ucGUI的测试实例,移植后的视频效果见如下链接: http://v.youku.com/v_show/id_XNzAwMTE5OTA0.html?firsttime=15 Pixels/sec: 16397220。
View full article
Our debug firmware is generally downloaded from the official website of nxp. nxp.com/opensda. But sometimes we want to modify the source code of bootloader and firmware according to our own requirements. So we introduce the open source project daplink. Arm Mbed DAPLink is an open source software project that can program and debug application software running on the Arm Cortex CPU. DAPLink is usually called interface firmware, and it runs on the auxiliary MCU connected to the SWD or JTAG port of the application MCU. It provides k20 bootloader and interface firmware and k26 bootloader and interface firmware. Many frdm boards use k20 as a debugger, and a few boards use k26 as a debugger. board:FRDM-K64 OS:WIN10   steps: 1.Install git, python2.7.11 or above, add these two software to the computer system environment variables (required), it is best to add the scripts folder under python to the environment variables, and install keil.  DAPlink currently only supports IDE keil. 2.Use python to install pip, you can search for tutorials online 3.Install virtualenv, use powershell (hold down shift and click the right mouse button), Input ‘pip install virtualenv’ 4.After that, the commands are all completed under powershell. Get the source code. Input ‘git clone https://github.com/mbedmicro/DAPLink’ Note: You must use git to download the code, or you will fail at compiling the code. It Will generate a DAPLink folder in your current directory 5.Enter the directory. Input ‘cd DAPLink’, The docs/DEVELOPERS-GUIDE.md under this folder is more detailed how to use this DAPLink 6.Create a virtual environment,Input ’virtualenv venv’ 7.Input ‘venv/Scripts/activate.bat’ to active the virtual environment 8.Install necessary tools,’pip install -r requirements.txt’ 9.Generate keil project, input ‘progen generate -t uvision’ It will generate projectfiles/uvision, enter the folder and you will find various bootloader and firmware. The name with ‘bl’ is the bootloader, and the name with ‘if’ is the interface firmware, which is to be dragged into the mcu. Open the first project about k20. After compilation, a bin file will be generated. The bin file with crc is what we want to burn or drag. For the name ‘if’ is the same. The git command will be called during compilation. If you do not add this command to the environment variable, the compilation will fail. This is the bootloader source code Bin file This is interface firmware. The generated bin file with ‘0x’ is firmware address. Generally, the default firmware address of the DAPLink bootloader is 0x8000. As you can see from the above figure, this macro defines DAPLINK_ROM_IF_START, so the file we want to drag is the file with the name ‘0x8000’. If the firmware start address is modified in the bootloader, the interface firmware should also be modified accordingly Burn the bootloader into k20, then drag the interface firmware into k20 to see this result.  
View full article
最近搞了一个基于TWR-K20D50M的的USB MSD device bootloader, 可以打开文件夹CW中的K20D5下的.project来查看。 在原始的MSD的基础上移植了FAT过来。 其他IAR和Kinetis的其他chip没有测试,如果需要使用,一个是新增相关头文件,二是在bootloader.h中修改相应的MCU_K20D50M定义下的flash及ram配置
View full article
下面简单介绍下Kinetis M0+相关的几大系列MCU: 1. Kinetis L    Kinetis L系列MCU的最大特点是它具有非常出色的低功耗特性,L系列目前包含KL0X、KL1X、KL2X、KL3X、KL4X和KL8X六个子系列,除了KL8X的主频为72 Mhz以外,其他主频都为48 Mhz。KL0X系列是入门级MCU,它的Flash相对较小,引脚数量相对较少。KL1X系列是通用型MCU,KL2X系列带有USB功能,KL3X系列支持段式LCD,KL4X系列同时带有USB和支持段式LCD。KL8X系列具有很多Security相关的特性,包括篡改检测、真正的随机数生成器和低功耗可信加密引擎,支持AES、DES、3DES、SHA、RSA和ECC。 2. Kinetis E    Kinetis E系列MCU的最大优势是电磁抗噪性能,Kinetis E系列是业界首款在Cortex M0+基础上构建5V (2.7~5.5V)MCU系统的产品,结合了低成本、高性能、先进的EMC和ESD保护功能,E系列目前包括KE02、KE04和KE06三个子系列,KE02主频有20M和40M两种,KE04和KE06都为48M,KE06相比KE02和KE04主要是多了1个CAN接口。 3. Kinetis V    Kinetis V系列MCU专为BLDC、PMSM和ACIM电机控制以及数字电源转换应用而设计。V系列目前包含KV1X、KV3X、KV4X和KV5X四 个系列,其中Kinetis KV1X系列是入门级产品,Cortex-M0+内核,采用75 MHz M0+内核及硬件平方根和除法模块,与同等级32位MCU相比,在无传感器PMSM控制应用中的性能提高27%。 4. Kinetis W Kinetis W系列集成了领先的Sub-GHz和2.4 GHz射频收发器,可创建可靠、安全、低功耗的嵌入式无线解决方案。W系列目前包含KW0X、KW2X 、KW3X和KW4X四个系列,其中KW0X是M0+内核,48 Mhz,Sub-GHz无线电,超低功耗无线微控制器,KW3X是M0+内核,48 Mhz,具备Bluetooth® Smart/Bluetooth® Low Energy (BLE) v4.1射频连接。KW4X也是M0+内核,具备Bluetooth® Smart/Bluetooth® Low Energy (BLE) v4.1和IEEE® 802.15.4-2011射频连接。 5. Kinetis M      Kinetis M系列 MCU适用于单芯片1、2和3相电表和流量计,以及其它高精度测量应用。M系列目前包括KM1X、KM2X两个系列,KM1X主要用作计量,KM3X不仅具有计量功能,同时还有段式LCD控制器。 选型的方法主要有以下几种: 1)如果您已经知道要查找的产品的基本信息,最常用的方法是在飞思卡尔官网主页进行查找; 2)如果您并不清楚需要查找的芯片基本信息,飞思卡尔还提供了一些辅助的选型工具来帮助用户进行芯片的选型,包括:i)参数选型工具;   ii)选型神器Cross Check;  iii)解决方案顾问; 具体的选型操作流程可以参考:针对飞思卡尔单片机的快速上手指南中的2.2小节,其中有非常详细的介绍。
View full article
Here you can find both the code and project files for the Serial communication project, in this example the serial port (UART) is configured to establish communication between the computer using a serial terminal and the evaluation board. The default baud rate for the serial port is 9600 bauds. The code also implements an echo function, any key pressed in the computer's keyboard will be captured and displayed in the serial terminal. If your computer does not have a serial terminal you can download Tera Term from the following link: Tera Term Open Source Project The communication is established through the USB cable attached to the OpenSDA USB port. Code: #include "mbed.h" //Digital output declaration DigitalOut Blue(LED3); //Serial port (UART) configuration Serial pc(USBTX,USBRX); int main() {     Blue=1;     pc.printf("Serial code example\r\n");        while(1)     {         Blue=0;         pc.putc(pc.getc());     }    }
View full article
Hello. I am trying to use a PIT interrupt. I had never used Kinetis so there are certain things which with I am not familiarized yet. once i have created de PE code, cleaned and then I build the proyect, the following error pops up 'undefined reference to int_disp'. What it is about? Where should I write my ISR fuction? Does the ISR pit function has to have an specific name so as to be recognised by PIT.c?
View full article
Microgenios viabilizou a realização de videos de treinamentos de curta duração para ensinar os primeiros passos com o microcontrolador Kinetis L como parte do Road Show de Microcontroladores ARM cortex-M0+ (Kinetis L Freescale), projeto realizado em parceria pela a Freescale em 10 cidades espalhadas pelo Brasil. Veja os videos para iniciar seu projeto com Kinetis L: Neste vídeo aprenderemos o processo de download e instalação do CodeWarrior V10.3 e outros pacotes de softwares Freescale: http://www.youtube.com/watch?v=bjtsLHMImDY Neste vídeo aprenderemos o processo de atualização do CodeWarrior V10 (baseado no Eclipse) e conheceremos as pastas criadas na instalação: http://www.youtube.com/watch?v=Sslf0nF0Td8 Neste vídeo conheceremos a ferramenta de hardware Freedom Board da Freescale com microcontrolador ARM cortex-M0+; e entenderemos a utilização da interface de gravação e depuração OpenSDA: http://www.youtube.com/watch?v=jeuq7ErvTGQ Neste vídeo aprenderemos a criar nosso primeiro projeto com a Freedom Board (FRDM-KL25Z), que possui microcontrolador da família Kinetis L (núcleo ARM cortex-M0+) da Freescal; utilizaremos como ferramenta de software o CodeWarrior V10.3 e o Processor Expert: http://www.youtube.com/watch?v=sx2tpDBWDt8 Neste vídeo conheceremos a IDE cloud mbed, que possibilita desenvolvimento e aplicações diretamente no navegador: http://www.youtube.com/watch?v=N7qMvO_R6Sc Mais informações visite: http://www.microgenios.com.br/website/index.php/hands-on-freescale
View full article