Skip to main content

Test the hello-world.c on Contiki-ng system for CC2650 launchpad

This is my testing for my experiment to use contiki-ng for my cc2650 board on Windows 10.
Because Contiki needs an environment like Linux, here we use Docker + Virtualbox to make build and compile more convenient.  Below are there steps to make it.


Step 1. Install Docker Toolbox
Notice 1. Using Virtual box 5.2.30 to assure that the Docker Work
Notice 2. After install need to restart the windows 10
Notice 3. Config virtual box host-only network




Step2. Pull Contiki-Ng from website
Here I put my Contiki-ng in c:/user/myname/Contiki-ng
After Docker can setup the connection you need to login to user state of contiki-ng with command
docker run --privileged --sysctl net.ipv6.conf.all.disable_ipv6=0 --mount type=bind,source=/c/Users/myname/contiki-ng,destination=/home/user/contiki-ng -e DISPLAY=host.docker.internal:0.0 -ti contiker/contiki-ng
Step 3.  Test an hello-world project in examples folder
#include "contiki.h"
#include "dev/cc26xx-uart.h"
#include "dev/leds.h"
#include "dev/serial-line.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();
}
Step 4. After edit the file, build the file from the folder ./examples/hello-world/ by command

make TARGET=cc26x0-cc13x0 BOARD=launchpad/cc2650



The builder processing will start and make .hex, .elf, .bin files
Step 5. Using Flash Programmer 2 to the programmer the launchpad cc2650

Step 6. Test the result with real-term terminal (Baud rate: 115200, 8 data bits, 1 stop bit)


Comments

Popular posts from this blog

Serial Port Profile with CC2650 and CC2640R2 (part 2) Modified to transfer ADC values up to PC Step 1:  Include ACD.h library #include <ti/drivers/ADC.h>  Step 2: Insert period event in order to update ADC read values from the potentiometer #define SSSS_ICALL_EVT                         ICALL_MSG_EVENT_ID // Event_Id_31 #define SSSS_QUEUE_EVT                         UTIL_QUEUE_EVENT_ID // Event_Id_30 #define SSSS_PERIODIC_EVT                      Event_Id_00 //SOLUTION // Bitwise OR of all events to pend on #define SSSS_ALL_EVENTS                        (SSSS_ICALL_EVT        | \                                ...
Experiment Sensor Booster Pack with CC2650 In this experiment, we use CC2650 rather CC2640Rx2 to read light level from OTP3001 on the sensor board. It follows the Task 3, Task 4 from TI tutorial http://dev.ti.com/tirex/content/simplelink_academy_cc2640r2sdk_1_13_02_07/modules/ble_02_thermostat/ble_02_thermostat.html Here we need some modified like last post to make the project run. First, to define the board CC2650 in file Board.h #define     Board_I2C_TMP           CC2650_LAUNCHXL_I2C0 Also, define IC address in file otp3001.c( replaced for tmp007.c) #define Board_TMP_ADDR   0x47 #if defined(ONBOARD_TMP006) #define TMP_REGISTER TMP_DIE_TEMP #define TMP_ADDR     Board_TMP_ADDR #else #define TMP_REGISTER TMP_OBJ_TEMP #define CONF_REGISTER 0x01 #define TMP_ADDR     Board_TMP_ADDR #endif Declare two new variables for reading exponent part and result uint16_t       ...
Serial Port Profile with CC2650 and CC2640R2 This test based on code from TI support under link: For CC2650: https://github.com/ti-simplelink/ble_examples/blob/ble_examples-2.2/docs/spp_ble.md For CC2640R2: https://github.com/ti-simplelink/ble_examples/blob/simplelink_cc2640r2_sdk-2.20/examples/rtos/CC2640R2_LAUNCHXL/bleapps/simple_serial_socket_client/readme.md In this experiment, I use CC2640R2 as Server (Peripheral) and CC2650 as Client (Central) as the image below: Step1: import project spp_ble_client_cc2650lp (app and stack) for CC2650 Step2: modify Code of Service in file serial_port_service:               C0E0 ==> C0C0               C0E1 ==> C0C1               C0E2 ==> C0C2 If you don't change, Two Blue Tooth Board cant know to service each other. Step 3: import project simple_serial_socket_client_CC2640r2 for CC2640R2 here we using RealTerm...