This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2531 usb dongle contiki sniffer firmware

Other Parts Discussed in Thread: CC2531, CC2538DK, CC2650EMK

I am using instant contiki 2.7, Is there an already built firmware(.hex) for CC2531 usb dongle to sniff Contiki packets? 

Otherwise, I found the source code on ../examples/cc2530dk/sniffer, but how do I need to cross-compile the code for the usb dongle?

When I run "make TARGET=cc2530dk" I get the below errors:

root@instant-contiki:~/contiki-dev/examples/cc2530dk/sniffer# make TARGET=cc2530dk
mkdir obj_cc2530dk
cat     ../../../platform/cc2530dk/./segment.rules      ../../../cpu/cc253x/./segment.rules              | \
	   sed -e 's/#.*$//' -e 's/^\s*//' -e '/^$/d' > obj_cc2530dk/segment.rules
  CC        ../../../core/dev/leds.c
at 1: warning 117: unknown compiler option '--fomit-frame-pointer' ignored
  CC        ../../../platform/cc2530dk/dev/leds-arch.c
at 1: warning 117: unknown compiler option '--fomit-frame-pointer' ignored
  CC        ../../../core/lib/sensors.c
at 1: warning 117: unknown compiler option '--fomit-frame-pointer' ignored
../../../core/lib/sensors.c:135: warning 85: in function process_thread_sensors_process unreferenced function argument : 'data'
  CC        ../../../platform/cc2530dk/dev/smartrf-sensors.c
at 1: warning 117: unknown compiler option '--fomit-frame-pointer' ignored
  CC        ../../../platform/cc2530dk/dev/button-sensor.c
at 1: warning 117: unknown compiler option '--fomit-frame-pointer' ignored
  CC        ../../../platform/cc2530dk/dev/adc-sensor.c
at 1: warning 117: unknown compiler option '--fomit-frame-pointer' ignored
  CC        ../../../core/dev/serial-line.c
at 1: warning 117: unknown compiler option '--fomit-frame-pointer' ignored
../../../core/dev/serial-line.c:128: warning 85: in function process_thread_serial_line_process unreferenced function argument : 'data'
  CC        ../../../platform/cc2530dk/dev/slip-arch.c
at 1: warning 117: unknown compiler option '--fomit-frame-pointer' ignored
../../../platform/cc2530dk/dev/slip-arch.c:47: warning 85: in function slip_arch_init unreferenced function argument : 'ubr'
  CC        ../../../core/dev/slip.c
