The great thing with the Freedom FRDM-KL25Z board is its compatibility with Arduino Shields: a great set of board available at very reasonable prices. I had my hands on the Adafruit Data Logger shield, and now it was time to use the original Arduino Motor Shield R3.
Category Archives: Boards
Processor Expert Maxim I2C RTC for the Arduino Data Logger Shield
There was one part missing to complete the software support for my Arduino DataLogger Shield on top of my FRDM-KL25Z Freedom board: support for the Maxim DS1307 RTC (Real Time Clock).

DS1307 on the Adafruit Data Logger Shield (Source: http://www.ladyada.net/make/logshield/design.html)
Things got delayed a bit, as I first needed to get the I2C infrastructure up and running (see this post). But finally, I have things working :-). I proudly present: RTC_Maxim!
KL25Z and I2C: Missing Repeated Start Condition
I really hate this kind of stuff: I know it should work, but it does not. I’m loosing a lot of time (hours, days, even weeks) to track it down to the root cause. Yes, I create my own bugs. Yes, there are bugs in tools, sources, libraries and components. But what many might not believe: there are bugs in silicon too :-(. If you do not believe, here is one: there is a hardware I2C problem on the KL25Z used on the Freedom board. It worked in one project, but not in another.
❗ The silicon bug described here is present on many Kinetis devices, not only the KL25Z!
So if you are facing a problem where you read 0xFF or wrong values from the I2C bus with the KL25Z, here is probably why (and how to workaround it). The problem showed up with a modified version of the Freedom Accelerometer tutorial….
ARM Cortex-M0+ Interrupts and FreeRTOS
“Anything that can go wrong, will go wrong”.
strikes again. Well, the modified version of it:
“Anything that can go wrong, will go wrong, but it will wait until it really, really goes wrong”.
It is always amazing to see that systems having a fundamental flaw, they can work for a long period. Only that on day X my application crashes. And when found the problem, I’m wondering how in the world it was *ever* working with that bug in it :-(.
Debugging Hard Faults on ARM Cortex-M
It is as bad as this: my application stopped in an unhandled interrupt service routine:

That does not tell much. I’m using Processor Expert generated code, and with this all my ‘unhandled’ vectors are pointing the same handler:
Continue readingArduino Data-Logger Shield with the FRDM-KL25Z Board
One success factor of the Arduino platform is the broad availability so-called ‘shields’: hardware plugin-modules which extend the capability of platform. Shieldlist.org currently lists 288 different shields available! Clearly, Freescale wants to benefit from that ecosystem with the Freedom FRDM-KL25Z board which features Arduino compatible headers. Time to use the Freedom board with an Arduino shield :-).
USB CDC and SCI: Side-by-Side with the Freedom Board
In “A Shell for the Freedom KL25Z Board” I have presented an application which implements FreeRTOS, LED’s and a shell using the UART on the KL25Z over OpenSDA. So why not adding native USB CDC to the mix? Using both the USB and CDC with the same shell?
So what I have added is that the shell runs on both the SCI (over OpenSDA) and USB CDC (with the KL25Z). For this, the FSL USB CDC software stack is now part of the project:
Thumbs up with Assembly on ARM Cortex
Sometimes it is necessary to write an interrupt service routine in assembly language. This is the case as well for the ARM Cortex-M0+ which is found in the KL25Z on my Freedom board. But there is something important about the ARM Cortex architecture: Thumb Mode.
Thumb mode the ‘ARM way’ to reduce the code size with a reduced (16bit wide) instruction set. The ARM architecture can implement a ‘mixed’ mode, on a function level. To distinguish between ‘normal’ ARM functions and ‘thumb’ functions, the processor is checking if the LSB (Least Significant Bit) of a function pointer (or function call destination) is set. So a jump address of 0x410 is for a ‘normal’ function, while a function jump to the address 0x411 (even if the function is located at the address 0x410) denotes a ‘thumb’ function.
USB Component Splitted and Updated
Checking the download statistics of my Processor Expert components on http://www.steinerberg.com/EmbeddedComponents/, there is a clear winner: FSL_USB_Stack 🙂
It has been a while I presented that universal USB CDC component in this blog. The component has received a larger re-architecture, I wanted to support more than just USB CDC. For this, the CDC part is now present in a separate sub-component:
Tutorial: Bits and Pins with Kinetis and the FRDM-KL25Z Board
In “Optimizing the Kinetis gcc Startup” I stripped down the fat of my startup code. Now time to add some useful things. And what does a microcontroller like the KL25Z on the Freedom FRDM-KL25Z board have: Pins! And this means I have bits to set and read :-).





