Kinetis microcontrollers from NXP-Freescale for embedded electronics. We discover for ourselves


    From time to time, the need to change something also embraces me. And most often I change the microcontroller family in my designs. And I'm not alone in this. Every year, at least 50% of developers change the processor on which they will carry out the following projects. This time I decided to try the Kinetis family.

    Kinetis is a family of low-consuming 32-bit microcontrollers based on ARM Cortex-M0 / M4 / M7 processor cores, without MMU, with a core frequency of up to 240 MHz. The absence of MMU means that Kinetis is not intended for operating systems like Windows, QNX, Android, iOS. These microcontrollers are designed to execute hard real-time systems code as part of a variety of embedded devices, from cardiac implants to electric car controllers. Although there are Linux builds to run on Kinetis.

    Where can I use Kinetis?


    Freescale could list many applications. But for myself, I have identified the following: industrial controllers, frequency converters with vector without touch control, thyristor regulators, voltage converters, network analyzers, programmable logic controllers for control systems for elevators, elevators, conveyors and other mechanisms with many drives. A promising topic for Kinetis is the Internet of things and smart sensors. And finally, it would be nice to try them in multicopter and other robotics.

    What is interesting in Kinetis?


    The closest competitors to Kinetis are the microcontrollers of the families: STM32F4 , LPC4000 , XMC4000 , SAM4S, and some less well-known ones. For some time, competitors have also been offering solutions with the ARM-Cortex-M7 core. In general, they also do not stand still.

    According to the 2014 Embedded Market Study, the most popular 32-bit family in the world is STM32. Therefore, further emphasis will be on the capabilities of Kinetis which are not in STM32.

    In the figure below, I depicted a block diagram of a senior member of the Kinetis family of the MK70FN1M0VMJ15 chip. It is a little more detailed than is customarily portrayed in Freescale descriptions to emphasize the characteristic features of Kinetis. In brackets are given the names of the blocks used in company descriptions.


    And here are the main advantages of Kinetis: - the

    breadth of the nomenclature . In terms of breadth of nomenclature, Kinetis is not inferior to STM32 and even surpasses. Kinetis includes the smallest chips in the world (2.0 x 1.6 mm) on the ARM core and advanced MK70 chips with 256 pins and the ability to connect DDRAM, similar to which STM does not.

    -great adaptability to harsh operating conditions. The family has chips with a supply voltage of up to 5.5 V. There are chips specifically for automotive applications with increased immunity to electromagnetic interference. In addition, in the periphery of the microcontrollers of the entire family, many hardware solutions have been implemented to increase noise immunity. Fault tolerance is ensured by: -
    up to five independent clock generators, three of which on external quartz resonators, - an
    independent generator for a watchdog timer, -
    two types of
    hardware filters on all digital inputs, - access control to various peripherals, the ability to manage task rights,
    - an unauthorized access detector for a variety of events, a
    special reset signal of external devices by a separate watchdog timer,
    - the possibility of snapping some peripherals to protect against subsequent changes before turning off the power; -
    flexible management and prioritization of bus switches
    , etc.

    -extensive programming and debugging mechanisms. Flexibility and convenience of debugging are the common virtue of all microcontrollers based on the ARM Cortex M core. As the aforementioned survey shows, developers of all tools in their work pay most attention to debugging tools. And even the high popularity of STM32, I would attribute it to the availability of the JTAG / SWD debugger for these chips, which is immediately integrated into debug boards based on STM32. Kinetis also has a special serial SPI-compatible programming interface - EzPort. EzPort allows you to program chips without a JTAG adapter at high speed, and also simplifies the reprogramming of one chip by another in a multiprocessor system. No hidden downloaders or hidden code like in LPC or STM32.

    - a large volume of application libraries. At Freescale application libraries are distinguished by their thoroughness and openness. What is only their library for working with the ZigBee protocol? This is probably the best ZigBee stack implementation available in source. Next, of course, comes the engine control library. Currently, Freescale is expected to release an updated and expanded software package for the development of engine management systems on Kinetis. There is a library for building graphical user interfaces eGUI, a library for developing touch panels and keyboards, a library for supporting medical communication protocols, a library for supporting the security standard IEC 60730-1: 2010, libraries for cryptographic functions optimized for hardware accelerators, and libraries for connecting protocols to cloud services etc. And that's not counting the software that accompanies the real-time operating systems for Kinetis, which are listed below. Separately, it is worth mentioning the various boot loaders, as well as the FreeMaster tool, which is very useful for the developer, which is essentially an implementation of the oscilloscope module integrated into the microcontroller with the function of a logger and command control.

    - the availability of effective free development tools. Without free development tools, this Kinetis article would make little sense. Yes, for Kinetis there is a highly developed free development environment based on the Eclipse project and the GCC compiler called Kinetis Design Studio IDE. This powerful environment contains a high-quality source code editor, compiler, basic libraries, a microcontroller peripheral graphical configurator (analogue of STM32CubeMX for STM32 microcontrollers), an automatic generator of template projects and source texts, an SDK with a full set of drivers for all peripherals, a symbolic debugger-programmer based on various JTAG / SWD adapters with plug-ins for debugging operating systems and a project generator using real-time operating systems. For those,

    In the figure, the window of the project preparation workflow in Kinetis Design Studio is a


    wide selection of ready-made real-time operating systems . Real-time operating systems are something without which modern embedded electronics is unthinkable. It is they that make it possible to integrate a huge number of functions in one device without loss of reliability and ensure its competitiveness. Here Kinetis has what I would call an irresistible argument - the MQX open-source real-time operating system . Actually, my interest in Kinetis began with her. But most developers prefer FreeRTOS . FreeRTOS also has the ability to generate projects in Kinetis Design Studio. In addition, you can generate projects for well-knownuCOS-II and uCOS-III operating systems . As already mentioned, there is a Linux OS build for Kinetis. You can download the mbed OS open source operating system for Kinetis from the mbed.org project site. And of course you can find at least a dozen commercial operating systems adapted for Kinetis.

    Briefly about MQX.


    The first feature of this real-time operating system (subsequently RTOS) is an unusually developed driver layer for the Kinetis family. For almost all interfaces there are drivers and, as a rule, in two implementations: using poling and using interrupts. The second feature is the multiprocessing of this RTOS. It contains a protocol stack and routing for the transparent interaction of tasks performed on many microcontrollers. The feature is very relevant for complex robotic systems. And the third feature is the advanced middleware that comes with this RTOS.

    The composition of RTOS itself is shown in the diagram below.


    A Main Composition of Middlewaredifficult to list because it is constantly expanding. But in any case, here are the components that have been part of the software for quite some time:
    • File system for drives on SD cards
    • File system in RAM.
    • File system for NAND Flash drives
    • Multiprocessor communication library
    • TCP / IP protocol stack including: ARP, DHCP, IP, TCP, UDP, PPP, ICMP, SMTP, SNMP, DNS, HTTP, NAT, RIP, Telnet, FTP, WEB server with authorization, CGI.
    • Wi-Fi drivers for the Qualcomm Atheros AR4100 chip family
    • USB host classes: audio, CDC, HID, HUB, MSD, PHDC, printer
    • USB device classes: CDC, HID, MSD, PHDC
    • FreeMaster universal communication driver

    Interesting sample applications for Kinetis:



    Electrocardiograph and pulse meter (with source texts)
    Connecting a video camera with an OV7675 chip (with source texts)
    Simple practical guide for measuring motor parameters required for vector control
    Fine-tuning the algorithm without touch control of BLDC motors
    Using DMA to organize a continuous automatic scan cycle of an arbitrary set of analog inputs analog-to-digital converter module A
    reliable way to update microcontroller firmware over wireless channels communication using the mutual exchange of banks Flash memory (with source)
    Control and monitoring of microcontrollers via Twitter (with source)
    Controlling Kinetis microcontrollers from a device running OS Android
    Audio player on Kinetis (with source)
    Using the fast Fourier transform to implement a power meter (with source)

    This is a small part of the application examples published by Freescale for the Kinetis family.
    The rest can be found on the official website.

    Now to practice



    I am not a fan of ready-made debug boards and KITs. Having sufficient experience working with microcontrollers, you can immediately start developing “combat” platforms without wasting time on extra mock iterations.
    After a short study, I developed such a debugging frequency converter:

    This device receives voltage from a single-phase network and starts the operation of an asynchronous motor with a power of up to 3 kW. In addition, it provides a smooth start and stop of the engine, and adjustment of its rotation speed in a fairly wide range. The engine can be made to rotate even several times faster than it could rotate connected directly to a 3-phase network. The converter uses a modern vector control method.

    The project is open for study and is located here.

    Also popular now: