Resumen del contenido incluido en la página 1
AVR2070: Route Under MAC (RUM) with IPv6
and 6LoWPAN
MCU Wireless
Features
Solutions
• A FREE 802.15.4 networking solution
- Multi-hop Route Under MAC (RUM)
TM
- All Atmel IEEE 802.15.4 transceivers supported
®
Application Note
- Many AVR microcontrollers supported
• Completely Customizable Firmware
- Ready to use as the basis for a wireless product
- Standalone MAC data layer for small memory footprint
- Optional IPv6/6LoWPAN Interface layer provides worldwide wir
Resumen del contenido incluido en la página 2
2 Stack Architecture Route Under Mac (RUM) is a small 802.15.4 protocol developed by Atmel. This protocol routes packets at the MAC layer, as opposed to the application or IPv6 layer, which would be a route over scheme. The under comes from the fact that routing is done at a low level. This has a number of advantages: • Routers and end nodes can be simpler, and therefore less expensive. These nodes manage almost no routing information. • The coordinator knows all pertinent information
Resumen del contenido incluido en la página 3
AVR2070 2.1 Overview of RUM A RUM network is constructed around a coordinator. The coordinator is the only node that keeps any state information about the network, so that the other nodes do not have to store any network information. This allows for low cost hardware for both routers and end-nodes which comprise the bulk of the network. A router can act as a multi-hop intermediary for other nodes, while an end node can attach to a network, but cannot associate child nodes. Any node i
Resumen del contenido incluido en la página 4
2.3 Supported Hardware Platforms The RUM software distributed with this application note can run on a variety of platforms. The PLATFORM keyword defines several parameters about a board. An example of these parameters is: • Which microcontroller is present on the platform board? • How the microcontroller is connected to the transceiver – which radio pins connect to which port pins on the microcontroller. • Any ADC connections to the microcontroller. • Any LED and switch connections to
Resumen del contenido incluido en la página 5
AVR2070 2.3.3 Raven USB This is the USB stick that comes with the ATAVRRZRAVEN kit. This board has an AT90USB1287 microcontroller, which includes a built-in USB interface. Building for the RAVENUSB platform includes the driver code for the CDC-USB interface. The Raven USB board requires that a miniature 10-pin header (supplied with RZRAVEN) must be soldered in for connection to the JTAG debugging port. The JTAGICE MKII programmer will program the Raven USB board. There is not an IS
Resumen del contenido incluido en la página 6
3 AVR RUM Quickstart In order to operate the RUM demo application, make sure one of the platforms described in this document has been selected, or that a custom platform has been properly defined in the hal_avr.h file. Also the use of an Atmel JTAGICE mkII or AVRISP programmer will be required to program the target microcontroller. After the target platforms and the programming tools required have been gathered, ® ® setup the software necessary for development. For Windows users, AVR Stu
Resumen del contenido incluido en la página 7
AVR2070 Figure 3-1 AVR Studio RUM Project Options Figure 3-2 AVR Studio RUM Compile Flags 7 8240B-AVR-06/09
Resumen del contenido incluido en la página 8
For command line operation using avr-gcc, options should be passed on the command line as define (-D) options, such as: avr-gcc -mmcu=atmega1281 -DF_CPU=8000000UL -DPLATFORM=RAVEN -o radio.o radio.c (etc.) Here is a list of available compile-time flags: Table 3-1 Compile Time Flags Option Name Possible values Meaning PLATFORM RAVEN Build RUM to work with the given platform. RAVENUSB This option can set other options, such as the ZIGBIT9 band the radio operates in (700/800/900MHz Z
Resumen del contenido incluido en la página 9
AVR2070 Option Name Possible values Meaning IPV6LOWPAN 0 Compiles in 6LoWPAN functionality, which 1 gives each node in the network a world- unique IPV6 address, and formats packets according to RFC4944. Without this option, smaller RUM-only frames are used. SENSOR_TYPE 0 (None) Configures the sensor application SENSOR_RANDOM_T (APP=SENSOR) to collect data from the SENSOR_RANDOM_H given sensor type. SENSOR_THERMIST SENSOR_RANDOM_T/_H uses a random number generator to create variable
Resumen del contenido incluido en la página 10
3.3 Build Sizes This section shows various build sizes using different compile flags described from Table 3-1. Table 3-2 Various Build Sizes for AVR and ARM Coordinator Router End Node Raven USB Coordinator 25332 bytes FLASH IPv6 off 4811 bytes SRAM DEBUG on Sensor App SLEEP on Raven - all features (Cannot build IPv6 21138 bytes FLASH 19280 bytes FLASH IPv6 on coordinator on AVR 1901 bytes SRAM 1356 bytes SRAM DEBUG off target) Sensor App SLEEP on Raven without Ipv6 13354 b
Resumen del contenido incluido en la página 11
AVR2070 4 AT91SAM7X-EK RUM Quickstart The Atmel RUM protocol is integrated to run on the AT91SAM7X-EK board which contains an AT91SAM7X256 microcontroller. Additionally, the IPv6/6LoWPAN layers can be compiled in. Compiling in the IPv6 layer will allow the SAM7X platform to act as an IPv6 Edge Router in addition to an 802.15.4 PAN Coordinator. Furthermore, the SAM7X platform supports all the Atmel 802.15.4 transceivers: AT86RF230, AT86RF231 and AT86RF212. The PAN Coordinator performs
Resumen del contenido incluido en la página 12
4.1.1 uTasker Patches Since uTasker is a licensed RTOS, only a binary image has been provided for demonstration purposes. If access to the uTasker source code is required, a license can be acquired via www.utasker.com. uTasker offers excellent licensing programs at no or minimal cost. With a license to uTasker, the source code can be patched to implement the RUM architecture. These modifications add support for the RUM system and user interaction. For instance, a user interface or menu
Resumen del contenido incluido en la página 13
AVR2070 This project should now include the original uTasker OS, SP4, and RUM patch files. A test compile can now be tried using the IDE of choice. Appendix D explains two common IDE’s that can be configured to compile uTasker with RUM support. 4.2 Radio Interface The radio interface is composed of two parts - hardware and firmware. The hardware is generally a radio board with physical connections to a microcontroller with the firmware to manage the interface between the two. 4.2.1 H
Resumen del contenido incluido en la página 14
SAM7X TRX Pin MCU Pin Port Port Function SCK 50 PA22 SPI1_SPCK SEL 49 PA21 SPI1_NPCS0 IRQ 80 PA30 IRQ0 CLKM 70 PB24 TIOB0 SLEEP_TR 13 PA8 PA8 RST 14 PA9 PA9 4.2.2 Firmware The low level driver code is located in two files: hal_arm.c hal_arm.h These files initialize SPI-1 and the discreet IO. Additionally, these files implement handler functions that the remainder of the code uses to interact with the radio. For instance, radio interaction is accomplished through functions such
Resumen del contenido incluido en la página 15
AVR2070 the source code and precompiled code have USB disabled. Due to limitations on the SAM7X board, if a reset is necessary, the USB cable must be removed and any open USB terminal sessions closed and then the board can be reconnected and the USB terminal session restarted. 4.4 Network Interfaces uTasker also supports a telnet interface through the RJ45 network connector. The telnet interface is nearly identical to the serial interface. It offers the same menu selections and utiliz
Resumen del contenido incluido en la página 16
Note: TM The SAM-ICE JTAG adapter does not work for Linux based systems running the Rowley Crossworks IDE. 4.6 Loading the Program ® In order to load the uTasker RUM demo, the AT91SAM-ICE comes with a SAM-BA programmer GUI interface. This needs to be installed on the local PC that is directly connected to SAM-ICE JTAG device. The software can also be downloaded from www.segger.com/download_jlink.html. Various methods to program the AT91SAM7X- EK target have been explained in Appendix D,
Resumen del contenido incluido en la página 17
AVR2070 Figure 4-6-2 SAM-BA File Selection Once the image has been selected in the “Send File Name” field, connect the SAM- ICE JTAG unit to the AT91SAM7X-EK development board. Power on the target and press the “Send File” button. The programmer will begin communication with the AT91SAM7X-EK board and a lock region message should pop-up shown in figure 4-6-3. Figure 4-6-3 SAM-BA Lock Regions Simply select the “No” button to begin programming. Upon completion of programming the t
Resumen del contenido incluido en la página 18
Once the webpages are transferred, the default IP address of 192.168.1.125 must be entered into the selected internet browser of choice to show the main webserver page. The simple web interface provides a quick and easy method for allowing the user to find IPv6 address of the edge router (SAM7X) as well as the IPv6 addresses of the connected nodes (provided the devices had code compiled with IPV6LOWPAN=1). Additionally, a node can be pinged via its short address. Simply enter the hexade
Resumen del contenido incluido en la página 19
AVR2070 Figure 4-7-2 Simple Webserver Network Table 4.8 SD File Handling The maximum size of SD card is 2 GB. The card should be formatted as FAT32. Note that the SD file handling is rudimentary. Users needing more advanced file handling can adapt the system as source code is available. See the files in the directory path “../utasker/Applications/uTaskerV1.3/efsl/”. This file system was adapted from www.efsl.be please refer to the originators for comprehensive details. For the RUM d
Resumen del contenido incluido en la página 20
5 Running the RUM Demo Now that all the platforms have been properly configured with RUM, operating the RUM demo without IPv6 is described in this section. It is assumed there is only one PAN Coordinator per network and the PAN Coordinator can be either the AT91SAM7X-EK board with radio interface, or another small AVR 8-bit based platform described in section 2 (see Appendix E for third-party platforms). Note: If an AVR based platform is selected, there is no Ethernet interface directl