Monday, August 17, 2015

How to setup Contiki Sniffer for 6LowPAN using CC2531 USB dongle or CC2538EM

The following steps show you how to setup Contiki Sniffer on Mac OS for 6LowPAN using CC2531 USB dongle in details.

1. Download pyserial-2.7.tar.gz and untar it by running "tar zxvf pyserial-2.7.tar.gz" under console terminal of Mac OS.

2. Install pySerial by running "sudo python setup.py install" under console terminal of Mac OS.

3. Download sensniff.py.

4. Download Contiki_Sniffer_CC2531EMK.hex to CC2531 USB dongle using TI CC Debugger and Flash Programmer.

p.s. If you want to use CC2538EM as sniffer, you have to set "#define CC2538_RF_CONF_SNIFFER_USB  1" in C:\contiki\platform\cc2538dk\contiki-conf.h and do make under "C:\contiki\examples\cc2538dk\sniffer". You will get sniffer.bin under "C:\contiki\examples\cc2538dk\sniffer" and flash is to CC2538EM using Flash Programmer 2.

5. Plugin CC2351 USB dongle or CC2538EM into Mac USB port and you should see it enum like /dev/tty.usbmodem1421. Please note that 1421 might be different from device to device.

6. Run "python sensniff.py -d /dev/tty.usbmodem1421 -b 460800" under console terminal of Mac OS.

p.s. CC2531 USB dongle needs you to press S1 or S2 button to make it work after you plug it into UAB port. I don't know why but if you cannot make it work, try it.

7. Download and install wireshark.

8. Run wireshark. Go to Edit->Preferences->Protocols->6LowPAN and add "aaaa::" to Context 0:.

9. Go to Edit->Preferences->Protocols->IEEE802.15.4 and check "TI CC24xx FCS format".

10. Go to Capture -> options -> Manage Interfaces -> New. Input /tmp/sensniff to "Pipe:" and save.

11. Start a new live capture on wireshark and enjoy it.

No comments:

Post a Comment