Вы находитесь на странице: 1из 6

M ICROCONTROLLERS

Reign with the Sceptre


"'1,

ll .,:. ,r,, -,i.: ri.,r,rj !,r .,,,i '1. , ',;, i: :

! ll .; 't l ,: tt t .1,:1 ; i, :t ,{i ti

By Clemens Valens (Elektor France Editor)

This open-source & open-hardware project aims


to be more than just a little board with a big
microcontroller and a few useful peripherals - it
seel<s to be a fast prototyping system. To justify this

title, in addition to a very useful little board, we also


need user-friendly development tools and libraries
that allow fast implementation of the board's
peripherals. Ambitious? Maybe, but nothing should
deter you from becoming Master of Embedded
Systems Universe with the help of the Elel<tor
Sceptre.

The aim of fast prototyping is to produce an was while contemplating these weal<nesses available, but specifica-
operational prototype of an application in that the idea for Sceptre was born. tion #3 rules out a lot
the shortest possible time. To achieve this, Here are the specifications collected thus far of them. We ended up
we need powerful, easy-to-use tools espe- for a powerful fast prototyping platform: choosing the LPC2148
-
cially when a microcontroller application is from NXP for the follow-
involved. The ideal is a simple assembly of a . powerful microcontroller ing reasons:
few intelligent building-blocks. Often, you . built-in useful peripherals . Popular: easy to find,
need only a single version of a set-up, and . easyto implement thanks to a big com-
would like to use the prototype as is. So you . compact size munity of users.
need to be able to treat these intelligent . cheap . Available in an
building-blocl<s as consumables. LQFP64 package:
Many commercially-
available microcon-
troller development
boards are not suit-
Open mobile platform
able for fast proto-
typing as they are too large, too fragile, or Let's add a sixth point to the list: relatively easy to
simply too expensive to be used only once. solder, even using DYI tools.
Usually, there is also a lacl< of software sup- . the project must be able to be built by . ln situ programmable via a simple
port for developing an application rapidly. an (experienced) amateul which implies serial port: doesn't need a special
One excellent example of a fast prototyp- the use of readily-available components programmer.
ing platform is Arduino tll, which we tell you that are also easy to solder. . Powerful: 32-bit ARMTTDMI-S core,
about from time to time. However, one of 512 KB flash memory,40 l(B RAM, lots
the drawbacl<s with Arduino is its low cal- Let's start with the first specification: the of built-in peripherals, including USB 2.0
culating power. 5o we almost always have brains of the project. The most power- and a real-time clocl<.
to add an expansion board to be able to use ful microcontrollers currently accessible . Easy to implement: the multi-platform
it, as an Arduino board has no peripherals. lt to enthusiasts are 32-bit ones. Several are open-source development tools are

03-2o1o elel<tor
MICROCONTROLLERS

]ilIJIJIEITI
. 32-bit ARMTTDMI-5 LpC:r48 . Real-time clocl<
microcontroller, 5rz l(B flash, 4o KB RAM . All microcontroller pins accessible
. USB z.o . Batteryor U5B port powering
. Bluetooth (Class r or z) . Li-ion battery charger
. 5D card reader . Compact: 6x8cm
. Serial port via U5B (e.9. for in situ . Open-source tools, software, and
available free on the Web, as
programming) hardware
are lots of libraries.
. 3-axis accelerometer . Open-source extended library
. DSrSBzo thermometer
We could argue for ages
about the peripher-
als that are'useful'
to have on the sort
of board we're thinl<-
ing of. After lengthy consider-
ation, we've chosen the following
(Figure 1):
Bluetooth module: naturally, a wireless
linl< (class 1 or 2, as you prefer) is obliga-
tory these days.
5D card reader: for storing data and
programs.
USB 2.0 (peripheral): since it's already
included in the microcontroller...
RS-232 serial port via USB: handy for in
situ programming.
3-axis accelerometer: this'll let you do
some super things.
Thermometer: always comes in handy!
Real-time clocl<: lots of applications
need one.
Li-ion battery charger: as the board's
going to be small, it will be portable, so
battery powering is a must. Figure 1. Sceptre blocl< diagram.
Expansion port: because you can't
always plan for everything, all the micro-
controller's pins will be accessible via
terminal strips.

All this on a small board unfortunately


rather conflicts with specification #6, as we
are obliged to use SMD components and a
rather dense, double-sided PCB. We have,
however, tal<en the trouble to picl< SMD
components that are relatively easy to fit.
As a result, the PSU / battery charger for
example is more complicated than neces-
sary. The only component that's not easy to
fit yourself is the 3D accelerometer. We've
not found this sort of component in an
'easy'pacl<age.
Since Sceptre is based on numerous open
source code projects, it's only natural that
this project too has an all-open structure.
Hence the source codes and CAD files
(Eagle) are available for free download from
the Sceptre website I2l. So you can modify

everything you're the one in charge!


-
Figure 2. Here's one possible application for the Sceptre. The lnterSceptres provide the
interface betl',,een the Sceptre and any peripheral such as a synthesizer or a stepper motor

elel<tor 03-201o
M ICROCONTROLLERS

Banqy CharEer
Applications &
Slitctr Ow Circufl
Those familiar with Nintendo's Wii games
console may have noticed the similarities
between the Sceptre and the Wiimote,
the remote control for the Wii. lt's true
(given that this is a totally open project, we
won't be hiding anything from you - long
live transparency!): both are portable and
include Bluetooth, a 3-axis accelerometer,
and a powerful micro. ln fact, our original
idea was to build a sort of Wiimote, and the
name Sceptre was chosen to highlight its
function as a powerful remote control (Fig-
ure 2). But you can do a lot more with the
Sceptre, as it's a universal open platform.
For example, the SD card reader lets you use
the Sceptre as a stand-alone data recorder.
The board already has a thermometer and
a real-time clocl<. What's more, the micro-
P1.31fr6-
controller and board have been designed to P1.3otrMs
lC4 P12efrcK
minimize power consumption and prolong
P0-4/SCK0/CAP0.ilAD0.6 P127ft&
battery life.
P0-6/MOS|0/CAP0.ZADI.0 P1.25IEX1N0
PO.7/SSELO/PWMZ€|NT2 P1,24fiAACECLK

Model enthusiasts will probably appreci-


P0.3frXD1/PW4/AD1.1 P1.23F|PES1A12
ate its Class 1 Bluetooth link (100 m range
in free-field), its 3D accelerometer, and its
pulse width modulation (PWM) capabilities, PO.I SDTF ilMAT1,I/AD1 -4 P1 -1 3ffRACEPXT2

as it will be possible to use the Sceptre as PO.1 5/RXEINT2AD'.5 P1.1 6fRACEPKTO

the brain for remote-controlled devices or


PO.25/AD0.4AOUt
robots. To tal<e full advantage ofthe Blue-
tooth, the board offers the possibility for fit-
ting an SIVA connector so you can connect a P0.21IPWM5/AD1,&CAP1.3 p0.30/AD0,SEINT3/CAPC0

proper aerial. Provision has also been made


LPC2148FBD64
for a little impedance matching networl<.
As the board has a USB port (two, in fact!) it 999.ryc' rrru "999
"6
can easily interface with a computer. Thanks
to the Sceptre's expansion ports, all the
microcontroller's peripherals can be used:
uARr (2), spr (2), r,c (2), rvrLr (6), cNA (14),
CAN (1), USB. lt will even be possible to use
the Sceptre as the heart of a small compu-
ter with PS/2 l<eyboard, LCD screen, and 5D
card virtual disl< drive.
ln short, as we say when we're stucl< for
ideas: the Sceptre's applications are only
limited by your own imagination!

l-{ardware
The circuit diagram of the Sceptre is shown
in Figure 3. As there are a hundred or so
components, the circuit may at first sight
seem daunting, but lool<ing closer, you'll
see that there's nothing terribly compli-
cated about it. So we're not going to go Figure 3. The full circr t diagram of the Sceptre. lt's a bit big,

03-201o elel<tor
MICROCONTROLLERS

through it in detail, but confine ourselves


to a few comments:
First, the power supply. The board can be
powered from a battery or via the USB port.
USB powering tal<es priority, and is also used
for charging the battery. The MAX1551 lC is
a Li-ion battery charger with just five pins.
The device detects if a voltage is available
on one of its two inputs (we're only using
one of them).
ln order to minimize the volts drop when
the board is being powered from the bat-
tery, the circuit used to switch between
the 5 V rails from the USB port and the bat-
tery (D9, T4 and T5) is a bit more compli-
cated than the two diodes usually found in
Seilal o/lSP lntedace this type of circuit. Naturally, the aim is to
mal<e the battery last as long as possible.
The voltage from the battery or USB port
is then converted to 3.3 V by the MAX710.
zXM61P03F USB lnteiace
This operates down to 1.8 V, so we can dis-
charge the battery quite a long way.
Cheaper, ready-made PMIC (Power Man-
agement lntegrated Circuit) devices do
exist offering all the functions described
above and more. But the problem is that
these PMICs only exist in QFN pacl<ages,
or worse still, BCA in short, pacl(ages we
-
have sought to avoid at all costs.

There are two USB port on the board, but


only one socket. Two jumpers let you choose
which of the two ports will be entitled to use
the on-board socl<et. ln the event that you
need to use both ports at the same time, it's
possible to connect a USB socl<et for lC5 to
the expansion port l(i 0. lC5 is provided first
and foremost for programming the board
Y2 via USB, i.e. during the development phase.
aioo
Alol ", 'o
Plolo Once the application is finished, it is possible
Ploo Pto1l
Plol sPl Mlso to disconnect it and free up four l/Os. The lC
PIO2
PIO3
SPI CLK
SPI CSB
is powered solely from the USB 5 V rail and
Pto4 sPt Most
so doesn't drain the battery power.
PIOS UAFT CTS
PIS UAFT.FTS Solder bridges JP15 and JP16 can mal<e
PIOT UAFI TX
PIOS UART FX programming a little more convenient by
Prog pcu cL(
RESET PCM OUT allowing automatic switching between the
USB DN
USB DP
PCM Itr
PCM.SYNC
programming mode and the microcon-
aTMt 1 2
BfM-222 troller's normal operating mode. Without
GND GND GND
these bridges, each time you want to pro-
gram the board, you have to fit JP1 , press
the reset button, program the microcon-
troller, removeJPl, and press the reset but-
ton again, which can become a pain after
owing to the number of components, but there's nothing terribly complicated about it. a while.

elel<tor o3-2oro
M ICROCONTROLLERS

He I9 oph Td hb
'..; r.D'r. F q,Je-
@M tml4a

been provided in case the impedance of do the same. Allthe source codes developed
r*ruo,unmu-pii"uppi9J; .- ,lr-;* l
MdilHvdd.h6S-40.1138:S @eidr the Bluetooth module's RF output needs to for the Sceptre ought to compile using any
ffim
t#pq'n@
be matched to the aerial. ln most cases, this C/C++ compiler that can produce executa-
i-E networl< isn't required, and L2 can simply blesforthe 1PC2148.
'ndFN
be replaced by a wire linl< or 0 O resistor. A
fdcdffie#&dml dSpqramtE 31 mm length of wire will do as an aerial, Another reason for staying with Windows
but it's possible to fit an edge-type SMA is the Flash Magiclsl flash tool. Even though
ll
connector to the board. That way, you can WinARM does include its own flash tool
screw a 'WiFi' aerial onto the board - now (lpc21isp), Flash magic, which is free for
Figure 4. Configuring Flash Magic. The
there's class for youl private use, is user-friendly and helps avoid
communications parameters are the most
important ones. For programming, the The suggested Bluetooth modules require finger trouble. This tool also incorporates a
serial port speed must not be above 38,400 just two wires (RX and TX) for communicat- serial port terminal, very handy for debug-
baud. For the terminal, you can choose a ing with the mioocontroller. The RTS and ging. A serial port is often used during pro-
higher speed. CTS signals are however available (well, you gram development to send messages about
never l<now...) and they can be connected whether the program is worl<ing correctly
together if necessary via JP9. or not. Flashing the microcontroller requires
The 3-axis accelerometer lC2 cin be put]nto a serial port too; by using the same port for
LED D4 is intended as an indicator that the standby in order to limit power consump- both these tasl<s, we can mal<e do with just
microcontroller's USB port is connected, tion. lts sensitivity can be altered using two a single cable between the computer and
but there's nothing stopping you using it jumpers. lt is least sensitive when they are the Sceptre. Flash Magic avoids conflicts
for something else. ln this event, remember not fitted. See the data sheet for further between the flash tool and the terminal, as
to remove R16 if the microcontroller's USB details. they can't be enabled at the same time. So
port has to operate at the same time. The thermometer only uses power when you it's impossible to forget to free off the serial
To save power, the SD card reader and the actually tall< to it. lt's a good little device. port each time you want to reprogram the
Bluetooth module are switched using tran- Lastly, jumpers JP6 and JP7 let you choose microcontroller - Flash Magic takes are of
sistors (T2 and T3 respectively). the voltage sources for V0",. (required by everything.
the real-time clocl<) and V,", (needed for
The board has two positions for a Blue- the CNA). It seems that Flash Magic worl<s under Linux
tooth module, one for a Class 1 module and MAC OS X in the WINE Windows emu-
(BTM-222), the other for a Class 2 module Development envi ronment lator I6l.

(BTM-1 12). Once again, the reason is the Programming a microcontroller requires For the sake of completeness, lpc2l isp also
board's power consumption. A Class 1 mod- tools, and that's often where things get includes a terminal, but in order to use it,
ule (1 00 m, 300 ft) draws significantly more complicated. Not for the Sceptre, as the you have to use the same communication
than a Class 2 module (10 m, 30 ft). development tools were part of the original speed for flashing and debugging, as they
The little 'n' network C8. 12, and C9 has specifications: they must be free and multi- can't be specified individually.
platform. The advantage of the ARM core
as used by Sceptre is that there are actu- lnstallation
ally several free compilation chains based So installing the WinARM-based develop-
-aofmdcabns
Ha'dware conris Secudy
.
Jusr tn Ttu co# I,L*!_ MF9 on CCC (CNU Compiler Collection t3l)which ment environment is child's play. Down-
ZJ,e DTB dnd F I 5 ro ronhol PST dnd lSPpm operate under Linux, Mac, and Windows. load the latest distribull6n ral (currently ver_
IKeep FI5 dseiled hhile toM Poil opeh

ll c0 m! T2: 100
We've opted for a collection of tools that is sion 20060606, we haven't yet tried the
beginning to get a bit dated now but which beta version 20080331 ) and unzip the file
-Arieil DTP a.d FTS whh toM Poil oFen
is really easy to install and includes every- onto your hard drive. Add the following line
..) thing you need to get going right away. to the Windows pathname (assuming you
ftrnrjl K I The drawbacl< is that it only operates under have unzipped the file to the C drive root
Windows. We're referring to the WinARM directory):
distribution l4l, a big file that you'll have to
Fb Fl HeF
unzip after downloading it. This distribution C:\WinARM\bin;C:\WinARM\utils\bin;
includes the compiler, the linl< editor, a spe-
@
cial text editor for programming, a tool for This step is not obligatory, you can also
Figure 5. Options -> Advanced Options...: flashing the microcontroller, and lots more enter it at a command prompt or put it into
Checking this box enables Flash Magic to besides. a batch file (.bat) that you run each time
put the Sceptre in programming mode and Of course, just because we happened to you start a Sceptre programming session,
reboot without your having to do anything. choose WinARM doesn't mean you have to like this:

24 o3-201o elel<tor
MICROCONTROLLERS

::: .ath = ?tpath? ; C: \WinARM\ sion 2.12. To do the same thing


: r:-; :: \winARM\utils\bin using the lpc21isp, you'll need to
use the following command:
is WinARM knows everything
i'ou n€€d, installation is now com- Ipc2Iisp -dececconly -
:lete. You can test your installation control main.hex com4 38400
cy compiling one of the examples 12000
included in WinARM, which can be
found here (forthe LPC2148): You need to enter a HEX file, even
if there isn't one. As identification,
WinARM\examples\lpc2 1 3x_ you should get:
ipc214x_examples\
Synchronizing. OK
For greater convenience, we recom- Read bootcode version:
mend you also install Flash Magic 2.L2.4
(which replaces the Readpart ID:
LPC2000 Flash Util- LPC2L48, 572
ity, now obsolete). kiB /
This application is Using Sceptld, you're tn control! 40 KlB
RoM
SRAM
constantly being (673A5253)
updated to add new
processors, so download and install The last number is decimal for
the most recent version. Then con- 0x0402FF25,the num ber found by
figure the tool for Sceptre as shown Flash Magic.
in Figure 4, selecting the correct
COM port. The options in Step 4 To be continued...
only slow programming down, so Experienced readers will now
it's up to you to see if you want to be able to set about developing
use them or not. applications for the Sceptre. You
can already download from l2l the
You may not yet have installed the first version of the C/C++ library
drivers for the Sceptre's serial port we're in the process of developing.
via USB. This port uses a standard Although still far from fi nished, this
FTDI chip, and you can find the driv- library is going to contain functions
ers on I8l (VCP drivers). lf you don't for quicl<ly developing an applica-
l<now if you've already got the driv- tion based on the Sceptre.
ers or not, connect the Sceptre up
to your computer and your operat- Readers in less of a hurry may pre-
ing system (OS) will tell you. Modern OSs ing to detect the microcontroller. lf the fer to wait till next month to find out how
are able to find and install the correct driver advanced options are correct (Figure 5), to implement the Sceptre in detail. See you
all by themselves. using Flash Magic this is achieved by the soon!
command "l5P -> Read Device Signa- (0s0sse-r)
To checl< thecommunication between the ture...". lf everything is alright, you'll get
Sceptre and the computer, it's worth try- the lD 0x0402FF25 and the bootloader ver-

Ii I arduirro.cc [ 5] www.fl ashrnag ictool.comf


[2 J www.elel<tor.coml090559 16l www.winehq.org/

i3 j gcc"gnu.org [7] www.pnotepad.org


14] www.siwawi.arubi.uni-kl.de/avr_projects/arm_projects . -!rm [8]www.ftdichip.com

elel<tor 03-2or o

Вам также может понравиться