First all, I would like to mention how impressed I am with the kinetis microcontrollers, and I have a couple of freedom boards that I tried myself and they work well. I came with a background working with microchip MCUs, but because of some external circumstances I decided to add a different MCU manufacturer to my working portfolio, so I chose the Kinetis MCUs from Freescale now NXP.
In my seek of knowledge trying to understand how to work with the kinetis microcontrollers, and learn about their IDE (kds and cw_10.4), how to create projects, how to create programs/firmware, tools and more, I found out the “book of eli” The Book of Eli - Microcontrollers, robotics and warp drives, where Eli explain in some clear and easy manner how to work with a Kinetis microcontroller from scratch (no use of KSDK and/or ProcessorExpert). I followed this path because I was curious and wanted to understand what really happen with all the register configurations since the initialization of the MCU, passing through peripheral configurations, and finishing with the implementation of some tasks.
As I described above I was able to create my own libraries following some concepts from Eli, for instance: I created uart.h/uart.c , gpio.h/gpio.c , ADC.h/ADC.c , and a few other similar libraries(headers/source files) for my current project (some basic implementations). Everything was OK until some recent events, which are forcing me to modify and adding/implement new features to my project, for instance: Serial (uart) Bootloader, SPI/I2C communication, Serial (uart) Emulation on different I/O pins, PWM modules, and some other features,
1. One of the first problems I was facing was the utilization of a #kinetis microcontrollers which is not implemented into a FREEDOM board which is the “KL34Z64” (this MCU was chosen because of reducing the project cost). As per NXP website the closer development tool available for this MCU is the frdm-kl46z, and the main difference between the KL34 and the KL46 is the lack of USB module on the KL34.
2. Since the project was turning into a more serious project and with the addition of new features and modules to be implemented. I am worried about the amount of time that it will take to create more libraries of my own, in order to release the project on time. On the other hand, I was reviewing the option of use the KSDK the problem is the all the examples and demos for the drivers (adc, gpio, cop, dma, mcg, spi, and others) are based on the FRDM-KL46Z, and I was trying to modifying it in order to make work for the KL34 without luck, There are many functions and source files to go through that I got lost, even with the simple task to change the clock source from external to internal without luck too.
3. A possible issue is the release of a new IDE from NXP. At this moment I don’t know If I should keep using Kinetis Design Studio or change to MCUXpresso, what will be the impact on the project? Is there any advantage using and learning MCUXpresso?
1. Where can I find learning material about the use of a Kinetis MCU that is not used in a freedom board? (e.i. KL34Z64).
2. Where can I find detail information about how the KSDK driver examples are implemented and description about the source files and utilization of them? (How can I modify them in order to make them work on the KL34?)
3. On KDS when I create a new project and import the proper platform for my MCU I get “ksdk_platform_libMKL34Z64VLL4” with the OSA folder, the drivers and hal files, How can I implement them properly?, Does anyone know about any source material that I can review?
Note: I am trying to avoid the use of ProcessorExpert, because I would like to learn more a little deeply on code (baremetal Project types, and/or use of KSDK only), how the libraries and drivers headers/source files are implemented.
If anyone could give me some advice please, I would greatly appreciate it.
If you do not develop code based on KSDK, you can use tools such as KDS, Keil, IAR to new a project. If you use KSDK, but there is not the KSDK package for the Kinetis processor you are using, we have a tools called "project generator" which can clone a SDK project.
Pls download the tools "project generator" from the link:
Regarding the UM of the tools "project generator", pls refer to the doc "Getting Started with Kinetis SDK" located at:
Hope it can help you
I have some experience with Kinetis KL46 MCU on FRDM-KL46Z board. That's why I am trying to answer. For developing a new project on these boards, the example projects with the SDK serves as good reference. Also we can learn Kinetis SDK usage. But for a custom board with the same MCU, or a different MCU (like KL34) or even the same board with some custom expansion, we also need to look into the MCU reference manual, datasheet, ARM reference manual, SDK API manual etc.
For answering your questions:
1) As you found out, you cannot find example projects for every kinetis MCU. But you can compare features of KL34 and KL46 and adapt the example projects to KL43 without much difficulty. Even better, you can create a new empty project within KDS for KL34 MCU and see what is the minimum required files and startup sequence. The Getting started document that comes with the SDK contains more info.
2) Again the SDK Getting started documentation gives details about structure of example project and files. The SDK API reference manual provides documentation with examples usage for all drivers (SPI, I2C etc..)
Porting an example to another MCU involves several things, like:
1. Pin initialization and multiplexing, clock initialization: Initialize pins and set the correct alternate functionality. Initialize clocks needed (clock for port pin and the module). MCU reference manual/datasheet needs to be referred for pin description.
2. MCU clock initialization: Change the clock option as needed. The SDK clock driver provides functions to initialize various clock options (internal/external). Refer clock section of MCU ref manual in parallel with SDK API doc.
3. Driver initialization: If a different instance of a module is used (eg: UART0 instead of UART1), change the instance used with the driver.
These are only some of the essential changes needed when porting, and there can be others too.
3) Looks like you are using older version (1.x) of Kinetis SDK. The newer SDK 2.x is simpler in terms of usage and implementation and I suggest to use it instead.
There is no need to switch to the newer MCUExpresso, if you are already familiar with KDS. But since both are eclipse based IDEs, there is not much to learn. Also there are more features in MCUExpresso. So for a fresh start, go for MCUExpresso.