Using CompactFlash Cards in Your Embedded Linux System
When designing embedded systems, the designer has many choices to make. If you sell thousands of units, you spend lots of time designing around the most inexpensive parts you can find. You design custom circuit boards and search high and low for the best components that you can get for the cheapest price.
If you build only one or two units, the time and cost needed to design the perfect circuit board and find the best parts can eat up the entire budget for your product. In this case, off-the-shelf parts are the best choice.
Most of my projects are for one or two units, so I'm always looking for inexpensive items I can use. The 25¢ MP3 playing chip that can only be bought in lots of 10,000 doesn't help me at all. If there was a $25 chip that I could get in single quantities, I might be interested.
I am an amateur radio operator and a member of the Tucson Amateur Packet Radio organization (TAPR). This organization is dedicated to the support and advancement of amateur radio digital communications by providing publications, meetings and electronic kits. I recently purchased a couple of IDE CompactFlash adapters from them (see Figure 1). This product is a circuit board that allows you to use standard CompactFlash memory cards as an IDE device in a PC.

Figure 1. IDE CompactFlash Card Adapter
If you have a digital camera or a portable MP3 player, you might have seen a CompactFlash card (see Figure 2). My Nikon digital camera uses these cards to store images. The cards contain between 2MB and 192MB of Flash memory. Flash memory is read/write memory that does not lose its contents when the power is disconnected.

Figure 2. A Dimensionally Indicative Photo of a CompactFlash Card
When building an embedded system based on the Linux operating system, the first problem to solve is how to boot the operating system. It might be possible to purchase an ISA or PCI card that has ROM on it and place your code in these ROMs. I haven't tried this because I haven't found affordable boards to do this.
You could use a floppy drive or hard drive in your embedded device, but I've found that anytime you can reduce the number of moving parts, you increase reliability. These drives also draw a lot of current and generate heat, so they could cause other problems.
Using the TAPR CompactFlash adapter would let you boot the operating system off of a CompactFlash card. These cards aren't terribly expensive, and they are very small. They have no moving parts, so they could be a good solution for embedded projects.
For this article, I show how to build a Linux system on the CompactFlash card. When you boot this system, it starts up a web server. Of course, I have bigger plans for the future, but there just isn't enough room in this article.
The CompactFlash adapter has three connectors and one jumper. It has an IDE connector, a CompactFlash card connector and a power connector. The jumper is used to make this device the master or slave IDE device. It is very easy to install in a system. I used a development system to build the software and a target system to test and run the software. I installed the CompactFlash adapter on the secondary IDE connector of my development box. It is configured as the master device on this controller, so Linux will see the CompactFlash adapter as /dev/hdc on my development box. My development box has a hard drive for the /dev/hda device that has Mandrake Linux 7.2 on it. Almost any Linux distribution should work, though. I also have an IDE CD-ROM on my development system that is the /dev/hdb device on the primary IDE controller.
I am using a 32MB CompactFlash card for my device, but if you want to duplicate my results from this article, an 8MB card will work. The CompactFlash will be used when the target system boots, so it would need to be device /dev/hda on the target. It should be connected to the primary IDE controller and configured as a master device. In this application, it is the only IDE device in the target system. You could connect other needed devices.
If your BIOS supports autodetection of drive parameters, it should detect the card. If it doesn't, you'll have to enter parameters for the cylinders, heads and sectors. Check the TAPR web site for some example parameters you can use. Make sure that you do not install or remove a CompactFlash card while the system is powered on. This could cause data corruption. At the very least, it will confuse the operating system if a device disappears or appears with no warning.
My target system will have an NE2000-compatible Ethernet card in it. Make sure you have the proper drivers for the network card you have in your target system. If you installed the driver as a module, you'll need to modify the /etc/init.d/rcS file also.
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Sponsored by AMD
Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6
Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.
Learn more about catching the bad guy in this free white paper.
Sponsored by DLT Solutions
| Designing Electronics with Linux | May 22, 2013 |
| Dynamic DNS—an Object Lesson in Problem Solving | May 21, 2013 |
| Using Salt Stack and Vagrant for Drupal Development | May 20, 2013 |
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |
- New Products
- Linux Systems Administrator
- Senior Perl Developer
- Technical Support Rep
- UX Designer
- Web & UI Developer (JavaScript & j Query)
- Designing Electronics with Linux
- Dynamic DNS—an Object Lesson in Problem Solving
- Using Salt Stack and Vagrant for Drupal Development
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)



5 min 6 sec ago
6 hours 59 min ago
7 hours 15 min ago
9 hours 6 min ago
14 hours 58 min ago
19 hours 30 min ago
19 hours 30 min ago
21 hours 30 min ago
1 day 6 hours ago
1 day 6 hours ago