Index


Embedded systems links

General information on embedded systems

Microprocessors are the core of a computer, but they are used also in many other applications (for example embedded devices). There are countless number of small electronic devices which are nowdays based on microcontroller.

Usually an embedded system is a system whereby the user is not given direct access to any level of code, they are to treat the entire system as a black box, press a button and some action occurs. "Embedded" has a legalistic definition as "being supplied as a component part of a larger system". Most embedded computers don't "look like" computers.

Embedded programming implies programming a system in which resources are limited, and which may need to run without manual intervention, so all errors need to be handled. Simplest of such kind of error handler just restarts the system if things go wrong. Many embedded systems use watchdog systems to handle errors like software crash (watchdog just resets the system of software stops notifying watchdog timer that is running properly).

In embedded work, it's often import for the programmer to have a thorough understanding the the language and what the compile is going to do. From what I've seen, that's possible with C, Modula-2, Modula-3, Ada, and various other languages. It doesn't seem to be possible or easy with C++. C++ is often criticized because it is bloated and too complex. The C++ language itself is very too complex and baroque to understand completely enough for it to be used effectively in some embedded environments. C++ is used in some embedded systems successfully. Those tend to be devices with lots of networking and GUI related things, where ??bject oriented design and C++ features cna have considerable effect. Some examples of devices that use C++ are the smart cellphones.

Generally in embedded programming the main languages seem to be C and assembler. Assembler is extensively used in very small footprint systems (processors with just few kilobytes of memory). C is generally used in any large projects (usually in combination with some assembler code to do processor specific tricks).

Embedded processors come in many flavors and varieties. Depending on the power and features that are needed, you might choose a 4, 8, 16, or 32 bit microcontroller.

Emebdded systems typically use microcontrollers. A microcontroller is by definition a is a computer on a chip. It includes all the necessary parts (including the memory) all in one IC. You just need to apply the power (and possibly clock signal) to that device and it starts executing the program programmed to it. A microcontroller generally has the main CPU core, ROM/EPROM/EEPROM/FLASH, RAM and some accessry functions (like timers and I/O controllers) all intergated into one chip. The original idea behind the microcontroller was to limit the capabilities of the CPU itself, allowing a complete computer (memory, I/O, interrupts, etc) to fit on the available silicon real estate.

Microcontrollers are typically used where processing power isn't so important. More important are generally compact construction, small size, low power consumption and that those chips are cheap.

