CMP EMBEDDED.COM

Login | Register     Welcome Guest  
HOME DESIGN PRODUCTS COLUMNS E-LEARNING CONFERENCES CODE FORUMS/BLOGS NEWSLETTERS CONTACT FEATURES RSS RSS

Choosing the best system software architecture for your wireless smart sensor design: Part 2
Anatomy of an RTOS for small devices



Embedded.com
Dynamic Downloadable Modules and Services
The benefit of being able to change the application code while preserving the relatively static RTOS kernel is attractive, especially when precious energy needs to be spared while transmitting only the bytes of the changed application or part of the application to the device. A good example in this area is the Contiki RTOS. The curious reader is advised to take a look at [6], which is an excellent paper.

The separation of the base functionality of the RTOS and the application code is used in many other RTOS solutions. I have seen the same approach in the commercial RTOS OSE from Enea and in Integrity from Green Hills. Contiki defines applications and services as loadable modules. In Contiki, a service contains common functionality that can be used by other processes. Examples are protocol stacks, sensor data handling, etc. The dynamic downloadable modules are related to the software updating strategies.

Energy Conservation Awareness
Smart sensors frequently depend on batteries. Based on how the application runs and what hardware resources are used, these batteries can be depleted quickly. The range of operation between changing the batteries may vary from several hours to years, based on the current drawn from them. Some newer chips allow for shutting down parts of the CPU for judicious energy saving. Similarly, other parts of the hardware besides the CPU can be designed to be controlled to enter a low consumption mode.

The RTOS can provide power saving mechanisms, which are abstracted from the particular hardware. If there is no RTOS used or if the RTOS does not have power saving mechanisms, then the application needs to do that. The control of the energy saving mode is so hardware dependent and varied from platform to platform, it is generally easier to have the application control the hardware directly or through an Application Programming Interface (API) provided by the chip manufacturers.

The MANTIS OS [17] has an interesting method of detecting when the system has no pending work for the tasks and putting the system to sleep. This seems like an ambitious task when taking into account dynamic changes, based on the timing requirements from the tasks and the changing load of the system in general. Contiki [6] takes a different approach and exposes the size of the event queue to the application, which decides how much work is pending for the running tasks and can go into energy saving mode or not.

The other side of the spectrum is when the RTOS does not give any indication and the application cannot decide when to control the power. The wake-up mechanism with RTOS or application control is based on an interrupt from a timer or an external source. This is an increasingly important topic and it is expected that more and more power saving algorithms will be embedded in RTOS architectures or some other from of system software for smart sensors.

Software Updating Strategies
Since WSNs are predicted to grow quickly and have many nodes, software updating becomes a challenge, but there are strategies for doing that. An example is the algorithm Trickle described in [16]. Over-the-air-programming (OTA) allows such updates to be performed wirelessly. Contiki supports an OTA protocol, described in [6].

The binary is sent to a selected concentrator node, which after successful reception of the entire binary image disseminates it to the neighboring sensor nodes. There is an error handling mechanism to facilitate the transmission between the concentrator and end nodes. Like any communication over the air, especially when software updates are concerned, the issue of security is an important one. The biggest challenges of OTA are: the time it takes to complete the task, the robustness of the protocol, and security.

Time Synchronization
Depending on the application, time synchronization may be or may not be needed. When it is needed, it is not a trivial problem to solve. One technique described in [18] uses a hook to place a timestamp in the packet. TinyOS provides set-and-get of the current system time as well as timestamps in messages, leaving the application to decide when to use those facilities.

Another approach is to use the Network Time Protocol [NTP], although its use can introduce errors in an environment as time sensitive as TinyOS [18]. There are other time synchronization protocols, such as the RTS IEEE 1588 Precision Time protocol

Table 1: Non-Commercial RTOSes

Commercial and non-commercial RTOSes
As a part of my research, I tried to run down RTOS solutions suitable for both commercial (Table 1, above), and non-commercial (Table 2, below) RTOSes in wireless sensor network designs.

Table 2: Commercial RTOSes

If I missed any it was due to my time limitations or information availability. Reader feedback is welcome to uncover other existing software gems.

Next in Part 3: Virtual machines, state machines and reactive deadline driven methods
To read Part 1, go to "The constraints imposed by wireless sensor networks."

