EnterCritical() and ExitCritical(): Why Things are Failing Badly

I have carefully implemented my firmware. It works perfectly for hours, days, months, maybe for years. I there would not be a problem: the firmware crashes sporadically :-(. Yes, I’m using watchdogs to recover, but hey: it is a serious problem. And because it happens only under rare and special conditions, it is hard to track it down or to debug it.

Accessing shared data

Accessing shared data from the main application and from an interrupt

The thing is: these nightmares exist, and they are real and nasty. I’m pushing my students hard on this topic: It is about how to protect critical sections. And what could go wrong. And here is just yet another example: how it can go badly wrong if you are not careful. And it took me a while too to realize where the problem is. It was not a fun ride….

Continue reading

Advertisements

FRDM with Arduino Ethernet Shield R3, Part 3: Embedded Web Server

This is Part 3 of an ongoing tutorial to use the Arduino Ethernet Shield R3 with a Freescale FRDM-KL25Z board (or any other board you like).

In Part 1 I worked on the SD card, in Part 2 I have added basic network connection. Now time to run a web server with my FRDM-KL25Z :-). With this, I can get access to my board through the network, and the board will host a web page where I can do pretty much everything: showing status, or adding functions to turn on things like an LED 🙂

Web Server with W5100 on FRDM-KL25Z

Web Server with W5100 on FRDM-KL25Z

Continue reading

DIY Free Toolchain for Kinetis: Part 8 – Processor Expert, Eclipse and GNU ARM Eclipse Plugins

There has been many new releases these days: Freescale released Processor Expert Driver Suite 10.3, and Liviu Ionescu released new GNU ARM Eclipse Plugins with new and updated documentation. So time for me to show how this all comes together 🙂

Processor Expert Driver Suite 10.3 Project with GNU ARM Eclipse Build Tools

Processor Expert Driver Suite 10.3 Project with GNU ARM Eclipse Build Tools

It is now easier than ever before to use the GNU ARM Eclipse plugins and Processor Expert. There are still some manual steps, and this post is about all the details to get it working as smooth as possible.

Continue reading

USB for the TWR-K21F120M

Finally my Freescale TWR-K21F120M board arrived 🙂

TWR-K21F120M on the bench

TWR-K21F120M on the bench

For the next generation of INTRO Zumo robots I’m evaluating a new ‘brain’: more processing power, more FLASH, more RAM, more of everything 😉

Continue reading

DIY: Changing Processor Expert Components

I’m maintaining and hosting now more than 100 different Processor Expert components on GitHub. Instead to deal with CDE (Component Development Environment, that’s the SDK to create your own components), most users simply download and install the PEupd files. If you deal with normal source files, and if spot something you want (or need to change), then you can easily do this. But what if you want or need to change something in that code which comes with the PEupd file(s)?

Components in the Components Library

Components in the Components Library

Continue reading

Debugging the same Project Multiple Times in Parallel with Eclipse

I have I project which I want to debug on multiple boards the same time. So how can I download and debug the same application to multiple boards/processors, and debug them all the same time from within the same workspace and Eclipse IDE?

This is a typical scenario I have with my RNet stack: the same application runs on multiple boards, and I want to debug all the boards with the same project with the same Eclipse. For example to wireless sensor nodes with the RNet nRF24L01+ stack as in the picture below:

Two FRDM-KL25Z with nRF24L01+ Transceivers

Two FRDM-KL25Z with nRF24L01+ Transceivers

Continue reading

FRDM with Arduino Ethernet Shield R3, Part 2: Ping

In Part 1 of this series I have covered the SD card on the Arduino Ethernet shield. In Part 2 I’m hooking up the board to the network and will be able to ping it 🙂

Arduino Ethernet Shield with FRDM-KL25Z

Arduino Ethernet Shield with FRDM-KL25Z

Continue reading

FRDM with Arduino Ethernet Shield R3, Part 1: SD Card

Sometimes it takes a very long time to realize a project. Adding the Arduino Ethernet Shield R3 to one of my Freescale FRDM boards is one of it: it took me a year until I have found a few days to work on using the Ethernet Shield with my FRDM-KL25Z.

FRDM-KL25Z with Ethernet Shield

FRDM-KL25Z with Ethernet Shield

I have not everything in place yet, so I decided to publish things in parts. So this is about part one: using the Micro SD Card on the Shield.

Continue reading

International Obfuscated C Code Contest Winners Announced

One of my favourite quotes about programming is this one:

“ Programming can be fun, so can cryptography; however they should not be combined. ” – Kreitzberg and Shneiderman

Well, there is truth behind this. But on contrary, there is a lot of fun with the combination of the two: the yearly IOCCC contest has posted the 2013 winners!

As in earlier years, it is amazing to see what can be done with creativity and a programming language like C ;-).

Continue reading

Character LCD with 4 Lines and up to 64 Characters per Line

Character based LCD displays are great: they are inexpensive, and it is rather simple to use them compared to graphical displays. Yes, they only can display text and custom symbols, but this is usually what I need. And pretty much all character displays are using the Hitachi HD44780 protocol, so it is a de-facto industry standard.

Dual Line Character Display

HD44780 compatible Dual Line Character Display

These displays have one big disadvantage: they need to be compatible with the original Hitachi interface and protocol. First display were mostly one line only, and had only few characters, typically up to 16. The protocol worked either with one or two lines on the display. Today’s display have usually two lines, with 16 characters. But what if I need more?

4-Line LCD (Source: Daniela Solorzano)

4-Line LCD (Source: Daniela Solorzano)

Continue reading