ARM design on the mbed Integrated Development Environment - Part 1: the basics
Editor’s Note: In the first of three articles excerpted from their book Fast and effective embedded systems design: Applying the ARM mbed, authors Tim Wilmshurst, and Rob Toulson take you through the basics doing ARM-based application development using the open source mbed integrated development environment. This article and the book uses the version of ARM’s processor provided by NXP Semiconductor,but it is also available for use with Freescale Semiconductor’s ARM implementation.
Microprocessors are everywhere, providing ‘intelligence’ in cars, mobile phones, household and ofﬁce equipment, televisions and entertainment systems, medical products, aircraft: the list seems endless. Those everyday products, where a microprocessor is hidden inside to add intelligence, are called embedded systems.
Not so long ago, designers of embedded systems had to be electronics experts, software experts, or both. Now, with user-friendly and sophisticated building blocks available for our use, both the specialist and the beginner can quickly engage in successful embedded system design.
One such building block is the mbed, launched by ARM Ltd. The mbed takes the form of a 2 inch by 1 inch (53 mm by 26 mm) PCB, with 40 pins arranged in two rows of 20, with 0.1 inch spacing between the pins. This spacing is a standard in many electronic components.
Figure 2.1 shows different mbed views. Looking at the main features, labeled in Figure 2.1b, we see that the mbed discussed here is based around the LPC1768 microcontroller, from NXP semiconductors, and contains an ARM Cortex-M3 core.
Program download to the mbed is achieved through a universal serial bus (USB) connector; this can also power the mbed. Usefully, there are five light-emitting diodes (LEDs) on the board, one for status and four that are connected to four microcontroller digital outputs. These allow a minimum system to be tested with no external component connections needed. A reset switch is included, to force restart of the current program.
The mbed pins are clearly identified in Figure 2.1c, providing a summary of what each pin does. In many instances the pins are shared between several features to allow a number of design options.
Top left we can see the ground and power supply pins. The actual internal circuit runs from 3.3 V. However, the board accepts any supply voltage within the range 4.5 to 9.0 V, while an onboard voltage regulator drops this to the required voltage. A regulated 3.3 V output voltage is available on the top right pin, with a 5 V output on the next pin down.
The remainder of the pins connect to the mbed peripherals. These are almost all the subject of later chapters; we will quickly overview them here, though they may have limited meaning to you now. There are no fewer than five serial interface types on the mbed: I2C, SPI, CAN, USB and Ethernet.
Then there is a set of analog inputs, essential for reading sensor values, and a set of PWM outputs useful for control of external power devices, for example DC motors. While not immediately evident from the figure, pins 5 to 30 can also be configured for general digital input/output.
The mbed is constructed to allow easy prototyping, which is of course its very purpose. While the PCB itself is very high density, interconnection is achieved through the very robust and traditional dual-in-line pin layout.
Background information for the mbed and its support tools can be found at the mbed home page. While this book is intended to give you all information that you need to start work with the mbed, it is inevitable that you will want to keep a close eye on this site, with its cookbook, handbook, blog and forum. Above all else, it provides the entry point to the mbed compiler, through which you will develop all your programs.
The mbed Architecture
A block diagram representation of the mbed architecture is shown in Figure 2.2. It is possible, and useful, to relate the blocks shown here to the actual mbed. At the heart of the mbed is the LPC1768 microcontroller, clearly seen in Figures 2.1 and 2.2.
The signal pins of the mbed, as seen in Figure 2.1c, connect directly to the microcontroller. Thus, when in the coming chapters we use an mbed digital input or output, or the analog input, or any other of the peripherals, we will be connecting directly to the microcontroller within the mbed, and relying on its features.
An interesting aside to this, however, is that the LPC1768 has 100 pins, but the mbed has only 40. Thus, when we get deeper into understanding the LPC1768, we will find that there are some features that are simply inaccessible to us as mbed users. This is, however, unlikely to be a limiting factor.
There is a second microcontroller on the mbed, which interfaces with the USB. This is called the interface microcontroller in Figure 2.2, and is the largest integrated circuit (IC) on the underside of the mbed PCB.
The cleverness of the mbed hardware design is the way which this device manages the USB link and acts as a USB terminal to the host computer. In most common use it receives program code files through the USB, and transfers those programs to a 16 Mbit memory, which acts as the ‘USB disk’.
When a program ‘binary’ is downloaded to the mbed, it is placed in the USB disk. When the reset button is pressed, the program with the latest timestamp is transferred to the flash memory of the LPC1768, and program execution commences. Data transfer between interface microcontroller and the LPC1768 goes as serial data through the UART (which stands for universal asynchronous receiver/ transmitter e a serial data link, let’s not get into the detail now) port of the LPC1768.
The ‘Power Management’ unit is made up of two voltage regulators, which lie either side of the status LED. There is also a current-limiting IC, which lies at the top left of the mbed. The mbed can be powered from the USB; this is a common way to use it, particularly for simple applications.
For more power-hungry applications, or those that require a higher voltage, it can also be powered from an external 4.5 to 9.0 V input, supplied to pin 2 (labeled VIN). Power can also be sourced from mbed pins 39 and 40 (labeled VU and VOUT, respectively). The VU connection supplies 5 V, taken almost directly from the USB link; hence it is only available if the USB is connected. The VOUT pin supplies a regulated 3.3 V, which is derived either from the USB or from the VIN input. (For those who are inclined, the mbed circuit diagrams are available on the mbed website.
Currently no items