Atmel AVR2070 User Manual

Page of 93
 
AVR2070
 
 
29
8240B-AVR-06/09 
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. To the end-user it should work exactly the same as the demo in section 
5. 
The current release of the code always sends the periodic data to the coordinator. 
This is set up in the sixlowpan_sensorSendPer() function, where the line: 
sixlowpan_hc01_udp_setup_iplocal(DEFAULT_COORD_ADDR); 
This could be changed to send to a global IP address instead. Currently any incoming 
data will have a response sent to the source IP address, be on-link or not. 
6.6 TFTP Bootloading 
The IPv6 example also includes the ability to reload the device’s code over the air. 
Note that this only works when less than half of the FLASH is used – the AVR uses 
half the FLASH to temporarily store the binary. Once the entire binary is received, it 
then copies the binary from the upper half of FLASH to the lower half. 
This effectively limits the bootloading operations to devices with the ATmega1281 or 
ATmega1284 parts, such as the ZigBit or RZRAVEN.  
To use this feature, use any TFTP client that supports both IPv6 and the Blocksize 
option (RFC2348). ‘TFTP Turbo’ version 4.2 or later supports both of these, and is 
available at 
http://corporate.weird-solutions.com/products/tftp-turbo
 for both Linux and 
Windows. 
Since this 6LoWPAN layer does not support fragmentation, it is important to limit 
packet size. For this reason the block size must be specified as 64 bytes. In addition, 
the file name to load should be as short as possible since the file name will be 
transmitted. If a long path is included in the file name, this may also be transmitted 
and cause the message to not be passed over the 802.15.4 network.  
The default AVR makefile will generate a file with the .noboot.bin suffix. This file has 
the bootloader code removed, since that section cannot be reprogrammed. This also 
saves some space, since the entire memory does not need to be transferred. 
Assuming the binary is either copied to the TFTP Turbo directory, or the TFTP Turbo 
directory is in the PATH, the following could be run to bootload the node 
2003:db8:1e1:1:baad:ff:fe00:1 with the ENDrum.noboot.bin file: 
tftpcc -p --blksize 64 2001:db8:1e1:1:baad:ff:fe00:1 
ENDrum.noboot.bin 
There may be messages about incorrect ACKs or timeouts. However if the transfer 
completes, the file was successfully transferred to the AVR end-node. It will 
automatically reflash the contents of the AVR after receiving the last packet, and then 
reset the AVR. 
If sleeping is enabled, the node will be forced awake during the TFTP bootloading 
process. This ensures the transfer occurs at the maximum available speed. If the 
node has Very Low Power (VLP) enabled however, the node is not forced awake as it 
may have insufficient power for a constant wake. Instead the sleep cycle is changed 
to a much faster rate – the current code changes to a 200 mS sleep cycle. This allows 
bootloading to occur at an acceptable rate while still keeping a lower average power 
draw.