Anton Hristozov is a senior embedded software engineer at Union Switch Signal in Pittsburgh, PA. He is currently involved in developing software for communications-based train control. He can be reached at antonhr@verizon.net

References
[1] Yangbing Li, Miodrag Potkonjak, and Wayne Wolf, "Real-time Operating Systems for Embedded Computing", proceedings of the International Conference on Computer Design1997 IEEE

[2] Anand Eswaran, Anthony Rowe, and Raj Rajkumar, "Nano-RK: an Energy "aware Resource-centric RTOS for sensor networks", Real-Time Systems Symposium, 2005. RTSS 2005. 26th IEEE International

[3] Tae-Hyung Kim and Seongsoo Hong, "State Machine Based Operating System Architecture for Wireless Sensor Networks", PDCAT 2004

[4] Jason Lester Hill, "System Architecture for Wireless Sensor Networks", University of California, Berkeley , Spring 2003

[5] Kirsten Terfloth, Georg Wittenburg and Jochen Schiller, "FACTS " A rule based Middleware Architecture for Wireless Sensor Networks", IEEE/ACM International Conference on Information. Processing in Sensor Networks (IPSN), Los Angeles

[6] Adam Dunkels, Björn Grönvall, Thiemo Voight, "Contiki " A light weight and Flexible Operating System for Tiny Networked Sensors", In Proceedings of the First IEEE Workshop on Embedded Networked Sensors 2004 (IEEE EmNetS-I), Tampa, Florida, USA, November 2004.

[7] Martin Kero, Per Lindgren, Johan Nordlander, "Timber as an RTOS for Small Embedded Devices", Workshop on Real-World Wireless Sensor Networks, June 20-21, 2005 Stockholm, Sweden

[8] David Gay, Philip Levis, Robert von Behren, "The nesC Language : A Holistic Approach to Networked Embedded Systems", Conference on Programming Language Design and Implementation, Proceedings of the ACM SIGPLAN 2003 conference on Programming language and Design and Implementation, April 29, 2003

[9] David E. Culler , PhD, Arch Rock Corp. "TinyOS: Operating System Design for Wireless Sensor Networks", Sensor Magazine, May 1, 2006

[10] Jerry Gipper and Don Dingee, "Know your OS options", Embedded Computing Design, 2007 Open Systems Publishing

[11] Jennic Ltd., "Basic Operating System API Reference Manual", 30 Mar, 2007, http://www.jennic.com/support/view_file.php?fileID=0000000043

[12] http://www.sunspotworld.com/docs/

[13] http://research.sun.com/projects/squawk/

[14] Doug Simon, Cristina Cifuentes, Dave Cleal, John Daniels and Derek White, "Java on the Bare Metal of Wireless Sensor Devices, The Squawk Java Virtual machine", VEE, Ottawa, July 2006

[15] Jennic Ltd., "Application Queue Reference Manual", http://www.jennic.com/support/view_file.php?fileID=0000000095

[16] Philip Levis, Neil Patel, Scott Shenker, David Culler, "Trickle: A Self-Regulating Algorithm for Code. Propagation and Maintenance in Wireless Sensor Networks.", In First Symposium on Network Systems Design and Implementation (NSDI), Mar. 2004

[17] Shah Bhatti, James Carlson, Hui Dai, Jing Deng, Jeff Rose, Anmol Sheth, Brian Shucker, Chrles Gruenwald, Adam Torgerson, Richard Han, "MANTIS OS: An embedded Multithreaded Operating System for Wireless Micro Sensor Platforms", Mobile Networks and Applications, June 24, 2005

[18] Philip Levis, University of California, Berkeley; Sam Madden, MIT Computer Science and Artificial Intelligence Laboratory, and Intel Research Berkeley; David Gay, Intel Research Berkeley; Joseph Polastre, Robert Szewczyk, Alec Woo, Eric Brewer, and David Culler, University of California, Berkeley " The Emergence of Networking Abstractions and Techniques in TinyOS", NSDI 2004

[19] Philip Levis and David Culler, "Maté " A tiny Virtual machine for Sensor Networks", International Conference on Architectural Support for Programming Languages and Operating Systems, San Jose, CA, USA

1 | 2

Rate this article: Low High
Current rating
  • .
Embedded.com Career Center
Looking for a new job?
SEARCH JOBS

Browse all jobs

SPONSOR
RECENT JOB POSTINGS





 :