Showing posts with label CC1350. Show all posts
Showing posts with label CC1350. Show all posts

Thursday, October 19, 2017

Using CC13xx/CC26xx running Contiki OS to toggle LED from UART.

The following example shows how to using CC13xx/CC26xx running Contiki OS to toggle LED from UART.

1. Replace the following code into hell-world.c

#include "contiki.h"
#include "dev/cc26xx-uart.h"
#include "dev/serial-line.h"
#include "dev/leds.h"

#include < stdio.h >/* For printf() */
#include  < string.h >


 PROCESS(test_serial, "Serial line test process");
 AUTOSTART_PROCESSES(&test_serial);

 PROCESS_THREAD(test_serial, ev, data)
 {
   PROCESS_BEGIN();
   cc26xx_uart_set_input(serial_line_input_byte);
  
   printf("Hello, world Serial line test\n");

   for(;;) {
     PROCESS_YIELD();
     if(ev == serial_line_event_message) {
       printf("received line: %s\n", (char *)data);
       if(strcmp(data,"ON")==0)
           leds_on(LEDS_GREEN);
       else if(strcmp(data,"OFF")==0)
           leds_off(LEDS_GREEN);
     }
   }
   PROCESS_END();
 }


2. Build hello-world.bin for LAUNCHXL-CC1310 using  "make TARGET=srf06-cc26xx BOARD=launchpad/cc1310 hello-world.bin"

3. Download hello-world.bin to LAUNCHXL-CC1310 using Flash Programmer 2.

4. Start a terminal tool like teraterm to connect to LAUNCHXL-CC1310 application virtual COM port..

5. Enter "ON" and "CTRL+Enter" to send ON command with end character "0x0A" to LAUNCHXL-CC1310 and you will see green led is turned on

6. Enter "OFF" and "CTRL+Enter" to send OFF command with end character "0x0A" to LAUNCHXL-CC1310 and you will see green led is turned on

Wednesday, November 11, 2015

How to build/set Contiki rpl-border-router on SmratRF06EB+CC1350EM and run tunslip6

