Kinetis Microcontrollers Knowledge Base

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

Kinetis Microcontrollers Knowledge Base

Discussions

Sort by:
Example of integrating CMSIS3.20 into MQX4.0.x on the TWR-K70F120M (with floating point unit) using CW10.4 using the MQX4.0.2\mqx\examples\hello2 project. In the attached ZIP file (hello2twrk70f120m_CMSIS_FPU.zip) is a MSWord document detailing the steps used.  That document name is TWR-K70F120M_CMSIS_CW10.4_MQX4.0.x.docx. Regards, David
View full article
Example of integrating CMSIS3.20 into MQX4.0.x on the TWR-K60D100M (no floating point unit) using CW10.4 using the MQX4.0.2\mqx\examples\hello2 project. In the attached ZIP file (hello2twrk60d100m_CMSIS_NoFPU.zip) is a MSWord document detailing the steps used.  That document name is TWR-K60D100M_CMSIS_CW10.4_MQX4.0.x.docx. Regards, David
View full article
You probably have heard of what's new on Kinetis side of the house. YES, talking about KL02, measuring only 1.9mm x 2.0mm. Take a look at the picture in which this powerful ARM based chip gets compared real scale, and being this tiny yet delivers 60 percent more GPIO than the nearest competing MCU. :smileygrin:!!!
View full article
Introduction This document is being written to communicate the need for serialization of memory operations and events in an end application.  In addition, directions will be provided to properly serialize memory operations in the end application.  Memory operations and event serialization applies to all Kinetis devices but is only necessary in specific scenarios. These scenarios include memory writes and reads, clearing status flags, and changing mode control operations. Serialization of memory operations Serialization of memory operations or events is the action of guaranteeing that said memory operations or events are executed in a specific order.  This action is required when making a change to a peripheral module when that change must complete before continuing with program execution.  Users often make the mistake of assuming that since a peripheral register has been written to, the change is in effect immediately.  However, this is not always the case.  The Kinetis series devices implement a crossbar and peripheral bridge interface system that allows masters (the CPU, DMA, etc.) to interface with the peripherals.  The crossbar allows multiple masters to access the individual peripherals on the bus, and the peripheral bridge functions as a bus protocol translator between the crossbar switch and the slave peripheral bus.  Wait states can be inserted at either stage of the communication channel (crossbar or peripheral bridge).  When a master attempts to access a slave and another master is already accessing this slave or the slave is busy, wait states will be inserted.  If the access is a write, then the master's write is simply pushed to the peripheral bus and the master continues.  However, if the access is a read, the master must wait for a response from the slave.  The slave may insert wait states in this communication as it must finish any commands (or writes) it was previously given before responding.    Peripheral module changes that require serialization actions include clearing interrupt service flags, changing power modes (of the module or the SOC as a whole), or software triggering a hardware event.  If the events or memory operations are not serialized in these situations, the CPU could go on to execute code with undesired effects. When do I need to serialize my memory operations and events? Memory operations and events require serialization anytime the program needs to guarantee that a peripheral access happens before code execution continues.  Examples of these situations includes: Exiting an interrupt service routine (ISR) Changing a clock mode or power mode Configuring a function Configuring a hardware change Software triggering a hardware event How do I serialize my memory operations and events? Memory operations are serialized by performing the following operations: Write the desired peripheral register Read the peripheral register that was just written Continue with the subsequent operations By simply reading the register that was just written, the core is forced to wait for a response from the peripheral module that was written before code execution can continue.   In this manner, it is guaranteed that the peripheral module will have completed the desired operations. Example event serialization The following is an example of a function that services the LPTMR ISR flag and implements the event serialization discussed in this document.  void lptmr_isr(void) {   // Declare dummy variable to store the read of the LPTMR0_CSR register volatile int dummy_var; /****   STEP #1  ****/   // Clear the flag; enable interrupts; enable the timer   LPTMR0_CSR = ( LPTMR_CSR_TEN_MASK | LPTMR_CSR_TIE_MASK | LPTMR_CSR_TCF_MASK  );   /****  STEP #2  ****/    // Store CSR register in dummy_var to serialize the clearing of the TCF flag   dummy_var = LPTMR0_CSR; } Conclusion In conclusion, there are situations where code execution can continue before a peripheral change has taken effect. These situations include clearing interrupt service flags, changing power modes (of the module or the SOC as a whole), or software triggering a hardware event.  Sometimes these events can cause unexpected results or even cause your application to crash.  These situations call for the serialization of memory operations and events, which is simply the act of guaranteeing that events and code are executed in a specific order.  To serialize memory operations, simply follow these directions: Write the desired peripheral register Read the peripheral register that was just written Continue with the subsequent operations Following these steps, you will be guaranteed that peripheral configurations have taken effect before continuing with the application. 
View full article
Basic explanation of the ADC module. Explicación básica del modulo de ADC.
View full article
I2C (Inter-Integrated Circuit) Module by Alejandro Lozano, Freescale TIC. i2C Protocol Explanation. Connection Diagram. How to configure the registers. Hands-On. Presentación del módulo de I2C (Inter-Integrated Circuit) por Alejandro Lozano, Freescale TIC. Explicación del Protocolo I2C. Diagrama de conexión. Explicación de cómo configurar los registros. Hands-On
View full article
UART Presentation (universal asynchronous receiver/transmitter) by Ali Piña, Freescale TIC. Module Explanation Connection Diagram Hands-On. Polling mode. Interrupt Mode. Presentación de UART  (universal asynchronous receiver/transmitter) by Ali Piña, Freescale TIC. a.       Explicación del modulo. b.      Diagrama de conexión. c.       Hands-On. Modo de Poleo Modo de Interrupción
View full article
Nested Vectored Interrupt Controller Module by Vicente Gómez Freescale TIC. NVIC Explanation Hands-on IRQ using a pin. Interruption timers. Presentación de la NVIC (Nested Vectored Interrupt Controller) por Vicente Gómez, Freescale TIC. Explicación de la NVIC. Hands-On IRQ usando un pin. Timers con interrupción
View full article
This is a presentation used to explain the Low Power Timer adapted by Vicente Gómez, Freescale TIC. LPTMR Module Explanation. Connection Diagram. Operation Modes Hands-On Configure a timer so that it generates an interruption every x time.  Explicación del Low Power Timer presentado por Vicente Gómez, Freescale TIC.- Explicación de los Modulos LPTMR . Diagrama de conexiones. Modos de operación Hands-on Configurar un timer para que genere una interrupción cada X tiempo.
View full article
The Multipurpose Clock Generator module explained by Ali Piña, Freescale TIC. MCG Module Explanation Connection Diagram Operation Modes Hands On Toggle a LED in FEI (FLL engaged Internal) switch to PEE (PLL Engaged External). Watch changes. Switch from different operation modes. El Módulo de MCG (Multipurpose Clock Generator) presentado por Ali Piña, Freescale TIC. Explicación del Modulo MCG. Diagrama de conexiones Modos de operación. Hands-On Togglear un LED en modo FEI (FLL engaged Internal) y cambiar a PEE(PLL Engaged External). Observar cambios. Moverse entre varios modos de operación
View full article
General Purpose Input/Output module presented by Jose Maria Casillas, Freescale TIC. Module explanation and alternative pin´s functions. Short explanation on the Bit Manipulation Engine (BME). Hands-On: LED RGB. Push Button. Módulo GPIO (General Purpose I/O) presentado por Jose María Casillas, Freescale TIC. Explicar el modulo y las funciones alternativas de los pines. Breve descripción del Bit Manipulation Engine (BME). Hands-On: LED RGB. Push Button.
View full article
Intro to Cortex-M0+ main features presented by Alejandro Lozano, Freescale, TIC. Intro to Cortex M0+. Kinetis L series description. Introducción al Cortex-M0+. Principales características presentadas por Alejandro Lozano, Freescale TIC. Introducción al Cortex-M0+ Descripción de la familia Kinetis L.
View full article
update of the FreeMASTER component
View full article
中文版:     想到过使用飞思卡尔的Freedom平台当做昂贵的J-Link调试器吗,好吧,这次给你机会了,呵呵。昨天在去SEGGER官网查资料的时候看到了一个suprise,Segger刚刚为OpenSDA平台release了一个可以兼容Jlink功能的firmware。说白了,就是借用OpenSDA当做J-Link用,当然有部分功能是有所限制的,不过瑕不掩瑜,Jlink的高速、稳定及一些特有的功能一直让接触过它的开发者印象深刻,所以能用low-cost的OpenSDA实现高性能的Jlink实在是让人兴奋,包括在下,哈哈,所以还等什么,赶紧露胳膊抹袖子整整吧,呵呵~     其实这次SEGGER提供的firmware就是OpenSDA的一个Application(我已经上传到本博客最后的附件中了),类似MSD-APP和DBUG-APP等其他的OpenSDA应用,所以它的使用方法类似,具体可以参考我之前的一篇博客《尝鲜OpenSDA方式调试仿真Freedom平台》http://blog.chinaaet.com/detail/31795.html。     (1)将firmware更新到OpenSDA的平台之后,再回到normal mode,这样就可以把OpenSDA当J-Link用了。将硬件连接好之后,打开J-Link Commander,弹出的窗口如下图所示,看吧,有点如假包换的J-Link味道了吧,呵呵,而且还有正版的S/N序列号哦。     (2)当然在IAR环境下使用它还需要简单的设置几步,如下图所示,建议不使用flash loader而是使用jlink自带的调试下载引擎,更稳定且速度杠杠的,呵呵:     (3)一切都准备好之后,就可以按照J-Link的调试方法调试Kinetis了,呵呵。当然有个最大的好处是,借用J-Link的特性,使用OpenSDA也可以支持Live watch了,可以实时更新观察变量,这点灰常灰常给力,如下图: Limitations:     当然我们也会猜到SEGGER不会那么蠢到自断财路(OpenSDA平台可是非常low-cost的),不然谁还会用那么昂贵的正版J-Link啊,呵呵。所以使用SEGGER提供的这个firmware有以下几点限制: 1)只能用在飞思卡尔平台基于ARM的产品上; 2)只可以调试飞思卡尔的评估板,所以貌似如果用在自己画的板子上可能有问题; 3)还有一个比较遗憾的,那就是不支持使用J-Flash软件(我一直觉着J-Flash很好用); 4)SEGGER不提供技术支持(这个我觉着无所谓)。     总体来说,还是利好的消息的,我还是灰常灰常看好OpenSDA的应用前景的,连SEGGER都低头兼容了,看来飞思卡尔以后调试器短板有望得到弥补,加油吧,呵呵。     不聊了,附件为更新的固件,未完待续~ /*****************************************************************************************************************************************/ English Version:    It feels realy good to see that SEGGER has offered a firmware running on the FRDM OpenSDA platform which makes OpenSDA compatible to J-Link lite, allowing users to take advantage of most J-Link features. It means we can do the same things with high-performance by using the low-cost OpenSDA platform. 1) How to do?    The J-Link firmware SEGGER offered is just an OpenSDA Application, so put the FRDM board into Bootloader mode and update the firmware, which is enclosed in the attached, just like other OpenSDA applications. Then put it into normal mode and the J-Link driver will be installed. Open the J-Link Commander, and we will see the diagram below. In IAR IDE, some setup steps need to follow: 2) Why to do?     Most inland customers get used to J-Link to debug ARM based products since ARM7 time and the J-Link is realy good debugger by my experience, althougn the legal J-Link is expensive. So we can help the customer to develop and evaluata products with low-cost OpenSDA platform.    In addition, live watch in IAR, which can update the varibles in time, is only supported with J-Link engine, which is very important to customer.   3) Limitations     May be used with ARM based Freescale devices only;     Only debugging on evaluation boards is allowed. Debugging on custom hardware is not supported and not allowed;     No production flash programming support;     Unlimited breakpoints in flash available for evaluation only;     No support is given. 4) Suggestions     OpenSDA is a very potential platform. USBDM has also released a firmware which is compatible to OpenSDA recently. So an open source OpenSDA  release from P&E is expected and to help customer to custom their own debugger hardware, which can help us to extend our Kinetis products more convenient. Voila, just give a try!
View full article
Hi, I have a project created by Processor Expert and CodeWarrior 10.2 for TWR-K20 demo kit. Becasue I have some problem to use the Processor Expert USB HID Keyboard Host of the USB stack 4.1.1, I need to change to add the non-PE USB HID Keyboard Host into the project. Can anyone tell me how to do it? It will be very appreciated to give me a simple 'PE' example project, and add the non-PE USB HID keyboard host stack. Thank you! Stanley
View full article
Update of FreeMASTER component for PE
View full article
Hello Community fellows! This time I would like to thank BlackNight for giving us great material to work on. There have been several posts inquiring the uses of USB stack and Processor Expert. The examples he has worked on and now shares with all of us, include this and many more useful concepts that you'll find interesting with the use of boards. For this issue he turns his FRDM-KL25Z into a generic USB keyboard device. With a simple button press he is able to send any keyboard actions to his laptop, making such as ‘print screen’ a single button press...isn't that amazing? :smileygrin: Well, I'll say no more, you better check it out yourself!  MCU on Eclipse by Erich Styger
View full article
Recently, some customers have provided us with feedback stating they have been experiencing difficulties when connecting  Kinetis L series  microcontrollers using Multilink Universal probes, after checking the connection and software settings no obvious errors could be found. This recurrent problem has been confirmed by several customers, the  problem is caused by a long connection line. My suggestion is to keep connection line length to 10cm or less; otherwise, the IDE may not be able to establish the connection through the Multilink Universal.
View full article
Hi, all The default AN2295 UART bootloader doesn't work well on K21/other Kinetis because of using FEI and complicated autocalibration mechanism. I made a simple version to make it works on MK21DX128VMC5, FYI. Readm.txt: UART bootloader for K21. (Default is MK21DX128VMC5) 128KB_Pflash_64KB_Dflash.icf is application link script example for MK21DX128 used together with UART bootloader, UART bootloader use 0x0 - 0xFFF. Q: Why need this patch? A: The original AN2295 use internal RC and FLL output as system clock. The calibration mechanism is not stable. The main change of this patch is to use external cystal plus PLL as system clock to communicate with PC software. Changes to AN2295 1) Add MK21D5.h for K21 support 2) Add AN2295_TWR_K21_cfg.h for K21 support(Copy from AN2295_TWR_K60_cfg.h) 3) AN2295_TWR_K21_cfg.h    1> #define KINETIS_MODEL K21_50MHz    2> #define KINETIS_FLASH FLASH_128K    3> #define BOOT_UART_BASE UART2_BASE_PTR       #define BOOT_UART_GPIO_PORT PORTE_BASE_PTR       #define BOOT_UART_GPIO_PIN_RX   17       #define BOOT_UART_GPIO_PIN_TX   16    4> #define BOOT_PIN_ENABLE_NUM        7 4) Add mcg folder and mcg.c/mcg.h 5) kinetis_params.h:    1> Modify SRS_REG/SRS_POR_MASK/INIT_CLOCKS_TO_MODULES to meet MK21D5.h    2> Add PORT_PCR_PS_MASK for BOOTLOADER_PIN_ENABLE_INIT to enable Pull-up. 6) bootloader.h: #define BOOT_WAITING_TIMEOUT 500. PC software can't communicate to bootloader if only 1s delay. 7) bootloader.c:    1> #include "mcg.h"    2> Use 25MHz PEE:       SIM_CLKDIV1 = ( 0    | SIM_CLKDIV1_OUTDIV1(1)                            | SIM_CLKDIV1_OUTDIV2(1)                            | SIM_CLKDIV1_OUTDIV4(1));             (void)pll_init(8000000,       /* CLKIN0 frequency */                      LOW_POWER,     /* Set the oscillator for low power mode */                      CRYSTAL,       /* Crystal or canned oscillator clock input */                      4,             /* PLL predivider value */                      25,            /* PLL multiplier */                      MCGOUT);       /* Use the output from this PLL as the MCGOUT */    3> Restore to FEI mode before jump to Application:       pee_pbe(8000000);       pbe_fbe(8000000);       fbe_fei(32768); Knowing issues: 1) Don't use virtualCOM from OSJTAG, it's very hard to communicate with PC software. Use RS232 in TWR-SER2. 2) BOOTLOADER_CRC_ENABLE must be 0, otherwise PC software will report unknown protocol version
View full article
在EEfocus上有一个关于Debug模式和正常工作模式下进入低功耗模式的问题,总结了一下,Post过来Share给大家。 问题现象:使用串口接收中断,主函数进入睡眠。在调试过程中发现:只有在连接jlink调试下,串口可以正常收发数据,串口收到数据可以唤醒mcu。但在断开jlink情况下,不能正常收发数据。 所做尝试:尝试过不在VLPS模式下,串口是可以正常中断接收数据的,也可以正常发送数据。另外,在使用过程中采用的是内部晶振,串口的时钟源是FLL。 主函数代码: while(1) { enter_vlps();  //进入vlps模式 out_char(c); //串口接收中断函数把字符赋给c } 解答: 首先,在VLPS模式下,FLL不能工作,也就无法输出clock时钟到UART,所以进入VLPS模式后UART不可以用FLL做时钟。 其次,在连J-Link调试时其实没有进入VLPS模式,而是进入了STOP模式,此时FLL是有输出的。在数据手册上的MDM-AP Status Register部分关于LP有讲到:Usage intended for debug operation in which Run to VLPS is attempted. Per debug definition, the system actually enters the Stop state. 所以造成了连接J-link从表面上看起来是进入了VLPS模式(其实是进入Stop模式),不连接J-link就无法正常工作了。
View full article