I first began utilizing embedded Linux in 2007 as the basis of ZigBee to Ethernet gateway. In general, it was much tougher back then to assemble all pieces required to make a reliable working system. While there were tools, I found that many did not support our specific requirements or plain did not work. Today building and running an embedded Linux distribution continues become easier; many silicon vendors provide tested SDKs. However when you start porting to custom targets or things don’t work as expected having an experienced person that thoroughly understands all aspects of the system and that has the ability to push through the difficulties is critical to success. Free does not mean easy. The following describes some of my experiences using embedded Linux.
Free does not mean easy.
I had evaluated a number of different options for bringing up an embedded Linux environment for our ZigBee to Ethernet gateway. The base hardware was a 32-bit protected mode ARM processor with 64MB DRAM and 256MB NAND flash. Since it was expected that the platform needed to be able to flexible and have a programming environment that would enable rapid application development I decided that a full desktop-like distribution would be most advantageous. Subsequently, I built the cross tool-chains, 1st and 2nd stage boot loaders, Linux kernels, Debian root file systems, and a x86/ARM application build environment by patching, fixing, adapting, and coercing open source code and tools into submission. In the years following the initial platform bring up, I rebuilt all of the components multiple times to address new requirements and development needs.
…created a userland driver that reacted to hard real-time deadlines…
A couple of years after the initial work, as part of a cost optimization and differentiation effort, I needed to adapt an IEEE 802.15.4 MAC driver to run directly on the ARM processor, as opposed to a separate microcontroller. There were several constraints and challenges that made this a very difficult problem. First, the gateway was using a protected mode embedded Debian/Linux distribution and the original driver code was written for 8-bit microcontrollers with no RTOS. Second, the license terms of the driver did not allow for it to be used as part of a Linux kernel driver. Third, the driver had two hard real-time deadlines, the most stringent of which was being able to indicate the presence of held data to a polling end device within 2ms.
I suspected that it may be possible to run the driver as part of the user land application along with the ZigBee stack which would prevent licensing problems. First, I was able to successfully patch, real-time and low latency capabilities into the kernel. Second, I made an updated, bleeding edge Debian root file system based on glibc 2.10, which was required to access certain real-time APIs in the kernel. Third, I ported and modified the MAC driver’s stock interrupt service routines to work in a user land context. Forth, I wrote a bit banging user land SPI driver since the latency of file interface to the kernel SPI driver could not meet the 2ms deadline. Lastly, I tuned the priorities and performance of the threads in the user land application and was able to create a stable driver that reacted to the hard real-time deadlines within 300-350us.
…the driver made possible ZigBee to Wireshark real-time packet sniffing…
One neat and highly differentiating feature made possible by this new driver was ZigBee to Wireshark real-time packet sniffing. The driver and application code run normally while sniffing is enabled providing the ability to remotely “visualize” problems without changing the dynamics of the network under analysis and without requiring a dedicated wireless packet capture device.
In The News
Jan 19, 2013
The Embedded Linux-based ZigBee Gateway Reference Design software James developed for Texas Instruments was announced at DistribuTECH.