The small 8-bit chips (little ol' 8051s and 6805s) are the best-selling type of processor. This kind of small processors are found embedded in a wide varierty of electronics devices, ranging from small gadgets and home equipment control to car electronics. Those small controllers are flying off the shelves at the rate of more than 3 billion new chips per year (more than half of the microprocessor sale per units). For example controlling a microwave oven is easily accomplished with the smallest of microcontrollers.

Simply (and naively stated) an embedded controller is a controller that is embedded in a greater system. A rigid definition is difficult if not impossible to formulate. You could say that an embedded controller is a controller (or computer) that is embedded into some device for some purpose other than to provide general purpose computing. Embedded controllers adhere to a philosophy similar to that of microcontrollers, high integration. By including [many] features necessary for the task at hand, an embedded controller (processor) can be a powerful yet cost effective solution. Where a microcontroller [almost by definition] is a computer on a chip, an embedded controller might need external components before it is considered a "computer." This is especially true regarding RAM. Standard microprocessors (such as the Motorola 68000 or National 32032) are frequently used as powerful embedded controllers. In addition, specialized processors are available which include features specific for communications, keyboard handling, signal processing, video processing, and other tasks.

Real-time is quite often mentioned together with embedded systems. Real-time just implies that time is a critical factor in any function of the embedded system. Real-time implies a system in which if a single event is missed or over-runs it's time slot the whole system has failed (possibly with disastrous results), so this must not be allowed to happen. Hard real time is usually taken to mean that any missed time constraint is a failure. Soft real time is taken to mean that some missed deadlines are acceptable, or at least won't endanger life, property, or cause loss of money. An automatically controlled airplane is a situation of hard-realtime,

Important things to know when designing/programming embedded systems

When talking about programming embedded system, microcontrollers or low level (near hardware) programming, you need to know the following things:

  • Learn how to write small code that compiles to small size and does not use much run time memory
  • Avoid "memory leaks"
  • Learn to handle atomic operations correctly (handling of shared data structures, event flags)
  • Handling of events in the systems, for example mailbox, stack
  • How to handle asyncronic I/O so that there is time to do everything necessary
  • How to write software so that you can work with very small operating system or no operating system at all
  • How to guarantee that execution time for different things is guaranteed (things are done at the time, everything that needs to run runs well)
  • Write the code so that the device dependent part of the code is only small part of the system, preferably isolated part from rest of operation logic
  • Decide what kind of operating system you need. Real-time operating system might not be right for all applications, because real time systems generally use more memory and more system resources than simpler operating systems
  • Decide what would be be best to be handled with interrupts and where polling is suitable method
  • Usually there is limited amount of time that interrupt routine can use. This limits that usually there is not much time to do things on interrupts. If interrupt needs to activate some complicated task, this must be generally handled outside the original interrupt. Some solutions for this is "nested interrupts" and DFC (delayed function call).

Usually in embedded systems have real-time needs. Generally there are several different needs for levels of real-time operation. Here are some possible levels that are usually necessary:

  • input event interrupts: microseconds response time for hardware handling
  • hard-real-time-high: 10 us .... 1ms
  • hard-real-time-low: time critical ...50ms
  • soft-real-time-high: 10..500ms (execution delay can vary somewhat)
  • soft-real-time-low: 500ms... and more
  • EmbeddedRelated.com - EmbeddedRelated.com is a place for Embedded Systems Developers and other profesionnals in the field to browse Comp.Arch.Embedded, participate to Embedded Systems Discussion Groups, find a good Embedded Systems Book and find a great internet Embedded Systems Resource.    Rate this link

Embedded systems and IP protocol

We live in an increasingly networked world and embedded systems are no exception. Network connections are becoming common for purposes such as downloading information or revised code, uploading acquired data or operating statistics, and diagnosing problems from remote locations. TCP/IP has become the network protocol of choice.

    Project pages

    • Web51 Project page - Free Web Server and Telnet-RS232 converter on 8kb Flash,256B RAM. Fully documented project of connecting an Intel x51 compatible CPU to RTL8019AS network controller. WWW server, "TELNET" and SMTP implemented on 256B RAM and 8 kB FLASH solution. You can use the GPL version or buy HW kit + SW + licence & MAC address space for your own project.    Rate this link
    • IPic - A Match Head Sized Web-Server - This is propably the world's tiniest implementation of a TCP/IP stack and a HTTP web-server based on a PIC 12C509A, in a tiny 8-pin SO8 package. The iPic web-server is connected directly to a router running SLIP at 115200bps.    Rate this link
    • A $25 Web Server - article from Circuit Cellar Online    Rate this link

    Embedded TCP/IP software

    • uIP - uIP is a free small TCP/IP implementation for 8- and 16-bit Microcontrollers. uIP is written in the C programming language and the source code is free to distribute and use for both non-commercial and commercial use (BSD license). The main philosophy behind uIP is that by integrating the TCP/IP stack and the application, the code size of both the TCP/IP stack and the application can be kept down to a minimum. The uIP code footprint is on the order of a few kilobytes and RAM usage is on the order of a few hundred bytes. uIP has been compiled and tested on the x86 and the 6502 CPUs.    Rate this link
    • PIC IP: Internet Protocol I/O - PIC TCP/IP and Web server links    Rate this link
    • The Contiki Operating System and Desktop Environment - The Contiki desktop environment is a highly portable, modern, open source, Internet-enabled operating system and desktop environment for very constrained systems, such as 8-bit homecomputers like the Commodore 64.    Rate this link
    • lwIP - A Lightweight TCP/IP Stack - lwIP is a small independent implementation of the TCP/IP protocol suite that has been developed by Adam Dunkels at the Computer and Networks Architectures lab at the Swedish Institute of Computer Science as part of the Connected project. The focus of the lwIP TCP/IP implementation is to reduce the RAM usage while still having a full scale TCP. This making lwIP suitable for use in embedded systems with tenths of kilobytes of free RAM and room for around 40 kilobytes of code ROM.    Rate this link

Interfacing

    Computer peripheral interfacing

Techniques important in embedded systems design

    Sampling, A/D and D/A conversion

    • Using PWM to Generate Analog Output - Pulse Width Modulation (PWM) modules, which produce basically digital waveforms, can be used as cheap Digital-to-Analog (D/A) converters only a few external components. A wide variety of microcontroller applications exist that need analog output but do not require high resolution D/A converters. Some speech applications (talk back units, speech synthesis systems in toys, etc.) also do not require high resolution D/A converters. For these applications, Pulse Width Modulated outputs may be converted to analog outputs. Conversion of PWM waveforms to analog signals involves the use of analog low-pass filters. This application note describes the design criteria of the analog filters necessary and the requirements of the PWM frequency. Later in this application note, a simple RC low-pass filter is designed to convert PWM speech signals of 4 kHz bandwidth.    Rate this link
    • Sampling rates for analog sensors - Why use trial-and-error methods to determine sampling rates when you can use science and mathematics? Here are the details of a simple procedure that makes more sense.    Rate this link
    • Introduction to Pulse Width Modulation - Pulse width modulation (PWM) is a powerful technique for controlling analog circuits with a microprocessor's digital outputs. PWM is employed in a wide variety of applications, ranging from measurement and communications to power control and conversion.    Rate this link
    • How to Choose A Sensible Sampling Rate - Trial-and-error testing is neither the fastest nor the best way to determine the sampling rate for a given application, although it's probably the most common. Systematic engineering analysis, plus a few guided experiments, will help you find a good rate quickly.    Rate this link


<[email protected]>

Back to ePanorama main page ??