The following steps show how to build/set Contiki rpl-border-router on SmratRF06EB+CC1350EM and run tunslip6 in Contiki VMPlayer.
1. Go to "/contiki/examples/ipv6/rpl-border-router" directory and change "#define DEBUG DEBUG_NONE" to "#define DEBUG DEBUG_PRINT" in border-router.c. Also remember to add "#define RF_CORE_CONF_CHANNEL 25" in project-conf.h to set default channel to 25 (If you don't add this, it will use channel 0 which is defined in contiki-conf.h under /contiki/platform/srf06-cc26xx. It might have problem that a SensorTag use channel 25 to join later.)

2. Do "make TARGET=srf06-cc26xx BOARD=srf06/cc13xx" in terminal and you will get border-router.bin. Download border-router.bin to your SmratRF06EB+CC1350EM with Flash Programmer 2.

3. Connect USB cable and turn on SmratRF06EB+CC1350EM.

4. Run the following commands in Linux terminal of Contiki VMPlayer to enum ttyUSB0 and ttyUSB1 under /dev
    sudo modprobe ftdi_sio vendor=0x403 product=0xa6d1
    sudo chmod 777 /sys/bus/usb-serial/drivers/ftdi_sio/new_id
    sudo echo 0403 a6d1 > /sys/bus/usb-serial/drivers/ftdi_sio/new_id

5. Go to "/contiki/tools" directory and do " make tunslip6"

6. Run "sudo ./tunslip6 aaaa::1/64 -s /dev/ttyUSB1" and you will see tunslip6 running.





7. Press "EM RESET" button on SmratRF06EB to make rpl-border-router reset to dump
 Server IPv6 addresses which is aaaa:212:4b00:7c6:2b02 in my test.




8. Open FireFox in VMPlayer and go [aaaa:212:4b00:7c6:2b02]. You will see the web page of rpl-border-router.



9. Start a CC1350 SensorTag and you will see it joins rpl-border-router. The IPv6 address of my CC1350 SensorTag is aaaa::212:4b00:7c7:bf02 in my test.



10. Use coap://[aaaa::212:4b00:7c7:bf02] to access coap server on CC1350 SensorTag.


Monday, September 7, 2015

Build 6LowPAN Contiki SubG Hz Sniffer for CC1350

Use the following steps to build 6LowPAN Contiki SubG Hz Sniffer for CC1350.
1. Go to  contiki/examples/cc2538dk/sniffer.
2. Add the followinges into project-conf.h.
    #define BOARD_CONF_DEBUGGER_DEVPACK        0
    #define PROP_MODE_CONF_SNIFFER                    1
    #define CC26XX_UART_CONF_BAUD_RATE    460800
    #define RF_CORE_CONF_CHANNEL                 25
3. make TARGET=srf06-cc26xx BOARD=srf06/cc13xx sniffer.bin.
4. Download sniffer.bin to CC1350EM and connect FT232 Serial-to-USB cable to P412 on SmartRF06EB.
5. Refer to steps here about Wireshark part.





Thursday, September 3, 2015

Contiki SubG Hz 6LowPAN on CC1350

To test on Contiki SubG Hz 6LowPAN on CC1350, I use SmartRF06EB+CC1350EM with FT232 USB-to-Serial dongle to act as Slip Radio which is connected to Raspberry Pi (It also works on BeagleBone Black too).

1. Git the latest Contiki source code by using "git clone --recursive https://github.com/contiki-os/contiki".

2. Open /examples/ipv6/slip-radio/project-conf.h. Comment out the QUEUEBUF_CONF_NUM and UIP_CONF_BUFFER_SIZE and add "#define RF_CORE_CONF_CHANNEL 25"

#ifndef PROJECT_CONF_H_
#define PROJECT_CONF_H_
/*
 #undef QUEUEBUF_CONF_NUM
 #define QUEUEBUF_CONF_NUM          4

 #undef UIP_CONF_BUFFER_SIZE
 #define UIP_CONF_BUFFER_SIZE    140
*/

#define RF_CORE_CONF_CHANNEL                 25
#undef UIP_CONF_ROUTER
#define UIP_CONF_ROUTER                 0

3. Bulid slip-radio.bin using the following steps.
cd examples/ipv6/slip-radio
make clean
make TARGET=srf06-cc26xx BOARD=srf06/cc13xx slip-radio.bin

4. Flash slip-radio.bin to SmartRF06EB+CC1350EM using SmartRF Flash programmer 2.0.

5. Connect FT232 USB-to-Serial dongle to UART pins on SmartRF06EB and plug FT232 USB dongle to Raspberry Pi. You should see "ttyUSB0" get listed under /dev.

6. Refer to "Setup 6lbr to run 6LowPAN with CC2531 USB dongle on Raspberry Pi 2B" and revise "DEV_RADIO=/dev/ttyACM0" to "DEV_RADIO=/dev/ttyUSB0" in /etc/6lbr/6lbr.conf.

7. Use "sudo service 6lbr start" to start 6lbr and you can use Firefox to access to 6lbr web page ([bbbb:100]).




Then, I use anther SmartRF06EB+CC1350EM and a CC1350 SensorTag to act as Contiki SubG Hz 6LowPAN devices.

1. Build cc26xx-web-demo.bin for SmartRF06EB+CC1350EM and CC1350 SensorTag.
cd ../examples/cc26xx/cc26xx-web-demo
make clean
make TARGET=srf06-cc26xx BOARD=srf06/cc13xx cc26xx-web-demo.bin

2. Flash cc26xx-web-demo.bin to SmartRF06EB+CC1350EM and CC1350 SensorTag using SmartRF Flash programmer 2.0.


3. Check 6lbr Sensors web page and you will see these two device on it.