Skip to content

Design tips for your embedded Linux product

When designing a system that runs embedded Linux, there are number of things you can do to make your life a lot easier and provide for future expansion to cover cases you did not anticipate.  Following these simple guidelines can drastically improve the efficiency of developing the system, and troubleshooting problems during field testing, and provide the flexibility needed in todays products.

#1 Have a dedicated serial console

This is the single most important interface to provide.  A serial console is your gateway into the system, and allows you at any time to poke around at the internals of the system, debug problems, run applications, change configuration, etc.  A serial console does not have to be a big DB9 connector accessible outside the system.  It can can be a simple 3 pin header and you make a special cable to connect to a PC.  Also, do put the RS232 level translators on the board.  This saves so much hassle during the development and testing cycle.  You can always not populate them later, but you will probably find that the debug console is so useful, you will leave it in — even in production.

Another consideration is to make sure you use a serial port provided by the processor if possible.  The advantage of this is very little hardware has to be working for the serial console to work.  If you use a serial port off an external UART, then the bus interface between the processor and the UART, the UART and the processor need to be working.  If something is wrong with the system, you are less likely to get debug messages out the serial console which will help you debug the system.

#2 Implement a USB Host port

A USB host port is so useful it should be considered for about any system.  Some of the things USB can be used for include:

  • keyboard and mouse if you are designing a display based system
  • USB networking
  • Wifi networking
  • extra serial ports
  • WAN modems

Many embedded processors that can run Linux include a USB Host interface, so assuming you have one of these, it is very cheap to provide this interface as it only requires two wires, and a 5V power supply.

Once again, you don’t have to put a full size USB connector in your device — a simple header wired to a connector might work in most situations.

I can’t begin to describe how useful a USB keyboard was on a recent touchscreen based product.  The product is used in agricultural vehicles, so anytime in the field we can connect a USB keyboard and look at logs, run commands, and other operations that are very difficult to do though a touch interface.

#3 Implement a Network Interface

Working on any Linux system is very painful without a networking interface.  Even if you don’t plan to use Ethernet in the final product, make sure a networking interface is available for development.  Some reasons why a network interface is critical:

  • can easily log into the system remotely for development and debugging
  • easily copy files to and from the device quickly
  • install software updates easily during the development process

Trust me on this one.  The neat thing about Linux, is if you have a USB Host interface, and a reasonably modern kernel, you can use off-the-shelf USB->Network devices for Ethernet.

#4 Provide a fast way for the bootloader to download SW updates

This is important.  Don’t depend on JTAG or a serial port for programming large OS images.  Some options for BL image download include:

  • network (preferred)
  • MMC/SD
  • USB Client
  • USB Host (using a USB Mass storage device)
  • PCMCIA/CF

The good news is if you did steps #2 & #3, this might be taken care of — just make sure you check what the bootloader actually supports.  One project I worked on recently only had a serial interface and a USB client interface that the BL did not support.  We ended up creating a mini rootfs that included just enough smarts to download the main rootfs over the USB Client interface.  So, there are ways to work around some of these issues, but its a lot easier if you do a little planning up front.

Summary

There is a lot to be said for using industry standard interfaces and components like Linux, USB, and Ethernet.   When you design a system using standard building blocks, your product will have the flexibility to implement features you never thought of when the product was originally designed.  And, your development and testing will go so much smoother.