AVR2070: Route Under MAC (RUM) with IPv6 and 6LoWPAN Features • A FREE 802.15.4 networking solution - Multi-hop Route Under MAC (RUM) - All Atmel IEEE 802.15.
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.
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.
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.
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.
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.
AVR2070 Figure 3-1 AVR Studio RUM Project Options Figure 3-2 AVR Studio RUM Compile Flags 7 8240B-AVR-06/09
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 8 Possible values Meaning PLATFORM RAVEN RAVENUSB ZIGBIT9 ZIGBIT24 Build RUM to work with the given platform. This option can set other options, such as the band the radio operates in (700/800/900MHz or 2.
AVR2070 Option Name Possible values Meaning IPV6LOWPAN 0 1 Compiles in 6LoWPAN functionality, which gives each node in the network a worldunique IPV6 address, and formats packets according to RFC4944. Without this option, smaller RUM-only frames are used. SENSOR_TYPE 0 (None) SENSOR_RANDOM_T SENSOR_RANDOM_H SENSOR_THERMIST Configures the sensor application (APP=SENSOR) to collect data from the given sensor type. SENSOR_RANDOM_T/_H uses a random number generator to create variable temp/humidity data.
3.3 Build Sizes This section shows various build sizes using different compile flags described from Table 3-1.
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.
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.
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.
TRX Pin SCK SAM7X MCU Pin 50 Port PA22 Port Function 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.
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.
Note: The SAM-ICETM 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.
AVR2070 Figure 4-6-2 SAM-BA File Selection Once the image has been selected in the “Send File Name” field, connect the SAMICE 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.
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.
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.
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).
AVR2070 Table 5-1 ARM Telnet Menu Commands ASCII Command Description a (lowercase) IP Address. This is the current IPv4 address of the SAM7X. A (uppercase) IPv6 Address. This is the IPv6 address that has been self configured or configured as a result of connecting to a true IPv6 router. b Break. This allows the user to stop collecting data to the SD card. c (lowercase) Channel. This allows the user to change the operating channel. C (uppercase) Calibrate.
Table 5-2 AVR Serial Menu Commands 22 ASCII Command Description T Touch. Ping or send a Reading (asks for ‘p’ or ‘r’ & interval time). c Channel. This allows the user to change the operating channel. d Dump. This shows the current content of the radio control registers. i Info. This provides a quick display of current radio settings including, PANID, Channel, Short Address, etc. n Name. Allows the user to set the name of a node – 11 characters max. p (lowercase) Ping.
AVR2070 6 Running the IPv6 Demo This demo requires the AT91SAM7X-EK to be used as the PAN Coordinator, due to the Ethernet interface available on the board. The demo is separated into four parts. The first is the ‘ping’ demo which simply verifies IPv6 network connectivity. The next is the ‘UDP’ demo which demonstrates remote control of a node. The example sensor application used in section 5 will then be run on IPv6. Finally a TFTP client will be used to load new code onto an end node using IPv6.
If an IP address for the Ethernet side is not seen, this means an IPv6 router was discovered on the network. However the router is NOT advertising a prefix using stateless auto configuration. Router advertisements must either be disabled on the router, or set the router to allow stateless auto configuration. The IPv6 prefix for the 6LoWPAN side (aka: 802.15.4 radio) is obtained from the setting on the first webpage.
AVR2070 6.3 Using the 6LoWPAN / IPv6 Code on End Nodes The 6LoWPAN / IPv6 API is documented using the Doxygen documentation system. What follows is an overview of how the example application works, and is not the full API documentation. Refer to Appendix C for the entire API documentation. The code is designed primarily to pass data around using the UDP protocol. The user application can send data to any arbitrary IP address, or the user can respond to an incoming UDP packet.
The IPSO demo has two parts to it. The first part is an interactive control to allow polling of the sensor and configuration tasks. The second part is to have the sensor automatically send data to a central server. The wireless sensor node listens on three UDP ports, their use is as follows: Table 6-4-1.
AVR2070 A A0 A1 A A1 HTL H50T22.5L50 A0A A0 This also demonstrates how multiple commands could be sent at once. The sensor always sends its packets back to the source port specified in the original packet. Note If a response is not received, try sending either the 'A1' or 'A0' command to turn on and off the LED. If the LED responds, the node is receiving the message, but the response is not being passed back.
When setting an IP address, the full IP address must be specified with all zeros present. If the address is short any bytes, the node will respond “length error”. The 'server address' is the IP address which the node automatically sends readings to. The 'button press address' is the IP address which the node sends a certain message to only when the button is pressed. The 'G' command returns a timestamp in front of the last received message. This timestamp is in milliseconds, and is a 16-bit value.
AVR2070 By passing the messages over an IPv6 link, it does not matter if the sensors communicate directly with the coordinator or with some other computer. As well multiple sensor networks could report to a single coordinator device, even if that coordinator is physically located far away from the other networks. The communication is done using UDP, with a port-number of 61619. To run this demo, simply compile the AVR end-nodes with APP set to ‘SENSOR’ and IPv6 enabled.
6.7 Sleeping Nodes A node that spends much its time asleep is good for battery life, but makes IP connectivity harder. If a node only wakes up every 5 minutes, attempting to ping the node will either fail or have a very long latency. The 6LoWPAN sleeping system contains an extension of the RUM sleeping system. The RUM sleep system provides a method to buffer some packets to a sleeping node.
AVR2070 Appendix A - Route Under MAC (RUM) Protocol A.1 Overview This appendix outlines the scheme used by RUM for implementing a route-under network, where the routing of network packets is done at the MAC layer. This has a number of advantages: • Routers and end nodes can be simpler, and therefore less expensive. These nodes manage almost no routing information.
8. Some pre-deployment configuration can be used to determine whether a given node should or can join a given network. This configuration is part of the application, not the MAC. 9. Only short (16-bit) 802.15.4 addresses are used in sending data over the network except during association, since a new node does not have a short address until it is issued one. 10. The coordinator's short address is defined to be 0x0000. A.4 Implementation Details A.4.
AVR2070 Figure A-4-2 Direct Association Message Sequence End/Router Node Pan Coord Node Association Request Association Response The node then associates to its parent as illustrated in figure A-4-2 (above): The node sends an Association Request packet to the chosen router (or coordinator). The association request payload includes the MAC address of the end node, the short address of the parent router node, and the type of the requesting node (router or end).
Figure A-4-3 In-Direct Association Message Sequence End/Router Node Router Node Pan Coord Node Association Request Direct Association Request Indirect Association Response Indirect Association Response Direct When a router node starts up, the router does the following steps: 1. Perform the steps that an end node does, as outlined above. This results in the router becoming associated to the network, with a short address and a parent. 2. Listen for beacon requests.
AVR2070 • If neither of the above conditions apply, then send the packet to the last routed address used for sending (which was stored from a routing frame). 4. If an association response is received with the router's short address as parent, then add the child node to a table of child nodes and short addresses, and forward the association response to the new child node. 5. Listen for frames received from non-parent nodes – both end nodes and other routers. Forward all frames to parent.
• The destination node must be more than two hops away from the coordinator. For one or two hops, there is no ambiguity in the route, so no routing packet is required. • The last time a packet was sent through the top-most router in a sub-tree, the destination address was different from the address of the packet currently being sent. 5. To create a routing packet, the coordinator builds a list of short addresses for each node in the chain to get to the destination node.
AVR2070 Figure A-5-1 Example Network Commissioning Diagram R9 R8 SA: 0x0000 (always) C E1 R1 R3 SA: 0x0006 R2 E3 SA: 0x0007 E2 SA: 0x0003 SA: 0x0002 SA: 0x0004 SA: 0x0005 Legend: C = coordinator Rn = Router En = End node SA = Short address FCF - Frame Control Field, see IEEE 802.15.4 Spec. SEQ - Frame Sequence Number PID - PAN_ID CSA - Coordinator Short Address MAC - MAC Command Frame ID, see IEEE 802.15.4 Spec. A.5.
Table A-5-1. Beacon request and beacon frames E1 FCF – beacon req Seq Broadcast PAN ID 0x0803 01 0xffff C FCF – beacon 0x8000 Seq PID 01 0x1234 Broadcast short addr 0xffff Coord SA 0x0000 Superframe 0x40ff 07 (beacon req) 0x07 ID (6=6LoWPAN) 0x06 Hops 0 E1 selects C based on zero hops, and sends association request. The payload contains E1's MAC address, and the SA of the parent.
AVR2070 C sends association response. Table A-5-7. Associaton response (direct) C FCF – assoc rsp Seq PID E1 MAC 0x8C63 03 0x1234 0x3333444455556666 Coord SA 0x0000 MAC Cmd 02 R1 SA 0x0003 R1 stores two addresses: Parent (coord) SA and R1 SA. A.5.3 Example 3 – Router R3 connects to Coordinator C This example is identical to example 2, except that R3 receives a beacon from R1 as well as C.
Table A-5-11. Association response (direct) R1 FCF – assoc rsp Seq PID R2 MAC addr 0x8C63 03 0x1234 0x5555444433332222 R1 SA 0x0003 MAC 02 R2 SA 0x0006 R2 saves its parent's short address and its own short address. A.5.5 Example 5 – End node E2 connects to network This example shows an end node connecting to the network, through two routers R2 and R1. E2 scans for routers, and selects R2 based on LQI/hops/RSSI. It then sends a direct association request. Table A-5-12.
AVR2070 A.6 Routing packets There is a special packet used to create a route for a packet leaving the coordinator toward any router or end node. Each router node keeps track of the last address it sent a routing packet to, and will send each later (non-routing) packet from its parent to the same address (unless the packet is addressed to a child node). This way, the coordinator can send one routing packet to an end node, followed by many data packets.
Table A-6-3. End node E2 to Coordinator C via Router R2 E2 FCF – Seq PID R2 SA E2 SA Final Dest Data 34 0x1234 0x0006 0x0007 SA 0x8861 0x0000 Origin SA 0x0007 Data payload A data frame from a child node is passed to the coordinator. The source and destination addresses in the 802.15.4 frame header are changed for each hop, but the rest of the frame is unchanged. Final destination and origin addresses do not change as the packet progresses through the network.
AVR2070 Appendix B - Firmware API Overview This appendix discusses how the RUM firmware is implemented, what Application Programming Interface (API) functions are present, and gives some detail about what functions are called to implement the RUM protocol. The firmware source, available with this Application Note, has been extensively documented in source code comments. This documentation exists as HTML pages which are generated from the source itself using the Doxygen program.
Figure B-1 Overall Program Structure. If a frame was received by the radio, it is transferred from the transceiver into a receive buffer in the host processor. End-of-transmit interrupts and energy detect interrupts are dispatched from the ISR and values stored for later processing from the main loop.
AVR2070 Figure B-2 appInit overview 45 8240B-AVR-06/09
Figure B-3 macTask overview 46 AVR2070 8240B-AVR-06/09
AVR2070 Figure B-4 macDataIndication overview 47 8240B-AVR-06/09
Figure B-5 Frame routing overview Routing Start Am I coordinator? Coord Send routing packet if necessary Is dest a child of mine? No Resend packet to first router in chain Router Yes Is destination my child? Yes Send packet to child (destination) Resend packet to child (destination) No Is this frame from parent? Yes 48 No Packet is from child – resend to my parent Send to default router (see macConfig.
AVR2070 Figure B-6 Radio ISR overview 49 8240B-AVR-06/09
The flowchart shown in Figure B-5 shows how the RUM protocol routes packets. Most of this processing occurs in the macRouteData() function. The flowchart shows that just a few simple rules are needed to route packets to their destination. B.2 RUM API An application talks to the MAC by using a few function calls in the MAC, and the MAC communicates events back to the application by calling pre-defined callback functions.
AVR2070 For more detailed examples of association and sending sensor data, see MAC function calls and Sensor application function calls. There are a few other useful functions that the MAC offers. These functions are useful for making a non-networking application, such as a remote control unit. • macIsChild() reports on whether a given node is a child of this node. • macSetOperatingChannel() can be used to manually set the radio channel.
B.3 6LoWPAN API This group of functions is used to send a UDP packet to a node either on the wireless network (‘iplocal’) or somewhere outside the wireless network (‘ipglobal’). The source and destination ports are set, the payload loaded, and finally the UDP packet is sent. The Doxygen documentation provides specific examples.
AVR2070 Figure B-7 AVR 6LoWPAN DataIndication 53 8240B-AVR-06/09
Figure B-8 ARM 6LoWPAN DataIndication sixlowpan_DataIndication() Start Call 6LoWPAN Layer to uncompress packet to buffer Call IPv6 Layer on uncompressed packet End B.4 Writing a Custom Application Using RUM RUM is meant to be a base upon which a custom application can be written for a wireless product. There are a few steps to doing this. • Make sure the hardware is compatible with RUM. • Add a new PLATFORM definition to RUM for the new hardware.
AVR2070 and the RF231 and RF212 radios can be configured for rising or falling edge via the IRQ_POLARITY register value. In addition, there are some GPIO signals that must be connected to the microcontroller: • RST – Reset signal, active low • SLP_TR – Sleep/Transmit signal. See radio datasheet for details. • CLKM – Optional clock output from the radio. • SCLK – SPI clock • MOSI – SPI Master Out/Slave In signal • MISO – SPI Master In/Slave Out signal • SEL – Radio select line, active low.
#ifndef __AVR_ATmega1281__ #error "Incorrect MCU for Platform! Check Makefile" #endif // Set this to the port that the SEL pin is connected to # define SSPORT B // Set this to the pin # define SSPIN that the SEL pin is connected to (0x00) // Set this to the port that the SPI port is on # define SPIPORT B // Set this to the pin that the MOSI signal is on # define MOSIPIN (0x02) // Set this to the pin that the MISO signal is on # define MISOPIN (0x03) // Set this to the pin that the SCLK signa
AVR2070 # define HAL_INIT_ADC() DIDR0 |= (1 << ADPIN), \ ADMUX = 0xC0 | ADPIN, ADCSRA = 0x84 # define HAL_STOP_ADC() ADCSRA &= ~0x80 # define HAL_SAMPLE_ADC() ADCSRA |= (1 << ADSC) \ | (1<< ADIF) # define HAL_WAIT_ADC() while (!(ADCSRA | (1<
control) and press the enter key. A simple terminal menu should be printed, and the ASCII 'd' character should cause a dump of the radio's register set. If these values look reasonable (not all zero's or 0xff's), then the radio is connected properly. If terminal display does not print, then the radio code is probably stuck, waiting for the transceiver to initialize, which will never happen if the radio isn't able to communicate over the SPI port. 2.
AVR2070 Appendix C - IPv6 / 6LoWPAN Background Using IPv6 and 6LowPAN will be easier if an understanding of the underlying technologies is in place. This section assumes familiarity with the RUM network outlined in Appendix A. C.1 The problem with RF-Only Networks Atmel® provides the RUM network layer as a very easy method of passing messages around the wireless network. Problems occur when messages need to be passed outside the wireless network. Any wireless protocol designed specifically for the 802.15.
Any leading zeros can be dropped, writing addresses like: 2001:DB8:0:0:8:800:200C:417A Finally a number of zeros in the middle of the address can be replaced with '::', as such: 2001:DB8::8:800:200C:417A All IPv6 networks have a “prefix” associated with them. Everything on the same network has the same prefix, so for example the network might have the prefix 2001:0DB8:0000:0000::/64. The '/64' means the prefix is 64-bits long.
AVR2070 Figure C-4-1 IPv6 Router Discovery C.4.3 Node Auto-configuration On power-up a node uses these packets to acquire an address using stateless autoconfiguration. It first auto-configures a link-local address by using the fe80:: prefix followed by an interface identifier description (IID) based on its physical address. It then sends a neighbor solicitation packet looking for someone else with this same address – this is the duplicate address detection (DAD) phase.
10. Node is now on the network. It can be seen how IPv6 simplifies auto-configuration of network addresses. Nodes no longer require DHCP to acquire an address. IPv6 does support DHCPv6 (called stateful auto-configuration) should the extra features be required. C.5 6LoWPAN Basics Consider that the IPv6 header alone is 40 bytes long, and IPv6 specifies that a packet may be at least 1280 bytes. At first glance it would seem crazy to attempt to combine this with 802.15.
AVR2070 Traffic Class and Flow Label encoding A message will be properly parsed by end-nodes regardless if traffic class and flow label is compressed or uncompressed. However the value itself is not read, hence to avoid wasting space all messages should have the traffic class and flow label set to zero. Address Compression The code supports carrying all 128 bytes; or compressing an address down to 64, 16, or 0 bytes of extra payload.
Compared to normal IPv6 networks, there are some differences to how a node acquires its IPv6 address. A typical startup sequence on this Atmel 6LoWPAN network is (shown in Figure C-4-1): 1. Node associates to coordinator using RUM protocol, and is assigned an 802.15.4 short address 2. Node sends IPv6 router solicitation to edge router (coordinator) 3. Edge router sends router advertisement back, including IPv6 prefix 4. Node stores this prefix as the default context it uses in all communication 5.
AVR2070 Appendix D - AT91SAM7X-EK Development Tools uTasker can be compiled in a number of different environments: IARTM, Rowley Crossworks and EclipseTM (with gcc). The discussion that follows here is based on the Rowley Crossworks tool chain and the Eclipse tool chain. D.1 Folder Structure The complete source code for the ARM and AVR based platforms are contained in the folder structure shown in figure D-1-1. This is the folder structure as downloaded from www.atmel.com.
Figure D-1-3 uTasker and RUM Integrated Folder Structure D.2 Rowley Crossworks IDE Rowley Crossworks is a cross platform IDE that is lower cost alternative to other ARM development IDE’s on the market. There are many license models available. Rowley Crossworks and detailed documentation can be downloaded for the ARM from www.rowley.co.uk/arm/index.htm. Following are the steps necessary to setup Crossworks for the first time and subsequent debug sessions. 1.
AVR2070 5. Load J-Link .dll for debugging a. Target -> Connect Segger J-Link b. Should see “DLL WARNING” c. Select Tools -> Targets d. Highlight “Segger J-Link”, right-click and select “Properties” as shown in figure D-3-1. e. Find Properties window in lower right corner, make sure properties of “Segger J-Link” is selected. f. Highlight “J-Link DLL File” g. Locate .dll file from Segger folder Files/SEGGER/JLinkARM_V392/JLinkARM.dll) (ie. C:/Program h. Re-do Step A. i.
folder structuring has been properly followed; the Rowley project file should build as expected. Figure D-2-2 Rowley IDE The Rowley Crossworks interface looks like the image shown in figure D-2-2. The Rowley compile option flags can be set via the IDE. Click on Project -> Properties to locate the Preprocessor Options. Figure D-2-3 shows what the configuration screen looks like. Complete descriptions of compile time options are found in section 3.2.
AVR2070 Figure D-2-3 Rowley Project Properties Then click on the ellipsis button to bring up the Preprocessor Definitions window. Figure D-2-4 Pre-processor Definitions The code can be built by either pressing the F7 key or by clicking on the Build the menu item and then clicking on Build -> uTaskerV13. After successfully compiling the code it can be downloaded to the target using the SAM-ICE (or CrossConnect) JTAG adapter.
Note: Sometimes the SAM7X will retain old FLASH values such as IP addresses. This can be a valuable feature during code reloads to keep static variables. To ensure that the memory is purged, the Erase jumper on the SAM7X board can be connected to ground. Doing so will completely erase the memory and will ensure that reloaded code will implement new values. D.3 Eclipse IDE D.3.1 Required Tools Besides the RUM source code, a few external tools are needed.
AVR2070 Figure D-3-1 Eclipse Workspace Selection In this example they are stored in the f:\eclipse_projects directory.
Finally the RUM project can be imported. This is done by going to the “File -> Import” menu.
AVR2070 Point the root directory to the RUM source code. It should automatically find the project, and optionally one can check the “Copy projects into workspace” option to copy the source files to a local Eclipse workspace. Figure D-3-5 Eclipse Import Project Screen Upon hitting the “Finish” button, Eclipse will import all the files. This will also copy them to the local working directory if that option was selected. Some paths need to be updated to reflect the local development system.
Change the “compiler invocation command” to point to the YAGARTO installation. In this example it is located at C:\Program Files\yagarto\bin\arm-elf-gcc.
AVR2070 Next open the “Settings” pane under “C/C++ Build”. Select the “GNU Elf Parser” checkbox, then point both the addr2line and c++filt command to point to the YAGARTO commands. In this case this was C:\Program Files\yagarto\bin\arm-elfaddr2line.exe and C:\Program Files\yagarto\bin\arm-elf-c++filt.exe respectively. Figure D-3-7 uTasker Project Properties Binary Parser Hit OK, and attempt to rebuild the project. Select “Project -> Clean”, and it should clean and then rebuild the project.
Figure D-3-8 Eclipse Debug Plugin Press “Add Site” and add the site http://opensource.zylin.com/zylincdt and press OK. Now select the “zylincdt” and hit “Install”: Figure D-3-9 Eclipse Zylincdt Install Completing the install will require agreeing to the terms of the license agreement. If asked to restart Eclipse, press “Yes” to do so.
AVR2070 D.3.5 Programming the FLASH First programming the FLASH memory with SAM-PROG will be covered. With the SAM-ICE connected, open the SAM-PROG program. Point to the file at Applications\UTaskerV1.3\GNU_SAM7X\uTaskerV1.3.bin. Ensure the “None” and “Auto-mode” checkbox are checked. Figure D-3-10 SAM-PROG Flash Programmer Then hit the “Yes” button under “Target Connected”, and the device should be programmed. With the FLASH programmed, it is now a matter of debugging the program.
Figure D-3-11 Segger J-Link Connection Screen Next Eclipse needs to be set up to work with the GDB Server.
AVR2070 A new window will pop up, and select the “Zylin Embedded debug (Native)” category, and hit the new button. Set the name, and then set the project by hitting the “Browse” button and selecting the project. Assuming the project has successfully been built, pressing the “Search Project” button beside the “C/C++ Application” line should acquire the ELF file for this project. Next, select the “Debugger” tab. Set the GDB debugger to the location of the “arm-elfgdb.
monitor endian little # Set JTAG speed to 30 kHz monitor speed 30 # Reset the radio to get to a known state.
AVR2070 this tutorial the external SAM-PROG tool is used instead. The flash breakpoints feature removes the limit of two hardware breakpoints. Figure D-3-14 Eclipse GDB Server - Commands Now hit the “Debug” button, and Eclipse should ask to open the debug perspective.
Figure D-3-16 Debugging Tools The “Variables” section contains all local variables for the current function. To add a global variable press the “Add Global Variable” button. It has the eyeglasses above a globe: Figure D-3-17 Debug Watch Variables Additionally variables can be added by the “Expressions” tab. To open this Go to the “Window/Show View/Expressions” option. Add a variable by right-clicking and pressing “add watch expression”, then writing in the variable name.
AVR2070 Figure D-3-20 Debug Terminate/Disconnect Option Once debugging is finished, the process can begin again. After re-compiling, it is imperative to ensure the flash is reloaded with the SAM-PROG program. Simply starting a debug process again does NOT download new code, unless the extra flash programming module is purchased. The code must be reloaded with SAM-PROG.
Appendix E - Third-Party Reference Designs / Platforms This section describes various reference designs that can be purchased from distributors like Dresden Elektronik (www.dresden-elektronik.de) and TRT Technology (www.trttech.com). These platforms are supported within the RUM source code for alternate evaluation and development options. E.
AVR2070 Figure E-1-1 AT91SAM7X-EK Standard Board Figure E-1-2 REB and REX_ARM adaptor Figure E-1-3 AT91SAM7X-EK with REB/REX_ARM Connected 85 8240B-AVR-06/09
E.2 RCB212 This platform is a version of RCB (Radio Control Board) from Atmel, designed specifically for the AT86RF212 radio (in the 900 MHz band). Because this board operates in a different band from the RCB230 and RCB231 boards, RUM expects an RF212 radio on this platform. The REB (Radio Extender Board) for the RF212 also works with this profile. This platform uses an ATmega1281 microcontroller, has three LED's, one push button, and a serial port for debug use. E.
AVR2070 E.5 DSK001 This platform is a small circular PCB containing an RF230 or RF231 radio transceiver, an ATmega48/88/168/328 family microcontroller, a temperature sensor, and a three axis accelerometer. This board is available from TRT Technology (www.trttech.com), along with programming hardware and a compact plastic case. This platform has been FCC certified. E.6 Compile Time Settings These platforms can be compiled by defining the proper platform that was selected.
Glossary 6LoWPAN - A scheme to compress and fragment IPv6 packets for transmission over an 802.15.4 wireless network. See RFC-4944 online for details. Association - The method by which a new node joins the network. After association, a node is part of the network and can communicate freely with any other node on the network. AVRISP - An Atmel programming tool for writing object code into most Atmel processors. Another similar tool is the JTAGICE MK-II. Beacon - A special frame used to identify a network.
AVR2070 Multi-hop - A network that can relay packets over several wireless nodes to a destination. RUM has multi-hop capability, which allows a packet to send data to nodes that are out of range of the sending node. PAN - Personal Area Network. Generic name for an IEEE 802.15.4 network. PAN ID - Personal Area Network ID. A 16-bit identifier of a given network. All nodes on a PAN use this ID number as part of the addressing scheme.
Table of Contents Features ............................................................................................... 1 1 Introduction ...................................................................................... 1 2 Stack Architecture ........................................................................... 2 2.1 Overview of RUM ................................................................................................ 3 2.2 Overview of IPv6 and 6LoWPAN ................................
AVR2070 6.4.1 Commands on Port 61616....................................................................................... 26 6.4.2 Commands on Port 61618....................................................................................... 27 6.5 Sensor App Example......................................................................................... 28 6.6 TFTP Bootloading ............................................................................................. 29 6.7 Sleeping Nodes .............
C.5.1 Draft-ietf-6lowpan-hc01........................................................................................... 62 C.6 6LoWPAN Compressed Header....................................................................... 63 Appendix D - AT91SAM7X-EK Development Tools........................ 65 D.1 Folder Structure ................................................................................................ 65 D.2 Rowley Crossworks IDE ................................................................
Disclaimer Headquarters International Atmel Corporation 2325 Orchard Parkway San Jose, CA 95131 USA Tel: 1(408) 441-0311 Fax: 1(408) 487-2600 Atmel Asia Unit 1-5 & 16, 19/F BEA Tower, Millennium City 5 418 Kwun Tong Road Kwun Tong, Kowloon Hong Kong Tel: (852) 2245-6100 Fax: (852) 2722-1369 Atmel Europe Le Krebs 8, Rue Jean-Pierre Timbaud BP 309 78054 Saint-Quentin-enYvelines Cedex France Tel: (33) 1-30-60-70-00 Fax: (33) 1-30-60-71-11 Atmel Japan 9F, Tonetsu Shinkawa Bldg.