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

I have carefully implemented my firmware. It works perfectly for hours, days, months, maybe for years. If there would not be this 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

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

DIY Free Toolchain for Kinetis: Part 7 – GNU ARM Eclipse Plugins

Tired by the tool chains provided by your silicon vendor? Do you want to use a free and open tool chain? Then you probably followed by “DIY Free Toolchain” series already. In “DIY Free Toolchain for Kinetis: Part 2 – Eclipse IDE” I used the standard GNU Eclipse plugins. As mentioned in above post, there is an even better and more powerful plugin available: the GNU ARM Eclipse plug-ins. There is a dedicated blog site which provides excellent documentation and direct access to new and frequent releases. And these days there is a true a Christmas gift for every Eclipse lover: the version 1.1.7 with the addition of J-Link debugger plugin :-).

GNU ARM Eclipse (http://gnuarmeclipse.livius.net)

GNU ARM Eclipse

Continue reading

INTRO Mini Sumo Tournament 2013: Lots of Fun!

It was Friday the 13th, and it was Sumo Battle Day :-). After 3 months of tinkering, hacking and creatively improving the Mini Sumo Bots, finally the the course tournament took place.

Get Ready

With using a different room, every team had a chance to warm up and recalibrate the sensors for the new environment.

Warming up for the battles

Getting ready for the battles

The time was used to apply last-minute changes and improvements too, plus to record the last Robo Portraits.

Continue reading

Review: ThunderBench with the Freescale FRDM Board and Processor Expert

For the Eclipse and Processor Expert lovers of this world: there is another Eclipse based IDE you can use: ThunderBench made by Emprog:

ThunderBench for ARM Eclipse Startup Screen

ThunderBench for ARM Eclipse Startup Screen

They support a range of ARM based devices, including the Freescale ones I’m using. So I downloaded the v3.24 30 day trial from their download page last week. Finally I have found some time to try it out. Could this be an alternative to use my Freescale FRDM boards with Processor Expert?

Continue reading

S-Record Manipulation with GNU objcopy and Burner Utility

In my earlier post “S-Record Generation with gcc for ARM/Kinetis” I documented how to have the ARM GNU gcc toolchain to produce a S19 (Motorola (or now Freescale) S-Record) file. Here are a few more tips on that subject:

  1. Changing length of S-Records
  2. Only using 32bit addresses
  3. Combining S19 files

Continue reading

Link Order: Using Multiple Definitions with ARM GNU Linker and Eclipse

Sometimes I have ‘multiple definitions’ in my projects: this means that I have functions defined in one source files, and I need to ‘overwrite’ one or more with a version in another source file.  For example I have a source file with utility functions (Utility.c), and I want to overwrite some of these functions with a different implementation in a different file (MyUtility.c). How can I do this?

Continue reading

Optimized BitIO_LDD Programming with Processor Expert

In my tutorial “Bits and Pins with Kinetis” I showed how to use the BitIO_LDD approach for Bit I/O access. I do not like this LDD (logical device driver) approach for several reasons:

  1. It requires an extra ‘device handle’ passed to the functions, even if such a device handle is not needed or desired.
  2. The code efficiency/size is negatively impacted by this.

Luckily, there is a way to hack around this 🙂

Continue reading