Thursday, November 12, 2015

How to build DTLS example for SmartRF06EB+CC2650EM in Contiki 6LowPAN

The following steps show you how to build DTLS example for SmartRF06EB+CC2650EM in Contiki 6LowPAN.

On SmartRF06EB+CC2650EM side:

1. Do "git clone --recursive https://github.com/cetic/6lbr" to get source code of 6lbr which contains DTLS examples.

2. Do "git clone --recursive https://github.com/contiki-os/contiki" to get Contiki source code

3. Copy folder "6lbr-demo" under "\6lbr\examples\" to "\contiki\examples"

4. Copy folder "tinydtls" under "\6lbr\apps\" to "\contiki\apps\"

5. Revise "#include "debug.h"" to "#include "../../../../apps/tinydtls/debug.h"" in \contiki\examples\6lbr-demo\apps\dtls-echo\dtls-echo.c.

6. Go to directory "\contiki\examples\6lbr-demo" and do "make TARGET=srf06-cc26xx clean" to clean up things.

7. Do "make TARGET=srf06-cc26xx WITH_TINYDTLS=1 WITH_DTLSECHO=1 6lbr-demo.bin" to get 6lbr-demo.bin which contains DTLS echo application for SmartRF06EB+CC2650EM.

8.  Download 6lbr-demo.bin to SmartRF06EB+CC2650EM using Flash Programmer 2.

9. Turn on SmartRF06EB+CC2650EM to join 6lbr Edge Router. If you connect UART to SmartRF06EB, you would see output like the followings:


On VMPlayer side:

1. Download tinyDTLS from http://sourceforge.net/projects/tinydtls/ and untar it to your home folder in Contiki VMPlayer. When I test this, it is tinydtls-0.8.2.

2. Open a terminal and go to "/tinydtls-0.8.2/" folder.

3. Do "./configure" and "make".

4. You will get dtls-client in "/tinydtls-0.8.2/test" folder.



5. If your network interface is eth0, run the following commands in terminal.

    sysctl -w net.ipv6.conf.eth0.accept_ra=1
    sysctl -w net.ipv6.conf.eth0.accept_ra_rt_info_max_plen=64
    route -A inet6 add aaaa::/64 gw bbbb::100

6. Run "./dtls-client aaaa::212:4b00:695:8605" in "/tinydtls-0.8.2/test" folder and you can send something to dtls-server on aaaa::212:4b00:695:8605. You will see echo from dtls-server running on SmartRF06EB+CC2650EM with aaaa::212:4b00:695:8605 as IPv6 address.


2 comments:

  1. Would this work on the SensorTag CC2650STK?

    ReplyDelete
  2. hi,
    please i use contiki under ubuntu and i follow the first 5 steps to build dtls but when i invoke make it displays the error given bellow:
    root@maher-Lenovo-G50-80:/contiki/apps/tinydtls# make
    TARGET not defined, using target 'native'
    CC dtls.c
    In file included from ../../core/./contiki.h:38:0,
    from config.h:4,
    from dtls.c:26:
    ../../platform/native/./contiki-conf.h:72:0: warning: "UIP_CONF_TCP" redefined
    #define UIP_CONF_TCP 1

    :0:0: note: this is the location of the previous definition
    dtls.c:46:13: fatal error: net/uip-debug.h: No such file or directory
    # include "net/uip-debug.h"
    ^~~~~~~~~~~~~~~~~
    compilation terminated.
    ../../Makefile.include:240: recipe for target 'obj_native/dtls.o' failed
    make: *** [obj_native/dtls.o] Error 1
    please help me
    best regards

    ReplyDelete