Changes between Initial Version and Version 1 of Tutorials/e0BTZG/Tutorial00_RZRAVEN


Ignore:
Timestamp:
Jan 24, 2018, 3:52:36 PM (6 years ago)
Author:
nilanjan
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Tutorials/e0BTZG/Tutorial00_RZRAVEN

    v1 v1  
     1== Example: RZRAVEN USB Stick - Jackdaw Contiki platform
     2This tutorial will walk through detecting the RZRAVEN on a node to compling and loading an example Contiki embedded OS image onto the device. The Contiki operating system boasts to be a minimal foot-print resource-efficient low-power operating system for microcontrollers with limited memory. More information on Contiki can be found on [http://contiki.sourceforge.net/docs/2.6/index.html Contiki 2.6]
     3
     4
     5=== Hardware / Software Utilized ===
     6 * Grid nodes with [http://contiki.sourceforge.net/docs/2.6/a01799.html RZRAVEN USB stick].
     7 * [http://www.microchip.com/DevelopmentTools/ProductDetails.aspx?PartNO=atatmel-ice Atmel's ICE debugger] for loading an image onto the USB stick.
     8 * Node image with ubuntu 64-bit version 16.04 or greater, AVR software and Contiki OS. For this example we can use 'ubuntu-16-04-64bit-rzraven.ndz' since this image has all the necessary components installed.
     9
     10 || [[Image(RZRAVEN.jpg, width=500px)]] ||
     11
     12
     13=== Set up ===
     14 To get started, please follow the instructions for creating a reservation and loading images on orbit-lab nodes under [wiki:Tutorials/a0Basic/Tutorial1 ORBIT Tutorial -> Basic Tutorials -> testbed operations] and use the [https://www.orbit-lab.org/cPanel/status/template/index.html Inventory/Status page] to find nodes with IoT IEEE 802.15.4 devices. For this example we'll use node18-18 imaged with ubuntu-16-04-64bit-rzraven.ndz.
     15
     16 * After the node has been imaged and turned on, verify the RZRAVEN USB stick and the ICE debugger has been has been loaded and registered with the kernel. Check the 'dmesg' output  for the following:
     17 {{{
     18root@node18-18:~# dmesg | grep ICE
     19[    2.004469] usb 2-1.2: Product: Atmel-ICE CMSIS-DAP
     20[    2.984950] hid-generic 0003:03EB:2141.0001: hiddev0,hidraw0: USB HID v1.11 Device [Atmel Corp. Atmel-ICE CMSIS-DAP] on usb-0000:00:1d.0-1.2/input0
     21root@node18-18:~#
     22root@node18-18:~#
     23root@node18-18:~# dmesg | grep acm
     24[    9.184102] cdc_acm 2-1.1:129.2: ttyACM0: USB ACM device
     25[    9.184345] usbcore: registered new interface driver cdc_acm
     26[    9.184345] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
     27 }}}
     28
     29* Also verify that software utilities are all up to date
     30 {{{
     31   root@node18-18:~# apt-get update
     32   root@node18-18:~# apt-get install make gcc-avr binutils-avr avr-libc avrdude
     33 }}}
     34
     35 * Next verify if the AVR utilities can see the ICE debugger. Check the file /etc/avrdude.conf under the section 'id="jtag3"' and make sure the value 0x2141 is present in the usbpid list. That section of the file should look like the following:
     36 {{{
     37programmer
     38  id    = "jtag3";
     39  desc  = "Atmel AVR JTAGICE3 in JTAG mode";
     40  type  = "jtagice3";
     41  connection_type = usb;
     42  usbpid = 0x2110, 0x2140, 0x2141;
     43;
     44 }}}
     45
     46=== Compile, load and run the Contiki OS example ===
     47 A version of the Contiki example OS code has already been downloaded and saved on the image. The original source can be found on [https://github.com/contiki-os/contiki/archive/2.6.zip github]. To compile the code change directory to contiki-2.6/examples/ravenusbstick' and do a 'make all'.
     48 {{{
     49 root@node18-18:~# cd contiki-2.6/examples/ravenusbstick
     50 root@node18-18:~# make clean
     51 root@node18-18:~# make all
     52 }}}
     53
     54 This generates the following output files
     55 {{{
     56-rwxr-xr-x 1 root root  241840 Jan 23 14:14 ravenusbstick.elf
     57-rw-r--r-- 1 root root  119181 Jan 23 14:14 contiki-avr-ravenusb.map
     58-rw-r--r-- 1 root root  105342 Jan 23 14:14 ravenusbstick.hex
     59 }}}
     60
     61 Now we can use the AVR utilities to load the .hex file onto the device via the ICE debugger. First erase the device to start from a clean platform.
     62{{{
     63root@node18-18:~#  avrdude -u -c jtag3 -p usb1287 -e
     64avrdude: AVR device initialized and ready to accept instructions
     65
     66Reading | ################################################## | 100% 0.07s
     67
     68avrdude: Device signature = 0x1e9782 (probably usb1287)
     69avrdude: erasing chip
     70
     71avrdude done.  Thank you.
     72}}}
     73
     74 Now load the device with the executable
     75 {{{
     76 root@node18-18:~#  avrdude -u -c jtag3 -p usb1287 -v -U ravenusbstick.hex
     77 avrdude: Version 6.2
     78         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
     79         Copyright (c) 2007-2014 Joerg Wunsch
     80
     81         System wide configuration file is "/etc/avrdude.conf"
     82         User configuration file is "ro/ot/.avrduderc"
     83         User configuration file does not exist or is not a regular file, skipping
     84
     85         Using Port                    : usb
     86         Using Programmer              : jtag3
     87avrdude: usbdev_open(): Found Atmel-ICE CMSIS-DAP, serno: J41800077809
     88avrdude: Found CMSIS-DAP compliant device, using EDBG protocol
     89         AVR Part                      : AT90USB1287
     90         Chip Erase delay              : 9000 us
     91         PAGEL                         : PD7
     92         BS2                           : PA0
     93         RESET disposition             : dedicated
     94         RETRY pulse                   : SCK
     95         serial program mode           : yes
     96         parallel program mode         : yes
     97         Timeout                       : 200
     98         StabDelay                     : 100
     99         CmdexeDelay                   : 25
     100         SyncLoops                     : 32
     101         ByteDelay                     : 0
     102         PollIndex                     : 3
     103         PollValue                     : 0x53
     104         Memory Detail                 :
     105
     106                                  Block Poll               Page                       Polled
     107           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
     108           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
     109           eeprom        65    10     8    0 no       4096    8      0  9000  9000 0x00 0x00
     110           flash         65     6   256    0 yes    131072  256    512  4500  4500 0x00 0x00
     111           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
     112           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
     113           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
     114           lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
     115           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
     116           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
     117
     118         Programmer Type : JTAGICE3
     119         Description     : Atmel AVR JTAGICE3 in JTAG mode
     120         ICE hardware version: 0
     121         ICE firmware version: 1.39 (rel. 130)
     122         Serial number   : J41800077809
     123         Vtarget         : 3.26 V
     124         JTAG clock megaAVR/program: 7500 kHz
     125         JTAG clock megaAVR/debug:   1000 kHz
     126         JTAG clock Xmega: 1000 kHz
     127         PDI clock Xmega : 1000 kHz
     128
     129avrdude: JTAG ID returned: 0x3f 0x20 0x78 0x49
     130avrdude: AVR device initialized and ready to accept instructions
     131
     132Reading | ################################################## | 100% 0.07s
     133
     134avrdude: Device signature = 0x1e9782 (probably usb1287)
     135avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
     136         To disable this feature, specify the -D option.
     137avrdude: erasing chip
     138avrdude: reading input file "ravenusbstick.hex"
     139avrdude: input file ravenusbstick.hex auto detected as Intel Hex
     140avrdude: writing flash (37448 bytes):
     141
     142Writing | ################################################## | 100% 1.62s
     143
     144avrdude: 37448 bytes of flash written
     145avrdude: verifying flash memory against ravenusbstick.hex:
     146avrdude: load data flash data from input file ravenusbstick.hex:
     147avrdude: input file ravenusbstick.hex auto detected as Intel Hex
     148avrdude: input file ravenusbstick.hex contains 37448 bytes
     149avrdude: reading on-chip flash data:
     150
     151Reading | ################################################## | 100% 0.68s
     152
     153avrdude: verifying ...
     154avrdude: 37448 bytes of flash verified
     155
     156avrdude done.  Thank you.
     157
     158 }}}
     159
     160
     161 * Bring up the device as a network card
     162{{{
     163root@node18-18:~#  ifconfig usb0 up
     164root@node18-18:~#  ifconfig usb0
     165usb0      Link encap:Ethernet  HWaddr 02:12:13:14:15:16 
     166          inet6 addr: fe80::12:13ff:fe14:1516/64 Scope:Link
     167          UP BROADCAST RUNNING MULTICAST  MTU:1298  Metric:1
     168          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
     169          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
     170          collisions:0 txqueuelen:1000
     171          RX bytes:0 (0.0 B)  TX bytes:1000 (1000.0 B)
     172
     173   
     174}}}
     175 Now the device is loaded and running the executable. To access the softwares terminal interface provided by the example
     176{{{
     177 root@node18-18:~#   screen /dev/ttyACM0
     178Type 'h' to bring up menu
     179
     180
     181*********** Jackdaw Menu **********
     182        [Built Jan 23 2018]     
     183*  m        Print current mode    *
     184*  s        Set to sniffer mode   *
     185*  n        Set to network mode   *
     186*  c        Set RF channel        *
     187*  p        Set RF power          *
     188*  6        Toggle 6lowpan        *
     189*  r        Toggle raw mode       *
     190*  d        Toggle RS232 output   *
     191*  S        Enable sneezer mode   *
     192*  e        Energy Scan           *
     193*  R        Reset (via WDT)       *
     194*  h,?      Print this menu       *
     195*                                 *
     196* Make selection at any time by   *
     197* pressing your choice on keyboard*
     198***********************************
     199
     200
     201Type 'e' to invoke an enery scan.
     202Energy Scan:
     203................
     204 11: -53dB ######################:::::::::::::::::
     205 12: -50dB ##########################################
     206 13: -50dB ##########################################
     207 14: -62dB #########################:::::
     208 15: -68dB ########::::::::::::::::
     209 16: -71dB #####################
     210 17: -68dB ########################
     211 18: -74dB ##################
     212 19: -83dB #::::::::
     213 20: -83dB :::::::::
     214 21: -62dB ##########::::::::::::::::::::
     215 22: -53dB #################################::::::
     216 23: -59dB #####################::::::::::::
     217 24: -62dB ####::::::::::::::::::::::::::
     218 25: -92dB
     219 26: -71dB #####::::::::::::::::
     220Done.
     221
     222}}}
     223
     224
     225To exit 'screen' session use 'ctrl+a' then 'd' to exit
     226
     227If the debug interface stops working in 'screen', you can send 'R' to reset the stick and then try again.