at 1: warning 117: unknown compiler option '--fomit-frame-pointer' ignored
../../../core/dev/slip.c:313: warning 85: in function process_thread_slip_process unreferenced function argument : 'data'
../../../core/dev/slip.c:88: error 78: incompatible types
from type 'void literal-generic* '
to type 'void function    ( )  xdata-code* '
../../../core/dev/slip.c:393: error 78: incompatible types
from type 'void literal-generic* '
to type 'void function    ( )  xdata-const-code* '
make: *** [obj_cc2530dk/slip.rel] Error 1

  • Thanks for the reply.

    On the right window, the sniffer.hex is successfully compiled, the left window shows that the .hex file is uploaded successfully to the CC2531 dongle.

    I can't see the dongle on Wireshark list neither on Ubuntu nor Windows. Ubuntu enumerates the dongle as /dev/ttyACM0. according to https://github.com/g-oikonomou/sensniff  it should be /dev//ttyUSBx

    python sensniff.py -d /dev/ttyACM0 doesn't sniff anything.Is it .hex file related or ubuntu configuration related problem?

    When I plug the usb dongle to a USB port, the red LED blinks once and I don't see any green LED. Is it a normal behavior?

    It would be a lot easier if someone could share the correct .hex file

  • Thanks for the reply.

    On the right window, the sniffer.hex is successfully compiled, the left window shows that the .hex file is uploaded successfully to the CC2531 dongle.

    When I connect it to Ubuntu PC (or Windows), I don't see it on Wireshark list. ubuntu enumerates it as /dev/ttyACM0. I guess the correct enumeration should be /dev//ttyUSB0

    python sensniff.py -d /dev/ttyACM0 doesn't sniff anything. I don't know what is wrong. But, I suspect the sniffer code is not correct although it says it was compiled correctly. 

    When I plug the usb dongle to a USB port, the red LED blinks once and I don't see any green LED. Is it a normal behavior?

    It would be a lot easier if someone could share the correct .hex file

  • could anyone who have the correct .hex file share it from here?
  • This is the image I have been using. 
    The behavior you are describing sounds similar to what I was seeing on a defective cc2531 USB dongle. 
    Any firmware, border router, sniffer, etc, would result in a quick green light, followed by no USB device enumeration. 

    Luckily I have ordered 3 of them. I tried another dongle, and it worked instantly. 
    I am not sure how to RMA the defective unit, but I am very interested in finding out. 

    I hope this helps.

    sniffer.cc2530dk.hex.zip

  • Hi Mike,

    Thanks for the reply and sharing the .hex file. I have just uploaded the firmware on my two cc2531 dongle (I have just opened the box of one of them) . However, none of them work correctly. First the green and then the red led blinks When the dongle is plugged into my laptop,  then nothing happens. cdc_acm driver enumerates the dongle as /dev/ttyACM0, but I guess sensniff can't communicate with the module. I run the below command then use smartRF studio 7 to transmit packets from CC2650DK.  

    root@instant-contiki:~/Desktop/sensniff-master/host# python sensniff.py -D INFO -p -d /dev/ttyACM0 -b 460800
    Started logging
    Serial port /dev/ttyACM0 opened
    FIFO /tmp/sensniff exists. Using it
    Dumping PCAP to sensniff.pcap
    Commands:
    c: Print current RF Channel
    n: Trigger new pcap header before the next frame
    h,?: Print this message
    [11,26]: Change RF channel
    q: Quit
    n
    11
    n
    q
    User requested shutdown
    Frame Stats:
               Non-Frame: 0
               Not Piped: 0
          Dumped to PCAP: 0
                   Piped: 0
                Captured: 0
    

    However, it doesn't capture anything. Is there a better way to debug the communication between the sensniff and CC2531 dongle?

    Both dongles that I have are Rev4.1. I wonder Mike if your working dongle is a different revision? My dongles work as a ZigBee sniffer, I guess it shouldn't be a HW problem. If it is not a HW problem, then it is weird that only one of your CC2531 dongle works with the firmware. I tried CC2538DK as a sniffer, but have the same problem.

    Maybe it has something to do with sdcc? I read some discussion on Contiki forum that" MODELS = small large huge" is not working, I tried it with "small large" and "large" but didn't help. What is the correct model to compile it?

    Is there anyone else faced the same problem before?

  • The CC2531 dongles I have are all version 2.4.0. 
    I used 'small large huge' to build this. 

    What SVN revision did you use to build SDCC? 

    I am using a MAC with sensniff and wireshark running in 'screen' in an x11 terminal. 
    This is the command I used to run sensniff - 

    python sensniff.py -d /dev/tty.usbmodem14111 -b 460800

  • Hi mike,
    I try to download the CC2531 hex file provide by you to my CC2531 dongle. After I plugin it to my desktop, I can't make it work too. I see you test it under MAC and would like to try it. Can you tell me what MAC would show under /dev when CC2531 USB is plugged into MAC? If you can show your steps in detail by snapshot, it would be very helpful. Thanks.
  • Hi mike,

    I run "python sensniff.py -d /dev/tty.usbmodem1421 -b 460800 -D DEBUG" on Mac terminal and get similar results with Serder. The followings are the output on terminal.

    $ python sensniff.py -d /dev/tty.usbmodem1421 -b 460800 -D DEBUG

    Started logging

    Serial port /dev/tty.usbmodem1421 opened

    FIFO /tmp/sensniff exists. Using it

    Commands:

    c: Print current RF Channel

    n: Trigger new pcap header before the next frame

    h,?: Print this message

    [11,26]: Change RF channel

    q: Quit

    No user input

    No frame input

    What are yours? Would you share with us?

  • Hi Serder,
    I press S1/S2 on CC2531 USB dongle and find it works accidentally. You can try if it works on your environment.
  • Hi Yikai,

    Thank you for spending time on the issue.

    I randomly press S1 and S2 buttons for several minutes but I didn't observe any change on both Mike's firmware and the firmware that I built. 

    When I plug the dongle on my instant ubuntu 2.7, cdc_acm enumerates the dongle as /dev/ttyACM0, I don't have /dev/tty.usbxx under /dev directory.

    Do you run a different command in order to have /dev/tty.usbmodemxx?

    Here is a dmesg output:

    [ 1049.272779] usb 2-2.1: new full-speed USB device number 11 using uhci_hcd
    [ 1049.401128] cdc_acm 2-2.1:1.0: This device cannot do calls on its own. It is not a modem.
    [ 1049.401145] cdc_acm 2-2.1:1.0: ttyACM0: USB ACM device

    lsmod shows that cdc_acm module is working

  • Hi Serdar.
    Yikai and I were seeing tty.usbmodemxx because that is the specific device name that our Mac OSX systems are binding the dongle.
    When I am using a linux machine, I always see ttyACM0. Different operating systems handle the dongle a bit differently.

    Oddly enough, I do not remember having to press any of the switches to get the sniffer working. 
    Unfortunately I have run out of dongles to try to repeat this. My resources are limited at the moment. 

  • Thank you Mike for the clarification.

    I got a one time kind help from the developer. The LED should only blinks once at the boot, then goes to "silent" mode. So, it is a normal behavior that LEDs are not ON as the ZigBee sniffer.

    Mike's firmware and the firmware that I was building myself are working OK with 2 problems:

    1)The usb dongle works at channel 13 by default and I can't manage to change it via sensniff. I don't know why the program doesn't react when I enter one of the following inputs "n, 11, c, 12, c, 13, c, ..., 26". Does anyone know how to change the sniff frequency?

    2) I use smartRF Studio 7 + CC2650EMK to transmit 100 packets (7 byte) at channel 13. The CC2531 dongle and CC2650EMK are 10 cm apart. However, the sniffer can only pick up 70ish of them. Is there anything to do to improve the sniff performance?

    A correction: I have Rev 2.4 of CC2531 dongle, not 4.1(probably not exist)

    EDIT:

    I have just noticed that the destination address of the received packet blank, 0xbd10, or 69:15;f0... and most of them have [Malformed Packet] sign, does the sniffer have an issue to sniff the packets reliably?