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!

Logic Analyzer attached to the FRDM-KL25Z board

Logic Analyzer attached to the FRDM-KL25Z board

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….

Continue reading

A Generic I2C High Level Driver

I’m working with the I2C bus recently a lot. I’m using it in a project to reverse-engineering skimming (credit card fraud) devices. I needed to improve one of my applications for the lecture classes where a MCF52259 is communicating with a TWR-LCD display over I2C. And I want to add RTC (Real-Time-Clock) capabilities to my Arduino Data Logger Shield which requires I2C.

The same time I want to have things working with ARM Cortex-M4 and M0+ devices. And here the challenge started: using the I2C_LDD (Logical Device Driver) Processor Expert components for the ARM Kinetis devices is definitely not simple and easy. I want to use my software compatible for both the ARM cores and say for S08 and ColdFire cores. So what I ended up is to write a ‘generic’ I2C driver on top of the low level Processor Expert components: named GenericI2C.

Generic I2C Component

Generic I2C Component

Continue reading

ARM Cortex-M0+ Interrupts and FreeRTOS

Murphy’s Law

“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 :-(.

Continue reading

Debugging Hard Faults on ARM Cortex-M

It is as bad as this: my application stopped in an unhandled interrupt service routine:

Cpu_Interrupt
Cpu_Interrupt

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 reading

Arduino 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 :-).

Data Logger Shield on Top of Freedom Board

Data Logger Shield on Top of Freedom Board

Continue reading

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:

Shell Project with USB CDC

Shell Project with USB CDC

Continue reading

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:

FSL_USB_Stack with Sub-Components

FSL_USB_Stack with Sub-Components

Continue reading

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 :-).

FRDM-KL25Z Board

FRDM-KL25Z Board

Continue reading

Getting Help on Processor Expert Components

That might be an obvious thing for me, but recent questions of readers of my blog let me think that it is not that obvious: How to use a Processor Expert component? How to find example code?

There is the context menu entry ‘Help on Component’ on the component itself, both in the Components Library view and on the component inside the project:

Continue reading

Speeding up the Debug Launch in CodeWarrior

Whenever I do a debug launch in the Eclipse based CodeWarrior, it takes some time until actually I’m ready to step through my code on the target. Yes, a good part of that is by Eclipse. But another part is that Eclipse helps me to do stupid things (which is a good thing). But say if I know what I’m doing, I could remove some of that safety belts and still doing fine. But only if I know what I’m doing.

A good indicator where Eclipse is spending time is to have a look in the Progress View:

Progress information during launch

Progress information during launch

It shows an interesting information: ‘Build before Launch’….

Continue reading