Learning about Contiki¶
Materials¶
Presentation about Contiki by Inga Rüb
Other useful links:
Contiki Wiki, especially:
Contiki-NG Wiki (Not everything applies to Contiki 3.0!), especially:
Programming TelosB/Sky with Contiki apps¶
Listing motes connected to the computer:
make motelist
Building an app (e.g. hello-world):
make TARGET=sky hello-world
Programing TelosB/Sky:
make TARGET=sky PORT=/dev/ttyUSB0 hello-world.upload
Make tricks¶
Saving target – allows to omit TARGET=sky each time (saved per app):
make TARGET=sky savetarget
Combining commands – e.g. programing and then launching serial console:
make TARGET=sky PORT=/dev/ttyUSB0 hello-world.upload login
Mote’s addresses¶
A single mote can have many network addresses, depending on its netstack. E.g.: Rime address, MAC address, Node id, …
They are printed on the serial console when a mote boots up, e.g.:
Rime started with address 70.31
MAC 46:1f:00:00:00:00:00:00 Contiki-3.0 started. Node id is not set.
Reciving messages from UART/serial console¶
A helpful snippet:
#include "dev/serial-line.h"
#include "dev/uart1.h"
// ...
PROCESS_THREAD(uart_process, ev, data)
// ...
uart1_set_input(serial_line_input_byte);
serial_line_init();
//...
if (ev == serial_line_event_message) {
printf("received line: %s\n", (char *)data);
}