User Tools

Site Tools


lab7

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
lab7 [2018/01/25 18:51]
narcisa_ana.vasile [UDP]
lab7 [2018/12/23 15:19] (current)
dan.tudose [Ping]
Line 13: Line 13:
 You need to download a special fork of Contiki to try these changes out. Open a Terminal, and then: You need to download a special fork of Contiki to try these changes out. Open a Terminal, and then:
  
-<code>$ cd ~ +<code bash>$ cd ~ 
 $ git clone https://github.com/narcisaam/contiki-sparrow.git -b sparrow  $ git clone https://github.com/narcisaam/contiki-sparrow.git -b sparrow 
-$ cd contiki/platform/sparrow</code> +$ cd contiki-sparrow/platform/sparrow</code> 
  
  
Line 22: Line 22:
 Open a Terminal, and type these: Open a Terminal, and type these:
  
-<code>+<code bash>
 $ sed -i '/avr/d' /home/user/.profile  $ sed -i '/avr/d' /home/user/.profile 
 $ sudo aptitude update  $ sudo aptitude update 
-$ sudo apt-get install avr-libc gcc-avr binutils-avr avrdude git</code> +$ sudo apt-get install avr-libc gcc-avr binutils-avr avrdude git libc6-i386</code> 
  
 Then log out of the machine and back in again (or restart it). Then log out of the machine and back in again (or restart it).
Line 33: Line 33:
 ==== Default avrdude port ==== ==== Default avrdude port ====
  
-Edit Makefile.sparrow, and change the default avrdude port to match your local settings. This only needs to be done once ever.+Connect the Sparrow board to your computer through USB. Once this is done, you'll likely see a new //ttyUSB// port appear in ///dev//. In the folder ///contiki-sparrow/platform/sparrow// edit Makefile.sparrow, and change the default avrdude port to match your local settings. This only needs to be done once ever. From now on in this tutorial we'll assume the board is connected to //ttyUSB0//, but you can modify according to your local settings.
  
- <code> AVRDUDE_PORT ?= /dev/ttyUSB0 </code>+ <code bash> AVRDUDE_PORT ?= /dev/ttyUSB0 </code>
  
 ==== MAC Address / Node Number ==== ==== MAC Address / Node Number ====
Line 41: Line 41:
 Each node needs a unique MAC address. The sparrow platform expects to find the MAC address as the first 8 bytes in EEPROM. Each node needs a unique MAC address. The sparrow platform expects to find the MAC address as the first 8 bytes in EEPROM.
  
-There is a special program just to program the MAC address. Check up //tools/set-eeprom/set-eeprom.c// - it should look like this:+There is a special program just to program the MAC address. In the ///contiki-sparrow/platform/sparrow// folder, check up //tools/set-eeprom/set-eeprom.c// - it should look like this:
  
 <code C> <code C>
Line 51: Line 51:
 It uses the same first 7 bytes, and lets you choose a different number for the last. From this point forward, we will refer to that last digit of the MAC address as the "Node number". To assign a node number to your node: It uses the same first 7 bytes, and lets you choose a different number for the last. From this point forward, we will refer to that last digit of the MAC address as the "Node number". To assign a node number to your node:
  
-<code>$ cd tools/set-eeprom +<code bash>$ cd tools/set-eeprom 
 $ make NODE=3 AVRDUDE_PORT=/dev/ttyUSB0 </code> $ make NODE=3 AVRDUDE_PORT=/dev/ttyUSB0 </code>
  
Line 57: Line 57:
 ===== Hello World ===== ===== Hello World =====
  
-From a terminaltype...+Go back in your terminal to ///contiki-sparrow/platform/sparrow// and type...
  
-<code>$cd tests/hello-world +<code bash>$cd tests/hello-world 
 $make upload  $make upload 
 $make login </code> $make login </code>
Line 65: Line 65:
 Working correctly, you should see this: Working correctly, you should see this:
  
-<code>connecting to /dev/ttyUSB0 (57600) [OK]  +<code>*******Booting Contiki 2.5******* 
-Power-on reset. External reset!  +MAC address 2:11:22:ff:fe:33:44:3 
-*******Booting Contiki 2.5*******  +nullmac sicslowmac, channel 26, check rate 65535 Hz 
-MAC address 2:11:22:ff:fe:33:44:3 nullmac sicslowmac, channel 26  +Routing Enabled 
-IP addresses [4] fdfd::3 fe80::11:22ff:fe33:4403  +Autostart other processes
-Hello, world </code>+
  
 +IP addresses [4 max]
 +fdfd::3
 +fe80::11:22ff:fe33:4403
 +Hello, world
 +</code>
 ==== Ping ==== ==== Ping ====
  
 Now that we know the node itself is working and printing OK, we want to make sure two nodes can talk. The best way to do this is with a ping. Now that we know the node itself is working and printing OK, we want to make sure two nodes can talk. The best way to do this is with a ping.
  
-This requires two nodes. If you already have hello-world on one node, the easiest thing to do is to put ping-ipv6 on a second node, and ping the other. So for this example, say we already have hello-world working on node 3 on /dev/ttyUSB0.+This requires two nodes. If you already have hello-world on one node, the easiest thing to do is to put //ping-ipv6// on a second node, and ping the other. So for this example, say we already have //hello-world// working on node 3 on ///dev/ttyUSB0//. 
 + 
 +We'll connect a second node to the computer, and presume it's connected to ///dev/ttyUSB1// and it's already been configured with node address 1. For this node, we'll need to compile and upload the //ping-ipv6// app and specify the node we'll want to ping
  
-<code>$ cd tests/ping-ipv6 +<code bash>$ cd tests/ping-ipv6 
 $ make upload AVRDUDE_PORT=/dev/ttyUSB1 NODE=3  $ make upload AVRDUDE_PORT=/dev/ttyUSB1 NODE=3 
 $ make login AVRDUDE_PORT=/dev/ttyUSB1 </code> $ make login AVRDUDE_PORT=/dev/ttyUSB1 </code>
Line 135: Line 141:
 ===== The Shell ===== ===== The Shell =====
  
-The shell is a very powerful feature of Contiki. Within this OS lies a fully-featured command shell. The shell in the avr-zigduino platform is a subset of the full Contiki shell, including only the shell modules which have been proven to work on this platform.+The shell is a very powerful feature of Contiki. Within this OS lies a fully-featured command shell. The shell in the sparrow platform is a subset of the full Contiki shell, including only the shell modules which have been proven to work on this platform.
  
 ==== Building ==== ==== Building ====
Line 185: Line 191:
 === blink & kill === === blink & kill ===
  
-Try "blink 100 &" to start blinking the LED's for 100 times. Notice the '&' at the end of that! You should now see all 3 LED'on Zigduino flash on and off repeatedly.+Try "blink 100 &" to start blinking the LED's for 100 times. Notice the '&' at the end of that! You should now see Sparrow'LED flash on and off repeatedly.
  
 Then type "kill blink" when you're done admiring your blinking lights. Then type "kill blink" when you're done admiring your blinking lights.
lab7.1516899081.txt.gz · Last modified: 2018/01/25 18:51 by narcisa_ana.vasile