• The secret of success is learning how to use pain and pleasure instead of having pain and pleasure use you. If you do that, you're in control of your life. If you don't, life controls you.
      Tony Robbins

    • If you do what you've always done, you'll get what you've always gotten.
      Tony Robbins

  1. Address: Floor 3th, Information Technology Center of BASU University, Hamedan, Iran.

    Tel: +988138270182 & +988138268809         Email: info@wsnlab.org

    • Carry out the Wireless Sensor Network Simulation projects
    • Consulting the Wireless Sensor Network Projects
    • Implementation Hardware, Middle-ware and Software of WSN.

    for more information you can contact us: info@wsnlab.org

  2. Our Persian Forum ,
    www.wsnlab.ir

Run Contiki On Hardware

Discussion in 'Cooja Simulator (Contiki)' started by Homaei, Nov 21, 2013.

  1. Homaei

    Homaei Administrator Staff Member

    About Contiki on hardware
    Contiki has a build system that is intended to make it easy to run Contiki directly on hardware. The build system is designed to be the same across different hardware platforms, so that the build commands are familiar when switching hardware. The build system consists of a set of makefiles. The base makefile iscontiki/Makefile.include, platform makefiles incontiki/platform/*/Makefile.platformand contiki/cpu/*/Makefile.cpu.

    Connect the hardware
    In this example, we assume you have a Zolertia Z1 mote connected to a USB port of your PC. We first need to enable the Z1 in Instant Contiki, so that Instant Contiki is able to talk to it. This is done through the Virtual Machine menu in VMWare Player, followed by theRemovable Devices menu item.

    Open a terminal, go to the code directory
    The Contiki build system is run in a terminal window. Open a terminal window and go to the Hello World example directory:

    cd contiki/examples/hello-world
    Compile Contiki and the application
    We can now compile the Hello World application for our hardware platform. This also compiles the entire Contiki system, so it will take some time the first time around.

    make TARGET=z1 hello-world
    If you plan to compile more than once for the chosen platform, you can ask Contiki to remember your choice of hardware with the special savetarget maketarget. Do this now:

    make TARGET=z1 savetarget
    Upload Contiki to the hardware
    Now we are ready to upload the compiled code to the hardware. We do this with the special %.upload maketarget like this:

    make hello-world.upload
    Note: If you see output along the lines of the following, that means that the Z1 mote has not been connected to Instant Contiki:

    make z1-reset z1-upload make[1]: Entering directory `/home/user/contiki/examples/hello-world' make -k -j 20 z1-reset-sequence make[2]: Entering directory `/home/user/contiki/examples/hello-world' Done make[2]: Leaving directory `/home/user/contiki/examples/hello-world' make -j 20 z1-upload-sequence make[2]: Entering directory `/home/user/contiki/examples/hello-world' Done make[2]: Leaving directory `/home/user/contiki/examples/hello-world' make[1]: Leaving directory `/home/user/contiki/examples/hello-world' rm hello-world.ihex
    Check the connection to the PC, check the connection in VMWare Player, and try again.

    Note that we could have done the compilation and uploading in one step: the make hello-world.upload target automatically compiles the application and Contiki before uploading it to the hardware.

    See the Hello World output
    Now that the code is burned onto the hardware device, we can check the serial port to see the output of the program. To see the serial port output of our connected mote, we run the following command:

    make login
    This will not show any output (except potentially a few garbage characters which sometimes seem to be inserted by VMWare) because the Hello World program has already finished. To see the output, press the reset button on the mote. Something like the following should show up:

    Rime started with address 1.1 MAC 01:01:00:00:00:00:00:00 Contiki-2.6 started. Node id is set to 257. CSMA ContikiMAC, channel check rate 8 Hz, radio channel 26 Starting 'Hello world process' Hello, world
    Done!
    Congratulations! If you have completed all the steps in this tutorial, you have successfully been running Contiki both in simulation and on hardware. If everything worked, you might try to run the code we ran in simulation on hardware: upload the broadcast-exampleprogram in the contiki/examples/ipv6/simple-udp-rpl/ directory to two hardware devices and look at them sending low-power wireless IPv6/UDP messages to each other.


    Referenced by: http://www.contiki-os.org/start.html
    Author: Mohammad Hossein Homaei
    Supported by: www.wsnlab.org
    Amir likes this.
  2. Amir

    Amir New Member

    Thank you. It is so useful.
    Just for completion, if you want to check whether the z1 mote is correctly connected to pc or not just run in terminal:
    motelist or motelist-z1

Share This Page

Get our toolbar! Flag Counter