Bluetooth commands for the Octanis Delta Kit

Via the bluetooth low energy (BLE) module installed in the Delta kit, you can send various commands to trigger a certain response from the mainboard. This is very early stage and just shows a glimpse of all the possibilities coming up in the future.

Currently implemented commands are:

Command (description)
thr define a new threshold for a given sensor value to trigger a command. Follow this by a condition and an action.
rst reset all thresholds

These are the conditions you can use for setting up thresholds:

value (description)
temp Temperature in °C
pres Pressure in hPa
humi Humidity in rel. %
imuh IMU heading relative to North, in degrees
imup IMU pitch relative to horizontal plane, in degrees
imur IMU roll relative to horizontal plane, in degrees
imux IMU acceleration in x direction, in 100m/s2
imuy IMU acceleration in y direction, in 100m/s2
imuz IMU acceleration in z direction, in 100m/s2

These operators can be used to compare the above values with a numerical value (can only be 3 digits maximum; and no negative sign):

operator (description)
<### smaller than ###
>### greater than ###
=### equal to ###
!### not equal to ###

You have to follow the threshold condition by a comma ',' and then continue with one of the following actions:

action (description)
led# blink red LED (where # must be replaced with a speed value from 1-9)
ledon turn red LED permanently on
ledoff turn red LED permanently off
b=#### send a message via bluetooth (where #### is replaced by your maximum 4-characters long message)
l=#### send a message via LoRa (where #### is replaced by your maximum 4-characters long message)
c=#### send a message to command line (where #### is replaced by your maximum 4-characters long message)

Important: A complete command sequence, as shown in the examples below, must be followed by a newline character in order to get accepted.

Examples

thr temp>25,led5

thr imup>20,b=TILT

rst

Note that this format must be exactly respected in order to have a valid command (careful with copy-pasting the commands from here, it may add a space in front of it which must be removed).

Getting started with programming the Octanis Delta Kit firmware using CCS on any OS

CCS is TI's custom eclipse based IDE for MSP43x and other MCU. It includes nice debugging tools and it is a working all-in-one development system. The free version using the TI compiler is code-size limited for MSP43x devices, but you can use the GNU compiler with unlimited code size within CCS. For the MSP432, TI-RTOS is even supporting the GNU compiler, in contrast to MSP430 devices.

The following describes how to get CCS up and running:

  1. Download CCS here. It's free, but TI-Account required.
  2. In the application, you have to add TI-RTOS for MSP43x and MSP43xWare depending on your MCU, in the app center.
  3. Get started with examples (Help → Welcome. Then “Browse Examples”) or:
  4. Import the project for the mainboard firmware from GitHub. It should compile and build directly (if not, you might have to add the submodules to the git repo).

To get more info about the pin connections of the mainboard:

  1. Our wiki page on the mainboard firmware: Octanis 1 Main Board
  2. The PCB files can be found on GitHub: https://github.com/Octanis1/Octanis1-Electronics (the current mainboard used in the Delta kit is version 1.0)

More info on programming:

In the Project Tree –> targetConfigs open the file “MSP432P401R.ccxml”. There, under “Advanced Setup”, Click on Target Configuration. Click on “Texas Instruments XDS110 USB Debug Probe” in the tree and you will see this screen:

If you flash the mainboard, i.e. you use the JTAG connector of the launchpad for an external device, leave the settings as in the pictures (SWD mode settings: Use SWD Mode with SWO Trace enabled)

If you flash the MCU on the launchpad change the SWD mode settings to: Use 1149.1 JTAG, SWD Mode with is disabled.

IMPORTANT When trying to flash the mainboard, always check that the JTAG pins are connected in the right order (they follow the same order on the mainboard as on the launchpad, from GND to 3V3 (red cable)). Also make sure to remove all jumpers that connect the programmer with the MSP432 on the launchpad. Finally, move the JTAG switch to Ext. Debug.

(from this e2e forum post)

  1. Connect the failing LaunchPad/unit to your PC.
  2. Open CCS, assume you already have at least one MSP432 project open.
  3. Go to View > Target Configuration.
  4. Within Target Configuration navigate to your MSP432 project > the .ccxml file.
  5. Right Click > Launch Configuration
  6. Under Debug window you should now see some tree structure starting with the .ccmxl file being the root > something_CORTEX_M4_something (unknown)
  7. Right Click > Show all hidden cores.
  8. Connect only to the Non-Debuggable Devices > DAP.
  9. Go to Script > Factory Reset.
  10. Power cycle and try to restart debug.

Get Delta Kit data with Node

Install node, cylon and cylon-ble first (npm install <packagename>). Then run this code to get the raw data:

"use strict";

var Cylon = require('cylon');

Cylon.api("http", {
  ssl: false // serve unsecured, over HTTP

  // optional configuration here.
  // for details see 'Configuration' section.
});

//start robot handler
Cylon.robot({
  name: "octanis1_rover",
  connections: {
    bluetooth: { adaptor: 'ble', uuid: '65304c7bf6cc4dce9b9fce401aa423bd' }
  },

  devices: {
   octanis1_rover_ble: {
     driver: "ble-characteristic",
     serviceId: "ffe0", characteristicId: "ffe1",
     connection: "bluetooth"
   }
  },

  work: function(my) {

    RoverHandleBLENotifications(my.octanis1_rover_ble);

  }
})

Cylon.start();


//rover specifics
function RoverHandleBLENotifications(ble_device){
  ble_device.notifyCharacteristic(function(err, data) {
    if (err) { return console.error("NotifyError: ", err); }
	  console.log("NotifyData: ", data.toString());

  });
}

function RoverWriteToConsole(my, command_string){
  console.log("Sent: "+command_string);
  my.octanis1_rover_ble.writeCharacteristic(command_string+"\r\n", function(err, data) {
    if (err) { return console.error("Error: ", err); }
    console.log("Data: ", data);

    if(typeof data === 'undefined'){
       console.log("error in BLE - restart connection!");
    }

  });
}

String is generated as follows:

	stringlength += ftoa(stat->gps_lat, &txdata[stringlength], 7); //convert gps latitude to string with sign and 7 afterpoint
	txdata[stringlength++] = ','; 					//plus a comma
	txdata[stringlength++] = '-'; 					//plus negative sign for US TODO: remove when back in europe


	stringlength += ftoa(stat->gps_long, &txdata[stringlength], 7); //convert gps long to string with sign and 7 afterpoint
	txdata[stringlength++] = ','; 					//plus a comma

	stringlength += tfp_sprintf(&(txdata[stringlength]), "%d,%u,%u,%u,%u,%u,%u,%d,%d,%d,%d,%u,%u,%d,%d,%d,%d,%d",
											stat->gps_fix_quality,
											stat->system_seconds,
											stat->v_bat,
											stat->v_solar,
											stat->i_in,
											stat->i_out,
											stat->imu_calib_status,
											stat->imu_heading,
											stat->imu_roll,
											stat->imu_pitch,
											stat->int_temperature,
											stat->int_pressure,
											stat->int_humidity,
											stat->ext_temperature,
											stat->ext_pressure,
											stat->ext_humidity,
											stat->accel_x,
											stat->accel_y,
											stat->accel_z,
											stat->speed,
											stat->altitude);

Known issues

driverlib.h is not existing/found

This could happen if you're still using an old version of CCS. Update your software as well as MSPWare and TI-RTOS in the app center and try again. (Make clean and rebuild index to be on the safe side)