|
ETH Zurich :
Computer Science :
Pervasive Computing :
Distributed Systems :
Research :
Smart-Its
Outdated BTnode rev2.2 Documentation
!! Please find up-to-date information at the new BTnode site: www.btnode.ethz.ch !!
Go to:
[Overview],
[Hardware],
[In-system programming],
[Development tools],
[Software].
Overview
The BTnode is an autonomous wireless communication and computing
platform based on a Bluetooth radio and a microcontroller. It serves
as a demonstraton platform for research in mobile and ad hoc
connected networks (MANETs) and distributed sensor networks. The
BTnode has been jointly developed by the Computer Engineering and Networks
Laboratory (tik) and the Research Group for Distributed
Systems. Currently the BTnode is used in two major projects: NCCR MICS and Smart-Its.
BTnode features at a glance
- Microcontroller: Atmel ATmega 128L (8 MHz
8 MIPS)
- Memories: 64Kbyte RAM, 128Kbyte FLASH ROM, 4Kbyte EEPROM
- Bluetooth radio, Ericsson rok 101 007.
- External Interfaces (ISP, UART, SPI, I2C, GPIO, ADC,...)
- 4 LEDs
Quickstart
Before you can start off developing applications for the BTnode rev
2.2 you need to
Hardware
Design documents
The design documents, schematics, data sheets, etc. for the BTnode rev
2.2 (and earlier versions) can be found at
http://www.tik.ee.ethz.ch/~beutel/bt_node.html.
Connectors
Most connectors provide direct access the microcontroller's
external ports (the only exception being the power connector J9 and
the Bluetooth PCM connector J7). The diagram on the right shows the
mapping of the microcontroller ports to the external connectors. These
ports (except the programming port J1) can be used as general-purpose
digital io but have other special functions also (such as a UART and
analog in for the ADC).
All external ports on the BTnode board are 6-pin 1.25mm Molex connectors (socket/
female: 53261, corresponding male
plug: 51021). See the picture on the far right or
top assembly for the location of the ports.
In-System Programming (J1)
For programming the BTnode2.2 with the Atmel STK500 (or any other
programmer) you will need to make your own programming cable with a
Molex 51021 connector. The in-system programming port of the BTnode is
J1.
See the table below for the ISP-port pin configuration of the
BTnode (J1) and the Atmel STK500. The diagram to the right shows how to connect
the BTnode's ISP port to the Atmel STK500.
BTnode ISP (J1) |
Function |
STK500 ISP6PIN |
| 1 |
PDO (MISO) |
1 |
| 2 (see note below) |
VTG |
2 |
| 3 |
SCK |
3 |
| 4 |
PDI (MOSI) |
4 |
| 5 |
RST |
5 |
| 6 |
GND |
6 |
The cheaper AVR ISP
from Atmel has been reported to work also. See
http://smart-its.teco.edu/btnode/ for more detail.
Note 1: The programmer must supply
the operating voltage of 3.3 V to the VTG (target voltage) pin of
the BTnode. Make sure you change the default settings of the STK500
accordingly!
Note 2: Typically, the BTnode is
powered through the programmer (when connected). If however, the
BTnode has its own power supply connected during programming, the pin
VTG of the programmer MUST NOT be connected to the BTnode. Otherwise
the BTnode as well as the programmer may be damaged.
Power (J9)
The BTnode operates at 3.3 V. It has its own power regulator
to reduce battery voltage to the operating voltage, so you can apply
various power sources form 3.3 V up to 12 V to the Power
connector J9. You may also use the pin 1 (Vcc) and pin 6 (GND) on all
other ports (except the in-system programming port J1) as power supply
for the BTnode. However, this will bypass the power regulator. Be sure
to apply 3.3 V only or you will damage the system!
The Vcc and GND pins on the other ports (EXCEPT the in-system
programming port J1) may also be used to supply the operating
voltage of 3.3 V to power external devices.
UART (J4)
The UART (universal asynchronous receiver-transmitter) port is for
serial communication. In the UART1 driver the bautrate is currently
hardcoded to 57600 with no flow control. If you need to change them,
modify and recompile the driver.
The BTnode's UART port operates at 3.3 V. That means if you
want to connect the BTnode to a PC's RS-232 serial port, which
operates at much higher voltage levels (between 3 V and
25 V) you need a level converter, e.g. the IF232 from Elektronikladen
(German site, but they have distributors
in Germany, Switzerland, Sweden, and other countries). See this diagram how to serially connect
the BTnode to a PC using the IF232 level converter.
Sensor-board/ BTnode interconnect: i(2+1)c (J5)
Use this connector to interconnect sensor-board and BTnode. The
communication is based on the i2c bus (aka two-wire interface) plus a
3rd wire. Over the i2c bus, there is a driver-specific protocol
(payload data is framed between header (indicating the payload length)
and trailer bytes). This protocol became necessary to implement packet
transfers over i2c where the length of the data packet is unknown
beforehand. The 3rd wire became necessary to trigger communication
from the BTnode to the sensor board.
| Function |
BTnode |
Sensor board S1.0-2 |
| Vcc |
J5:1 |
I2C:1 |
| i2c CLOCK |
J5:2 |
I2C:4 |
| i2c DATA |
J5:3 |
I2C:3 |
| master trigger |
J5:4 |
I2C:2 |
| n/A (spare) |
J5:5 |
not connected |
| GND |
J5:6 |
I2C:5 |
Bluetooth PCM (J7)
Connector J7 provides access to the PCM voice interface interface of
the Ericsson Bluetooth module. This interface is not needed for data
transfers. If you don't know what PCM is you don't need it.
Other connectors (J2, J3, J6)
The connectors J2, J3, and J6 have no preassigned function and can be
used by the application. These connectors are wired directly to the IO
pins of the ATmega128 (see table below). Every pin can be used as
general purpose IO (GPIO). Additionaly, every pin on the Atmel
ATmega128 can be configured for alternate functions (see section I/O
Ports in the Atmel ATmega128 datasheet).
| BTnode |
ATmega128 |
Alternate function |
| J2:1 |
n/A |
Vcc |
| J2:2 |
PF:7 |
ADC input channel 7 OR JTAG test data input |
| J2:3 |
PF:6 |
ADC input channel 6 OR JTAG test data output |
| J2:4 |
PF:5 |
ADC input channel 5 OR JTAG test mode select |
| J2:5 |
PF:4 |
ADC input channel 4 OR JTAG test clock |
| J:6 |
n/A |
GND |
| BTnode |
ATmega128 |
Alternate function |
| J3:1 |
n/A |
Vcc |
| J3:2 |
PE:3 |
External output for timer/counter3 output compare |
| J3:3 |
PE:5 |
External interrupt 5 input |
| J3:4 |
PE:6 |
External interrupt 6 input |
| J3:5 |
PE:7 |
External interrupt 7 input |
| J3:6 |
n/A |
GND |
| BTnode |
ATmega128 |
Alternate Function |
| J6:1 |
n/A |
Vcc |
| J6:2 |
PB:2 |
SPI bus master output/ slave input |
| J6:3 |
PB:3 |
SPI bus master input/ slave output |
| J6:4 |
PB:1 |
SPI bus serial clock |
| J6:5 |
PB:0 |
SPI slave select input |
| J:6 |
n/A |
GND |
In-system programming
Fuse-bit settings
Before you can use the BTnode you have to program the
microcontroller's fuse bits. Otherwise the microcontroller, which
suffers from the Multiple Personality Syndrome (MPS), thinks it is the
less powerfull ATmega 103. As an effect of this, some programs behave
randomly while others might still work.
Programming the fuse bits needs to be done only once per BTnode. To
do so get AVR Studio 4.05 (for Windows only, the latest revision at
the time of writing this page) from
http://www.atmel.com/atmel/products/prod203.htm. Install it, fire
it up and click the "AVR" button in the menubar. In the popup dialog,
first set the target voltage VTarget to 3.3 V (in the in the
"Board" card), then change the fuse-bit settings (in the "Fuses"
card).
Check the following boxes:
- On-Chip Debug Enable
- Preserve EEPROM memory through the Chip Erase cycle
- Boot flash section size=4096 words Boot start address=$F000
- Brown-out detection level at VCC=2.7 V
- Brown-out detection enabled
- CKOPT fuse (...)
- Ext Crystal/ Resonator, Medium Freq.; Start-up time: 258 CK+4ms
Uncheck all others, especially the "ATmega103 Compatibility Mode" fuse.
The fuses should now read: 0xFF,0xC18C.
The fuse bits are set by uisp using the commands: --wr_fuse_e=0xFF
--wr_fuse_h=0xC1 --wr_fuse_l=0x8C.
This works although reading the fuse bits does not work (uisp-20020626)
Uploading your program
To upload an executable to the BTnode you need a hardware programmer
(Atmel STK500), a programming cable (see above), programming software,
and, of course, the program. As programming software you can either
use AVR Studio for Windows (see Fuse-bit settings above) or
uisp for Linux and Mac OS X. uisp is included in the
tool downloads for Linux and Mac OS X.
To upload a BTnode program, its executable needs to be either in the
"hex" or "srec" formats. There are examples in the system-software
that illustrate how to generate these binary formats from your
sources. (Basically they makefiles create them for you.)
Development tools
We provide a binary distribution of all the software tools required to
compile your own programms and upload them to the BTnode. There is a
binary distribution for Windows, Linux, and Mac OS X:
Development tools documentation
- A GNU Development Environment for the AVR Microcontroller
-
This document attempts to cover the details of the GNU Tools
that are specific to the AVR family of processors:
http://www.enteract.com/~rneswold/avr/.
- AVR libc
-
AVR Libc is an open source project whose goal is to provide a
high quality C library for use with GCC on Atmel AVR
microcontrollers.
- CrossGCC FAQ (Frequently Asked Questions)
Cross-compiling FAQ and the manuals for embedded system
developers using the GNU Compiler Collection:
http://www.objsw.com/CrossGCC/index.html.
BTnode system software
The BTnode system software is basically a library of functions that
provide access to the BTnode resources, such as Bluetooth, serial
communication, LED, and the like. There is also some documentation.
The software is available as a precompiled binary package, as
source-code package, and via anonymous CVS. The binary package
contains everything you need (e.g., libraries, include files,
examples, and documentation) readily made. The source package
obviously contains the sources of the system software, so you can have
a look at the internals or build the library and documentation
yourself. If you need to adapt the library to your needs I recommend
retrieving the sources from CVS.
The binary package needs to be installed into
/usr/local/btnode. To do so, untar the package in
/usr/local. You end up with a directory structure like
this:
./btnode/
./btnode/include/..
./btnode/lib/..
./btnode/doc/..
./btnode/examples/..
Latest release
Binary download package:
btnode-posthackfest-20021125.bin.tar.gz
Old releases
- hackfest-20021104
- Binary download package:
btnode-hackfest-20021104.bin.tar.gz
- experimental-20020909 (quite buggy!)
- Binary download package:
btnode-experimental-20020909.bin.tar.gz
- Source download package:
btnode-experimental-20020909.src.tar.gz
CVS snapshot
cvs -d :pserver:anonymous@vsgr3.inf.ethz.ch:/pub/project/CVSROOT login
(no passwd)
cvs -d :pserver:anonymous@vsgr3.inf.ethz.ch:/pub/project/CVSROOT \
checkout smart-its
Getting started
To compile your first program for the BTnode cd to
/usr/local/btnode/examples/smart-its/avr128 and type
make. You should esnd up with a few executable binaries
(.srec) for the BTnode. To use the program uispand the STK500
programmer to upload a binary to the BTnode using the following
command line:
/usr/local/avr/bin/uisp -v=3 -dprog=stk500 -dserial=/dev/ttyS1
-dpart=ATmega128 -mode=s --erase --upload if=helloworld.srec
There is some API documentation in your installation directory
/usr/local/btnode/doc/smart-its/html/index.html
BTnode rev 2.2 Resources
Acknowledgements
Many thanks to: Jan
Beutel for designing the latest revision and manageing the
production of the BTnode.
Oliver Kasten (myself ;-) for much of the software. Matthias Ringwald for
providing the binary downloads of the tools for Mac OS X. Thomas Moser
and Lukas Karrer for the initial hardware design and software. Most of
the drivers are still based on their code. Urs Baer for the latest
Bluetooth software. All the others that have in some way
contributed. Cheers!
|