mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-10-15 18:25:19 +00:00
Updated RE-Mote revision A support and cleaning up Zolertia platforms
This commit is contained in:
parent
b25117a8b8
commit
27fd1a5eb8
2
.gitignore
vendored
2
.gitignore
vendored
@ -25,7 +25,7 @@
|
||||
*.c128
|
||||
*.c64
|
||||
*.cc2538dk
|
||||
*.remote
|
||||
*.zoul
|
||||
*.jn516x
|
||||
*.srf06-cc26xx
|
||||
*.ev-aducrf101mkxz
|
||||
|
@ -1 +0,0 @@
|
||||
TARGET = remote
|
@ -1 +0,0 @@
|
||||
TARGET = z1
|
@ -1,15 +0,0 @@
|
||||
CONTIKI = ../../..
|
||||
|
||||
ifndef TARGET
|
||||
TARGET=z1
|
||||
endif
|
||||
|
||||
CONTIKI_PROJECT = test-phidgets blink test-adxl345 tmp102-test test-battery test-sht11 #test-potent
|
||||
CONTIKI_SOURCEFILES += cc2420-arch.c sensors.c sht11.c
|
||||
PROJECT_SOURCEFILES = i2cmaster.c tmp102.c adxl345.c battery-sensor.c sky-sensors.c #potentiometer-sensor.c
|
||||
all: example-unicast2
|
||||
|
||||
CONTIKI_WITH_RIME = 1
|
||||
include $(CONTIKI)/Makefile.include
|
||||
|
||||
|
@ -15,6 +15,6 @@ CONTIKI_PROJECT += test-potent
|
||||
endif
|
||||
|
||||
all: $(CONTIKI_PROJECT)
|
||||
CONTIKI = ../..
|
||||
CONTIKI = ../../..
|
||||
CONTIKI_WITH_RIME = 1
|
||||
include $(CONTIKI)/Makefile.include
|
@ -1,6 +1,6 @@
|
||||
all: z1-websense
|
||||
|
||||
CONTIKI=../../../..
|
||||
CONTIKI=../../../../..
|
||||
|
||||
SMALL=1
|
||||
|
@ -1,9 +1,9 @@
|
||||
DEFINES+=PROJECT_CONF_H=\"project-conf.h\"
|
||||
CONTIKI_PROJECT = remote-demo test-tsl2563 test-sht25
|
||||
CONTIKI_PROJECT = zoul-demo test-tsl2563 test-sht25
|
||||
CONTIKI_TARGET_SOURCEFILES += tsl2563.c sht25.c
|
||||
|
||||
all: $(CONTIKI_PROJECT)
|
||||
|
||||
CONTIKI = ../..
|
||||
CONTIKI = ../../..
|
||||
CONTIKI_WITH_RIME = 1
|
||||
include $(CONTIKI)/Makefile.include
|
1
examples/zolertia/zoul/Makefile.target
Normal file
1
examples/zolertia/zoul/Makefile.target
Normal file
@ -0,0 +1 @@
|
||||
TARGET = zoul
|
8
examples/zolertia/zoul/cc1200-demo/Makefile
Normal file
8
examples/zolertia/zoul/cc1200-demo/Makefile
Normal file
@ -0,0 +1,8 @@
|
||||
DEFINES+=PROJECT_CONF_H=\"project-conf.h\"
|
||||
CONTIKI_PROJECT = cc1200-demo
|
||||
|
||||
all: $(CONTIKI_PROJECT)
|
||||
|
||||
CONTIKI = ../../../..
|
||||
CONTIKI_WITH_RIME = 1
|
||||
include $(CONTIKI)/Makefile.include
|
1
examples/zolertia/zoul/cc1200-demo/Makefile.target
Normal file
1
examples/zolertia/zoul/cc1200-demo/Makefile.target
Normal file
@ -0,0 +1 @@
|
||||
TARGET = zoul
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Swedish Institute of Computer Science.
|
||||
* Copyright (c) 2015, Zolertia - http://www.zolertia.com
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -26,106 +26,80 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*
|
||||
*/
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \addtogroup zoul-cc1200-demo Zoul on-board CC1200 RF transceiver test
|
||||
*
|
||||
* Demonstrates the use of the TI CC1200 RF transceiver on Sub-1GHz
|
||||
* @{
|
||||
*
|
||||
* \file
|
||||
* Best-effort single-hop unicast example
|
||||
* Test file for the CC1200 demo
|
||||
*
|
||||
* \author
|
||||
* Adam Dunkels <adam@sics.se>
|
||||
* Antonio Lignan <alinan@zolertia.com>
|
||||
*/
|
||||
|
||||
#include "contiki.h"
|
||||
#include "net/rime/rime.h"
|
||||
|
||||
#include "dev/button-sensor.h"
|
||||
|
||||
#include "cpu.h"
|
||||
#include "sys/etimer.h"
|
||||
#include "dev/leds.h"
|
||||
#include "dev/watchdog.h"
|
||||
#include "dev/serial-line.h"
|
||||
#include "dev/sys-ctrl.h"
|
||||
#include "net/rime/broadcast.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include "dev/i2cmaster.h"
|
||||
#include "dev/tmp102.h"
|
||||
|
||||
#if 1
|
||||
#define PRINTF(...) printf(__VA_ARGS__)
|
||||
#else
|
||||
#define PRINTF(...)
|
||||
#endif
|
||||
|
||||
|
||||
#define SENDER 205
|
||||
#define RECEIVER 200
|
||||
|
||||
|
||||
#define PRINTFDEBUG(...)
|
||||
|
||||
|
||||
#define TMP102_READ_INTERVAL (CLOCK_SECOND/2)
|
||||
|
||||
int16_t tempint;
|
||||
uint16_t tempfrac;
|
||||
int16_t raw;
|
||||
uint16_t absraw;
|
||||
int16_t sign;
|
||||
char minus = ' ';
|
||||
|
||||
#include <stdint.h>
|
||||
/*---------------------------------------------------------------------------*/
|
||||
PROCESS(example_unicast_process, "Example unicast");
|
||||
AUTOSTART_PROCESSES(&example_unicast_process);
|
||||
#define LOOP_PERIOD 2
|
||||
#define LOOP_INTERVAL (CLOCK_SECOND * LOOP_PERIOD)
|
||||
#define BROADCAST_CHANNEL 129
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static struct etimer et;
|
||||
static uint16_t counter;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
recv_uc(struct unicast_conn *c, const linkaddr_t *from)
|
||||
broadcast_recv(struct broadcast_conn *c, const linkaddr_t *from)
|
||||
{
|
||||
printf("unicast message received from %d.%d\n",
|
||||
from->u8[0], from->u8[1]);
|
||||
printf("*** Received %u bytes from %u:%u: '0x%04u' ", packetbuf_datalen(),
|
||||
from->u8[0], from->u8[1], *(uint16_t *)packetbuf_dataptr());
|
||||
printf("%d - %u\n", (int8_t) packetbuf_attr(PACKETBUF_ATTR_RSSI),
|
||||
packetbuf_attr(PACKETBUF_ATTR_LINK_QUALITY));
|
||||
leds_toggle(LEDS_GREEN);
|
||||
}
|
||||
static const struct unicast_callbacks unicast_callbacks = {recv_uc};
|
||||
static struct unicast_conn uc;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
PROCESS_THREAD(example_unicast_process, ev, data)
|
||||
static const struct broadcast_callbacks bc_rx = { broadcast_recv };
|
||||
static struct broadcast_conn bc;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
PROCESS(cc1200_demo_process, "cc1200 demo process");
|
||||
AUTOSTART_PROCESSES(&cc1200_demo_process);
|
||||
/*---------------------------------------------------------------------------*/
|
||||
PROCESS_THREAD(cc1200_demo_process, ev, data)
|
||||
{
|
||||
PROCESS_EXITHANDLER(unicast_close(&uc);)
|
||||
|
||||
PROCESS_EXITHANDLER(broadcast_close(&bc))
|
||||
PROCESS_BEGIN();
|
||||
|
||||
broadcast_open(&bc, BROADCAST_CHANNEL, &bc_rx);
|
||||
|
||||
etimer_set(&et, LOOP_INTERVAL);
|
||||
|
||||
tmp102_init();
|
||||
linkaddr_t addr;
|
||||
unicast_open(&uc, 133, &unicast_callbacks);
|
||||
SENSORS_ACTIVATE(button_sensor);
|
||||
while(1) {
|
||||
|
||||
PROCESS_WAIT_EVENT_UNTIL(ev==sensors_event && data == &button_sensor);
|
||||
sign = 1;
|
||||
|
||||
//PRINTFDEBUG ("Reading Temp...\n");
|
||||
raw = tmp102_read_temp_raw();
|
||||
|
||||
absraw = raw;
|
||||
if (raw < 0) { // Perform 2C's if sensor returned negative data
|
||||
absraw = (raw ^ 0xFFFF) + 1;
|
||||
sign = -1;
|
||||
}
|
||||
tempint = (absraw >> 8) * sign;
|
||||
tempfrac = ((absraw>>4) % 16) * 625; // Info in 1/10000 of degree
|
||||
minus = ((tempint == 0) & (sign == -1)) ? '-' : ' ' ;
|
||||
PRINTF ("Current Temp = %c%d.%04d\n", minus, tempint, tempfrac);
|
||||
|
||||
|
||||
|
||||
char s[30];
|
||||
sprintf(s,"Temp is %c%d.%04d\n", minus, tempint, tempfrac);
|
||||
printf("sending %s\n",s);
|
||||
packetbuf_copyfrom(s, 30);
|
||||
addr.u8[0] = RECEIVER;
|
||||
addr.u8[1] = 0;
|
||||
|
||||
unicast_send(&uc, &addr);
|
||||
PROCESS_YIELD();
|
||||
if(ev == PROCESS_EVENT_TIMER) {
|
||||
printf("Broadcast --> %u\n", counter);
|
||||
leds_toggle(LEDS_RED);
|
||||
packetbuf_copyfrom(&counter, sizeof(counter));
|
||||
broadcast_send(&bc);
|
||||
counter++;
|
||||
etimer_set(&et, LOOP_INTERVAL);
|
||||
}
|
||||
}
|
||||
|
||||
PROCESS_END();
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Swedish Institute of Computer Science.
|
||||
* Copyright (c) 2015, Zolertia - http://www.zolertia.com
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -26,64 +26,36 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*
|
||||
*/
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \addtogroup zoul-examples
|
||||
* @{
|
||||
*
|
||||
* \defgroup remote-cc1200-demo RE-Mote CC1200 RF transceiver test
|
||||
*
|
||||
* Demonstrates the use of the TI CC1200 RF transceiver on Sub-1GHz
|
||||
* @{
|
||||
*
|
||||
* \file
|
||||
* Best-effort single-hop unicast example
|
||||
* Configuration file for the cc1200 demo
|
||||
*
|
||||
* \author
|
||||
* Adam Dunkels <adam@sics.se>
|
||||
* Antonio Lignan <alinan@zolertia.com>
|
||||
*/
|
||||
#ifndef PROJECT_CONF_H_
|
||||
#define PROJECT_CONF_H_
|
||||
|
||||
#include "contiki.h"
|
||||
#include "net/rime/rime.h"
|
||||
#undef NETSTACK_CONF_RADIO
|
||||
#define NETSTACK_CONF_RADIO cc1200_driver
|
||||
#define NETSTACK_CONF_RDC nullrdc_driver
|
||||
#define CC1200_CONF_USE_GPIO2 0
|
||||
#define CC1200_CONF_USE_RX_WATCHDOG 0
|
||||
#define ANTENNA_SW_SELECT_DEF_CONF ANTENNA_SW_SELECT_SUBGHZ
|
||||
|
||||
#include "dev/button-sensor.h"
|
||||
#endif /* PROJECT_CONF_H_ */
|
||||
|
||||
#include "dev/leds.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
PROCESS(example_unicast_process, "Example unicast");
|
||||
AUTOSTART_PROCESSES(&example_unicast_process);
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
recv_uc(struct unicast_conn *c, const linkaddr_t *from)
|
||||
{
|
||||
printf("unicast message received from %d.%d\n",
|
||||
from->u8[0], from->u8[1]);
|
||||
}
|
||||
static const struct unicast_callbacks unicast_callbacks = {recv_uc};
|
||||
static struct unicast_conn uc;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
PROCESS_THREAD(example_unicast_process, ev, data)
|
||||
{
|
||||
PROCESS_EXITHANDLER(unicast_close(&uc);)
|
||||
|
||||
PROCESS_BEGIN();
|
||||
|
||||
unicast_open(&uc, 199, &unicast_callbacks);
|
||||
|
||||
while(1) {
|
||||
static struct etimer et;
|
||||
linkaddr_t addr;
|
||||
|
||||
etimer_set(&et, CLOCK_SECOND);
|
||||
|
||||
PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et));
|
||||
|
||||
//packetbuf_copyfrom("Enric Here!", 12);
|
||||
//addr.u8[0] = 200;
|
||||
//addr.u8[1] = 0;
|
||||
//if(!linkaddr_cmp(&addr, &linkaddr_node_addr)) {
|
||||
//unicast_send(&uc, &addr);
|
||||
//}
|
||||
|
||||
}
|
||||
|
||||
PROCESS_END();
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
*/
|
@ -1,4 +1,4 @@
|
||||
Re-Mote + Node Red README
|
||||
RE-Mote + Node Red README
|
||||
========================
|
||||
|
||||
A very basic example of how to use MQTT-Demo + Mosquitto + Node Red
|
||||
@ -10,9 +10,9 @@ Install Mosquitto
|
||||
|
||||
Fire up a Re-Mote
|
||||
-----------------
|
||||
* Compile the MQTT demo example from `../../cc2538dk/mqtt-demo.c` following
|
||||
* Compile the MQTT demo example from `../../../cc2538dk/mqtt-demo.c` following
|
||||
the instructions of the README.md therein.
|
||||
* Program your Re-Mote.
|
||||
* Program your RE-Mote.
|
||||
* If you are running mosquitto with `-v`, a few seconds later you should see
|
||||
the Re-Mote connect, subscribe and start publishing.
|
||||
|
@ -33,7 +33,7 @@
|
||||
* @{
|
||||
*
|
||||
* \file
|
||||
* Project specific configuration defines for the basic Re-Mote examples
|
||||
* Project specific configuration defines for the basic RE-Mote examples
|
||||
*/
|
||||
#ifndef PROJECT_CONF_H_
|
||||
#define PROJECT_CONF_H_
|
@ -30,21 +30,30 @@
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* \addtogroup zoul-examples
|
||||
* @{
|
||||
*
|
||||
* \defgroup zoul-sht25-test SHT25 temperature and humidity sensor test
|
||||
*
|
||||
* Demonstrates the use of the SHT25 digital temperature and humidity sensor
|
||||
* @{
|
||||
*
|
||||
* \file
|
||||
* A quick program for testing the SHT25 temperature and humidity sensor
|
||||
* \author
|
||||
* Antonio Lignan <alinan@zolertia.com>
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#include <stdio.h>
|
||||
#include "contiki.h"
|
||||
#include "dev/sht25.h"
|
||||
|
||||
PROCESS(test_sht25_process, "SHT25 test");
|
||||
AUTOSTART_PROCESSES(&test_sht25_process);
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
PROCESS(remote_sht25_process, "SHT25 test");
|
||||
AUTOSTART_PROCESSES(&remote_sht25_process);
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static struct etimer et;
|
||||
|
||||
PROCESS_THREAD(test_sht25_process, ev, data)
|
||||
/*---------------------------------------------------------------------------*/
|
||||
PROCESS_THREAD(remote_sht25_process, ev, data)
|
||||
{
|
||||
int16_t temperature, humidity;
|
||||
|
||||
@ -61,3 +70,9 @@ PROCESS_THREAD(test_sht25_process, ev, data)
|
||||
}
|
||||
PROCESS_END();
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
*/
|
||||
|
@ -29,41 +29,41 @@
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \addtogroup remote-examples
|
||||
* \addtogroup zoul-examples
|
||||
* @{
|
||||
*
|
||||
* \defgroup remote-tsl2563-test Re-Mote TSL2563 light sensor test
|
||||
* \defgroup zoul-tsl2563-test TSL2563 light sensor test
|
||||
*
|
||||
* Demonstrates the use of the TSL2563 digital ambient light sensor
|
||||
* @{
|
||||
*
|
||||
* \file
|
||||
* Driver for the Re-Mote external TSL2563 light sensor (Ziglet)
|
||||
* Driver for the external TSL2563 light sensor
|
||||
*
|
||||
* \author
|
||||
* Antonio Lignan <alinan@zolertia.com>
|
||||
* Toni Lozano <tlozano@zolertia.com>
|
||||
*/
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#include <stdio.h>
|
||||
#include "contiki.h"
|
||||
#include "dev/i2c.h"
|
||||
#include "dev/tsl2563.h"
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#if 1
|
||||
#define PRINTF(...) printf(__VA_ARGS__)
|
||||
#else
|
||||
#define PRINTF(...)
|
||||
#endif
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#define SENSOR_READ_INTERVAL (CLOCK_SECOND / 2)
|
||||
|
||||
PROCESS(test_process, "Test TSL2563 light ziglet process");
|
||||
AUTOSTART_PROCESSES(&test_process);
|
||||
/*---------------------------------------------------------------------------*/
|
||||
PROCESS(remote_tsl2563_process, "TSL2563 test process");
|
||||
AUTOSTART_PROCESSES(&remote_tsl2563_process);
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static struct etimer et;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
PROCESS_THREAD(test_process, ev, data)
|
||||
PROCESS_THREAD(remote_tsl2563_process, ev, data)
|
||||
{
|
||||
PROCESS_BEGIN();
|
||||
int light;
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/
|
||||
* Copyright (c) 2015, Zolertia - http://www.zolertia.com
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -29,15 +30,16 @@
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/**
|
||||
* \addtogroup remote
|
||||
* \addtogroup zoul
|
||||
* @{
|
||||
*
|
||||
* \defgroup remote-examples Re-Mote Example Projects
|
||||
* \defgroup zoul-examples Zoul examples
|
||||
* @{
|
||||
*
|
||||
* \defgroup remote-demo Re-Mote Demo Project
|
||||
* \defgroup zoul-demo Zoul demo application
|
||||
*
|
||||
* Example project demonstrating the Re-Mote functionality
|
||||
* Example project demonstrating the Zoul module on the RE-Mote and Firefly
|
||||
* platforms.
|
||||
*
|
||||
* - Boot sequence: LEDs flashing (Red, then yellow, finally green)
|
||||
*
|
||||
@ -54,13 +56,11 @@
|
||||
* packet will toggle LEDs defined as LEDS_RF_RX
|
||||
* - Button : Keeping the button pressed will print a counter that
|
||||
* increments every BUTTON_PRESS_EVENT_INTERVAL ticks
|
||||
* - TMP102 : Built-in digital temperature sensor, every LOOP_INTERVAL
|
||||
* clock ticks a sensor reading will be taken
|
||||
*
|
||||
* @{
|
||||
*
|
||||
* \file
|
||||
* Example demonstrating the Re-Mote platform
|
||||
* Example demonstrating the Zoul module on the RE-Mote & Firefly platforms
|
||||
*/
|
||||
#include "contiki.h"
|
||||
#include "cpu.h"
|
||||
@ -69,13 +69,11 @@
|
||||
#include "dev/leds.h"
|
||||
#include "dev/uart.h"
|
||||
#include "dev/button-sensor.h"
|
||||
#include "dev/remote-sensors.h"
|
||||
#include "dev/zoul-sensors.h"
|
||||
#include "dev/watchdog.h"
|
||||
#include "dev/serial-line.h"
|
||||
#include "dev/sys-ctrl.h"
|
||||
#include "net/rime/broadcast.h"
|
||||
#include "dev/antenna-sw.h"
|
||||
#include "dev/tmp102.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
@ -94,10 +92,10 @@
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static struct etimer et;
|
||||
static struct rtimer rt;
|
||||
static uint16_t counter, temperature;
|
||||
static uint16_t counter;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
PROCESS(cc2538_demo_process, "cc2538 demo process");
|
||||
AUTOSTART_PROCESSES(&cc2538_demo_process);
|
||||
PROCESS(zoul_demo_process, "Zoul demo process");
|
||||
AUTOSTART_PROCESSES(&zoul_demo_process);
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
broadcast_recv(struct broadcast_conn *c, const linkaddr_t *from)
|
||||
@ -116,7 +114,7 @@ rt_callback(struct rtimer *t, void *ptr)
|
||||
leds_off(LEDS_PERIODIC);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
PROCESS_THREAD(cc2538_demo_process, ev, data)
|
||||
PROCESS_THREAD(zoul_demo_process, ev, data)
|
||||
{
|
||||
PROCESS_EXITHANDLER(broadcast_close(&bc))
|
||||
|
||||
@ -125,15 +123,14 @@ PROCESS_THREAD(cc2538_demo_process, ev, data)
|
||||
counter = 0;
|
||||
broadcast_open(&bc, BROADCAST_CHANNEL, &bc_rx);
|
||||
|
||||
/* Enable antenna */
|
||||
antenna_sw_select(ANTENNA_SW_SELECT_INTERNAL);
|
||||
|
||||
/* Configure the user button */
|
||||
button_sensor.configure(BUTTON_SENSOR_CONFIG_TYPE_INTERVAL,
|
||||
BUTTON_PRESS_EVENT_INTERVAL);
|
||||
|
||||
tmp102_init();
|
||||
/* Configure the ADC ports */
|
||||
adc_sensors.configure(SENSORS_HW_INIT, ZOUL_SENSORS_ADC_ALL);
|
||||
|
||||
printf("Re-Mote test application, initial values:\n");
|
||||
printf("Zoul test application\n");
|
||||
|
||||
etimer_set(&et, LOOP_INTERVAL);
|
||||
|
||||
@ -153,14 +150,11 @@ PROCESS_THREAD(cc2538_demo_process, ev, data)
|
||||
printf("Temperature = %d mC\n",
|
||||
cc2538_temp_sensor.value(CC2538_SENSORS_VALUE_TYPE_CONVERTED));
|
||||
|
||||
printf("Phidget ADC2 = %d raw\n",
|
||||
phidget_sensor.value(PHIDGET_SENSORS_ADC2));
|
||||
printf("ADC1 = %d raw\n",
|
||||
adc_sensors.value(ZOUL_SENSORS_ADC1));
|
||||
|
||||
printf("Phidget ADC3 = %d raw\n",
|
||||
phidget_sensor.value(PHIDGET_SENSORS_ADC3));
|
||||
|
||||
tmp102_read(&temperature);
|
||||
printf("TMP102 sensor = %u mC\n", temperature);
|
||||
printf("ADC3 = %d raw\n",
|
||||
adc_sensors.value(ZOUL_SENSORS_ADC3));
|
||||
|
||||
etimer_set(&et, LOOP_INTERVAL);
|
||||
rtimer_set(&rt, RTIMER_NOW() + LEDS_OFF_HYSTERISIS, 1,
|
||||
@ -170,11 +164,11 @@ PROCESS_THREAD(cc2538_demo_process, ev, data)
|
||||
if(data == &button_sensor) {
|
||||
if(button_sensor.value(BUTTON_SENSOR_VALUE_TYPE_LEVEL) ==
|
||||
BUTTON_SENSOR_PRESSED_LEVEL) {
|
||||
printf("Press\n");
|
||||
printf("Button pressed\n");
|
||||
packetbuf_copyfrom(&counter, sizeof(counter));
|
||||
broadcast_send(&bc);
|
||||
} else {
|
||||
printf("Release\n");
|
||||
printf("...and released!\n");
|
||||
}
|
||||
}
|
||||
} else if(ev == serial_line_event_message) {
|
@ -1,49 +0,0 @@
|
||||
# Remote platform makefile
|
||||
|
||||
ifndef CONTIKI
|
||||
$(error CONTIKI not defined! You must specify where CONTIKI resides!)
|
||||
endif
|
||||
|
||||
PYTHON = python
|
||||
BSL_FLAGS += -e -w -v
|
||||
|
||||
ifdef PORT
|
||||
BSL_FLAGS += -p $(PORT)
|
||||
endif
|
||||
|
||||
CONTIKI_TARGET_DIRS = . dev
|
||||
|
||||
CONTIKI_TARGET_SOURCEFILES += leds.c leds-arch.c
|
||||
CONTIKI_TARGET_SOURCEFILES += contiki-main.c
|
||||
CONTIKI_TARGET_SOURCEFILES += sensors.c remote-sensors.c
|
||||
CONTIKI_TARGET_SOURCEFILES += button-sensor.c antenna-sw.c
|
||||
CONTIKI_TARGET_SOURCEFILES += phidget-sensor.c tmp102.c
|
||||
|
||||
CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES)
|
||||
|
||||
CLEAN += *.remote
|
||||
|
||||
### Unless the example dictates otherwise, build with code size optimisations
|
||||
ifndef SMALL
|
||||
SMALL = 1
|
||||
endif
|
||||
|
||||
### Define the CPU directory
|
||||
CONTIKI_CPU=$(CONTIKI)/cpu/cc2538
|
||||
include $(CONTIKI_CPU)/Makefile.cc2538
|
||||
|
||||
MODULES += core/net core/net/mac \
|
||||
core/net/mac/contikimac \
|
||||
core/net/llsec
|
||||
|
||||
BSL = $(CONTIKI)/tools/cc2538-bsl/cc2538-bsl.py
|
||||
|
||||
%.upload: %.bin %.elf
|
||||
ifeq ($(wildcard $(BSL)), )
|
||||
@echo "ERROR: Could not find the cc2538-bsl script. Did you run 'git submodule update --init' ?"
|
||||
else
|
||||
$(eval BSL_ADDRESS_ARG := -a $(shell $(OBJDUMP) -h $*.elf | grep -B1 LOAD | \
|
||||
grep -Ev 'LOAD|\-\-' | awk '{print "0x" $$5}' | \
|
||||
sort -g | head -1))
|
||||
$(PYTHON) $(BSL) $(BSL_FLAGS) $(BSL_ADDRESS_ARG) $<
|
||||
endif
|
@ -1,278 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/** \addtogroup remote
|
||||
* @{
|
||||
*
|
||||
* \defgroup remote-peripherals Re-Mote Peripherals
|
||||
*
|
||||
* Defines related to the Re-Mote
|
||||
*
|
||||
* This file provides connectivity information on LEDs, Buttons, UART and
|
||||
* other Re-Mote peripherals
|
||||
*
|
||||
* This file can be used as the basis to configure other platforms using the
|
||||
* cc2538 SoC.
|
||||
* @{
|
||||
*
|
||||
* \file
|
||||
* Header file with definitions related to the I/O connections on the Zolertia's
|
||||
* Re-Mote platform, cc2538-based
|
||||
*
|
||||
* \note Do not include this file directly. It gets included by contiki-conf
|
||||
* after all relevant directives have been set.
|
||||
*/
|
||||
#ifndef BOARD_H_
|
||||
#define BOARD_H_
|
||||
|
||||
#include "dev/gpio.h"
|
||||
#include "dev/nvic.h"
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** \name Re-Mote LED configuration
|
||||
*
|
||||
* LEDs on the Re-mote are connected as follows:
|
||||
* - LED1 (Red) -> PD2
|
||||
* - LED2 (Blue) -> PC3
|
||||
* - LED3 (Green) -> PD5
|
||||
*
|
||||
* LED1 routed also to JP5 connector
|
||||
* LED2 shares the same pin with Watchdog WDI pulse and routed to JP8 connector
|
||||
* LED3 routed also to JP5 connector
|
||||
* @{
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Some files include leds.h before us, so we need to get rid of defaults in
|
||||
* leds.h before we provide correct definitions */
|
||||
#undef LEDS_GREEN
|
||||
#undef LEDS_YELLOW
|
||||
#undef LEDS_BLUE
|
||||
#undef LEDS_RED
|
||||
#undef LEDS_CONF_ALL
|
||||
|
||||
/* In leds.h the LEDS_BLUE is defined by LED_YELLOW definition */
|
||||
#define LEDS_GREEN 1 /**< LED1 (Green) -> PD5 */
|
||||
#define LEDS_BLUE 2 /**< LED2 (Blue) -> PC3 */
|
||||
#define LEDS_RED 4 /**< LED3 (Red) -> PD2 */
|
||||
|
||||
#define LEDS_CONF_ALL 7
|
||||
|
||||
#define LEDS_LIGHT_BLUE (LEDS_GREEN | LEDS_BLUE) /**< Green + Blue (3) */
|
||||
#define LEDS_YELLOW (LEDS_GREEN | LEDS_RED) /**< Green + Red (5) */
|
||||
#define LEDS_PURPLE (LEDS_BLUE | LEDS_RED) /**< Blue + Red (6) */
|
||||
#define LEDS_WHITE LEDS_ALL /**< Green + Blue + Red (7) */
|
||||
|
||||
/* Notify various examples that we have LEDs */
|
||||
#define PLATFORM_HAS_LEDS 1
|
||||
/** @} */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** \name USB configuration
|
||||
*
|
||||
* The USB pullup is enabled by an external resistor, not mapped to a GPIO
|
||||
*/
|
||||
#ifdef USB_PULLUP_PORT
|
||||
#undef USB_PULLUP_PORT
|
||||
#endif
|
||||
#ifdef USB_PULLUP_PIN
|
||||
#undef USB_PULLUP_PIN
|
||||
#endif
|
||||
/** @} */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** \name UART configuration
|
||||
*
|
||||
* On the Re-Mote, the UART is connected to the following ports/pins
|
||||
* - UART0:
|
||||
* - RX: PA0
|
||||
* - TX: PA1
|
||||
* - UART1:
|
||||
* - RX: PC6
|
||||
* - TX: PC5
|
||||
* - CTS:
|
||||
* - RTS:
|
||||
* We configure the port to use UART0 and UART1, CTS/RTS only for UART1,
|
||||
* both without a HW pull-up resistor
|
||||
* @{
|
||||
*/
|
||||
#define UART0_RX_PORT GPIO_A_NUM
|
||||
#define UART0_RX_PIN 0
|
||||
#define UART0_TX_PORT GPIO_A_NUM
|
||||
#define UART0_TX_PIN 1
|
||||
|
||||
#define UART1_RX_PORT GPIO_C_NUM
|
||||
#define UART1_RX_PIN 6
|
||||
#define UART1_TX_PORT GPIO_C_NUM
|
||||
#define UART1_TX_PIN 5
|
||||
#define UART1_CTS_PORT GPIO_C_NUM
|
||||
#define UART1_CTS_PIN 1
|
||||
#define UART1_RTS_PORT GPIO_C_NUM
|
||||
#define UART1_RTS_PIN 2
|
||||
/** @} */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** \name Re-Mote Button configuration
|
||||
*
|
||||
* Buttons on the Re-Mote are connected as follows:
|
||||
* - BUTTON_USER -> PA3, S1 user button, shared with bootloader
|
||||
* - BUTTON_RESET -> RESET_N line, S2 reset both CC2538 and CoP
|
||||
* - BUTTON_VBAT -> Power switch, not mounted by default
|
||||
* @{
|
||||
*/
|
||||
/** BUTTON_USER -> PA3 */
|
||||
#define BUTTON_USER_PORT GPIO_A_NUM
|
||||
#define BUTTON_USER_PIN 3
|
||||
#define BUTTON_USER_VECTOR NVIC_INT_GPIO_PORT_A
|
||||
|
||||
/* Notify various examples that we have Buttons */
|
||||
#define PLATFORM_HAS_BUTTON 1
|
||||
/** @} */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \name ADC configuration
|
||||
*
|
||||
* These values configure which CC2538 pins and ADC channels to use for the ADC
|
||||
* inputs. By default the Re-Mote allows two out-of-the-box ADC ports with a
|
||||
* phidget-like 3-pin connector (GND/3V3/ADC)
|
||||
*
|
||||
* ADC inputs can only be on port A.
|
||||
* @{
|
||||
*/
|
||||
#define ADC_PHIDGET_PORT GPIO_A_NUM /**< Phidget GPIO control port */
|
||||
#define ADC_PHIDGET_ADC2_PIN 6 /**< ADC2 to PA6, 3V3 */
|
||||
#define ADC_PHIDGET_ADC3_PIN 7 /**< ADC3 to PA7, 3V3 */
|
||||
/** @} */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \name SPI (SSI0) configuration
|
||||
*
|
||||
* These values configure which CC2538 pins to use for the SPI (SSI0) lines,
|
||||
* shared with the CC1120 RF transceiver
|
||||
* TX -> MOSI, RX -> MISO
|
||||
* @{
|
||||
*/
|
||||
#define SPI0_CLK_PORT GPIO_D_NUM
|
||||
#define SPI0_CLK_PIN 1
|
||||
#define SPI0_TX_PORT GPIO_D_NUM
|
||||
#define SPI0_TX_PIN 0
|
||||
#define SPI0_RX_PORT GPIO_C_NUM
|
||||
#define SPI0_RX_PIN 4
|
||||
/** @} */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \name SPI (SSI1) configuration
|
||||
*
|
||||
* These values configure which CC2538 pins to use for the SPI (SSI1) lines,
|
||||
* shared with the microSD, not routed anywhere.
|
||||
* TX -> MOSI, RX -> MISO
|
||||
* @{
|
||||
*/
|
||||
#define SPI1_CLK_PORT GPIO_B_NUM
|
||||
#define SPI1_CLK_PIN 5
|
||||
#define SPI1_TX_PORT GPIO_C_NUM
|
||||
#define SPI1_TX_PIN 7
|
||||
#define SPI1_RX_PORT GPIO_A_NUM
|
||||
#define SPI1_RX_PIN 4
|
||||
/** @} */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \name I2C configuration
|
||||
*
|
||||
* These values configure which CC2538 pins to use for the I2C lines, shared
|
||||
* with the TMP102 built-in temperature sensor
|
||||
* @{
|
||||
*/
|
||||
#define I2C_SCL_PORT GPIO_B_NUM
|
||||
#define I2C_SCL_PIN 1
|
||||
#define I2C_SDA_PORT GPIO_B_NUM
|
||||
#define I2C_SDA_PIN 0
|
||||
/** @} */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \name Antenna switch configuration
|
||||
*
|
||||
* These values configure the required pin to drive the antenna switch, to
|
||||
* use either the built-in ceramic antenna or an external one over the uFL
|
||||
* connector
|
||||
* - Internal antenna: LOW
|
||||
* - External antenna: HIGH
|
||||
* @{
|
||||
*/
|
||||
#define ANTENNA_2_4GHZ_SW_PORT GPIO_D_NUM
|
||||
#define ANTENNA_2_4GHZ_SW_PIN 4
|
||||
/** @} */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \name CC1120/CC1200 configuration
|
||||
*
|
||||
* These values configure the required pins to drive the CC1120/CC1200
|
||||
* @{
|
||||
*/
|
||||
#define CC1120_SPI_SCLK_PORT SPI0_CLK_PORT
|
||||
#define CC1120_SPI_SCLK_PIN SPI0_CLK_PIN
|
||||
#define CC1120_SPI_MOSI_PORT SPIO0_TX_PORT
|
||||
#define CC1120_SPI_MOSI_PIN SPIO0_TX_PIN
|
||||
#define CC1120_SPI_MISO_PORT SPIO0_RX_PORT
|
||||
#define CC1120_SPI_MISO_PIN SPIO0_RX_PIN
|
||||
#define CC1120_SPI_CSN_PORT GPIO_D_NUM
|
||||
#define CC1120_SPI_CSN_PIN 3
|
||||
#define CC1120_GDO0_PORT GPIO_B_NUM
|
||||
#define CC1120_GDO0_PIN 4
|
||||
#define CC1120_GDO2_PORT GPIO_B_NUM
|
||||
#define CC1120_GDO2_PIN 3
|
||||
#define CC1120_RESET_PORT GPIO_B_NUM
|
||||
#define CC1120_RESET_PIN 2
|
||||
#define CC1120_GPIO0_VECTOR NVIC_INT_GPIO_PORT_B
|
||||
/** @} */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \name microSD configuration
|
||||
*
|
||||
* These values configure the required pins to drive the built-in microSD
|
||||
* external module, to be used with SSI1
|
||||
* @{
|
||||
*/
|
||||
#define USD_CLK_PORT SPI1_CLK_PORT
|
||||
#define USD_CLK_PIN SPI1_CLK_PIN
|
||||
#define USD_MOSI_PORT SPI1_TX_PORT
|
||||
#define USD_MOSI_PIN SPI1_TX_PIN
|
||||
#define USD_MISO_PORT SPI1_RX_PORT
|
||||
#define USD_MISO_PIN SPI1_RX_PIN
|
||||
/** @} */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \name Device string used on startup
|
||||
* @{
|
||||
*/
|
||||
#define BOARD_STRING "Zolertia Re-Mote platform"
|
||||
/** @} */
|
||||
|
||||
#endif /* BOARD_H_ */
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
*/
|
@ -57,12 +57,11 @@ ifeq ($(HOST_OS),Darwin)
|
||||
ifndef MOTELIST
|
||||
USBDEVPREFIX=
|
||||
SERIALDUMP = $(CONTIKI)/tools/sky/serialdump-linux
|
||||
MOTELIST = $(CONTIKI)/tools/z1/motelist-z1-macos
|
||||
BSL = $(CONTIKI)/tools/z1/z1-bsl-nopic --z1
|
||||
MOTELIST = $(CONTIKI)/tools/zolertia/motelist-zolertia-macos
|
||||
BSL = $(CONTIKI)/tools/zolertia/z1-bsl-nopic --z1
|
||||
BSL_FILETYPE = -I
|
||||
MOTES = $(shell $(MOTELIST) -c 2>&- | \
|
||||
MOTES = $(shell $(MOTELIST) -b z1 -c 2>&- | \
|
||||
cut -f 2 -d ,)
|
||||
CMOTES=$(MOTES)
|
||||
REFNUM = $(shell $(MOTELIST) -c 2>&- | \
|
||||
cut -f 1 -d , | tail -c5 | sed 's/^0*//')
|
||||
ifneq (,$(REFNUM))
|
||||
@ -77,10 +76,10 @@ else
|
||||
ifndef MOTELIST
|
||||
USBDEVPREFIX=
|
||||
SERIALDUMP = $(CONTIKI)/tools/sky/serialdump-linux
|
||||
MOTELIST = $(CONTIKI)/tools/z1/motelist-z1
|
||||
BSL = $(CONTIKI)/tools/z1/z1-bsl-nopic --z1
|
||||
MOTELIST = $(CONTIKI)/tools/zolertia/motelist-zolertia
|
||||
BSL = $(CONTIKI)/tools/zolertia/z1-bsl-nopic --z1
|
||||
BSL_FILETYPE = -I
|
||||
MOTES = $(shell $(MOTELIST) -c 2>&- | \
|
||||
MOTES = $(shell $(MOTELIST) -b z1 -c 2>&- | \
|
||||
cut -f 2 -d , | \
|
||||
perl -ne 'print $$1 . " " if(m-(/dev/\w+)-);')
|
||||
CMOTES=$(MOTES)
|
||||
@ -95,12 +94,10 @@ else
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
|
||||
motelist: z1-motelist
|
||||
|
||||
z1-motelist:
|
||||
motelist:
|
||||
$(MOTELIST)
|
||||
z1-motelist:
|
||||
$(MOTELIST) -b z1
|
||||
z1-motes:
|
||||
@echo $(MOTES)
|
||||
|
||||
|
98
platform/zoul/Makefile.zoul
Normal file
98
platform/zoul/Makefile.zoul
Normal file
@ -0,0 +1,98 @@
|
||||
### Zoul Makefile
|
||||
|
||||
ifndef CONTIKI
|
||||
$(error CONTIKI not defined! You must specify where CONTIKI resides!)
|
||||
endif
|
||||
|
||||
### If no board is specified the default option is the RE-Mote
|
||||
ifeq ($(BOARD),)
|
||||
BOARD=remote
|
||||
endif
|
||||
|
||||
PYTHON = python
|
||||
BSL_FLAGS += -e -w -v
|
||||
|
||||
ifdef PORT
|
||||
BSL_FLAGS += -p $(PORT)
|
||||
endif
|
||||
|
||||
### Configure the build for the board and pull in board-specific sources
|
||||
CONTIKI_TARGET_DIRS += . dev
|
||||
CONTIKI_TARGET_DIRS += . $(BOARD)
|
||||
PLATFORM_ROOT_DIR = $(CONTIKI)/platform/$(TARGET)
|
||||
|
||||
### Include the board dir if one exists
|
||||
-include $(PLATFORM_ROOT_DIR)/$(BOARD)/Makefile.$(BOARD)
|
||||
|
||||
### Include
|
||||
CONTIKI_TARGET_SOURCEFILES += contiki-main.c
|
||||
CONTIKI_TARGET_SOURCEFILES += leds.c leds-arch.c cc1200-zoul-arch.c
|
||||
CONTIKI_TARGET_SOURCEFILES += adc-sensors.c button-sensor.c zoul-sensors.c
|
||||
CONTIKI_TARGET_SOURCEFILES += $(BOARD_SOURCEFILES)
|
||||
|
||||
CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES)
|
||||
|
||||
CLEAN += *.zoul
|
||||
|
||||
### Unless the example dictates otherwise, build with code size optimisations
|
||||
ifndef SMALL
|
||||
SMALL = 1
|
||||
endif
|
||||
|
||||
### Define the CPU directory
|
||||
CONTIKI_CPU=$(CONTIKI)/cpu/cc2538
|
||||
include $(CONTIKI_CPU)/Makefile.cc2538
|
||||
|
||||
MODULES += core/net core/net/mac \
|
||||
core/net/mac/contikimac \
|
||||
core/net/llsec dev/cc1200
|
||||
|
||||
BSL = $(CONTIKI)/tools/cc2538-bsl/cc2538-bsl.py
|
||||
|
||||
### USe the specific Zoul subplatform to query for connected devices
|
||||
ifdef MOTELIST_ZOLERTIA
|
||||
MOTELIST_FLAGS += -b $(MOTELIST_ZOLERTIA)
|
||||
endif
|
||||
|
||||
### Detect if a mote is connected over serial port
|
||||
ifeq ($(HOST_OS),Darwin)
|
||||
USBDEVPREFIX=
|
||||
MOTELIST = $(CONTIKI)/tools/zolertia/motelist-zolertia-macos
|
||||
MOTES = $(shell $(MOTELIST) -c 2>&- | cut -f 2 -d ,)
|
||||
else
|
||||
### If we are not running under Mac, we assume Linux
|
||||
USBDEVPREFIX=
|
||||
SERIALDUMP = $(CONTIKI)/tools/sky/serialdump-linux
|
||||
MOTELIST = $(CONTIKI)/tools/zolertia/motelist-zolertia
|
||||
MOTES = $(shell $(MOTELIST) -b $(MOTELIST_ZOLERTIA) -c 2>&- | cut -f 2 -d , | \
|
||||
perl -ne 'print $$1 . " " if(m-(/dev/\w+)-);')
|
||||
endif
|
||||
|
||||
|
||||
+%.upload: %.bin %.elf
|
||||
ifeq ($(wildcard $(BSL)), )
|
||||
@echo "ERROR: Could not find the cc2538-bsl script. Did you run 'git submodule update --init' ?"
|
||||
else
|
||||
$(PYTHON) $(BSL) $(BSL_FLAGS) -a $$($(OBJDUMP) -h $*.elf | sed -n '/\<LOAD\>/{g;1!p;};h' | awk '{print "0x" $$5}' | sort -g | head -1)
|
||||
endif
|
||||
|
||||
motelist:
|
||||
$(MOTELIST)
|
||||
zoul-motelist:
|
||||
$(MOTELIST) $(MOTELIST_FLAGS)
|
||||
zoul-motes:
|
||||
@echo $(MOTES)
|
||||
|
||||
ifdef PORT
|
||||
serialview:
|
||||
$(SERIALDUMP) -b115200 $(USBDEVPREFIX) $(PORT) | $(CONTIKI)/tools/timestamp
|
||||
|
||||
login:
|
||||
$(SERIALDUMP) -b115200 $(USBDEVPREFIX) $(PORT)
|
||||
else
|
||||
serialview:
|
||||
$(SERIALDUMP) -b115200 $(USBDEVPREFIX)$(firstword $(MOTES)) | $(CONTIKI)/tools/timestamp
|
||||
|
||||
login:
|
||||
$(SERIALDUMP) -b115200 $(USBDEVPREFIX)$(firstword $(MOTES))
|
||||
endif
|
@ -1,41 +1,48 @@
|
||||
Zolertia Re-Mote platform
|
||||
Zolertia Zoul core module
|
||||
============================================
|
||||
|
||||
<a href="url"><img src="http://goo.gl/3AGZkI" align="center" height="320" ></a>
|
||||
![Zolertia Zoul Module][zoul]
|
||||
|
||||
The Re-Mote platform is a IoT Hardware development platform based on TI's CC2538
|
||||
system on chip (SoC), featuring an ARM Cortex-M3 with 512KB flash, 32Kb RAM,
|
||||
double RF interface, and the following goodies:
|
||||
The Zoul is a core module developed by Zolertia to target most IoT applications,
|
||||
providing a flexible and affordable module solution to integrate to most
|
||||
existing products and solutions, or ease the prototyping and production of new
|
||||
products in a short time.
|
||||
|
||||
The Zoul is based on TI's CC2538 system on chip (SoC), featuring an ARM
|
||||
Cortex-M3 with 512KB flash, 32Kb RAM, double RF interface, and the following
|
||||
goodies:
|
||||
|
||||
* ISM 2.4-GHz IEEE 802.15.4 & Zigbee compliant.
|
||||
* ISM 868-, 915-, 920-, 950-MHz ISM/SRD Band.
|
||||
* AES-128/256, SHA2 Hardware Encryption Engine.
|
||||
* ECC-128/256, RSA Hardware Acceleration Engine for Secure Key Exchange.
|
||||
* Power consumption down to 3uA using our shutdown mode.
|
||||
* Co-Processor to allow peripheral management, programming over BSL without requiring to press any button to enter bootloader mode.
|
||||
* Built-in battery charger (500mA), Energy Harvesting and Solar Panels to be connected to standards LiPo batteries.
|
||||
* Power input with wide range 2-26VDC.
|
||||
* Built-in TMP102 temperature sensor
|
||||
* Small form-factor (as the Z1 mote, half the size of an Arduino) 57x35 mm.
|
||||
* Small form-factor of 16.78 x 30.89 mm.
|
||||
* Prototype friendly, to fit on most prototyping boards (breadboard, etc.).
|
||||
* Self-contained and EMI-protected module under a shield.
|
||||
|
||||
The Zoul will be CE/FCC certified (2016) to allow a fast integration and short time to market for new products and solutions.
|
||||
|
||||
Zoul pin-out
|
||||
=============
|
||||
|
||||
![Zoul pin-out (front)][zoul-pinout-front]
|
||||
![Zoul pin-out (back)][zoul-pinout-back]
|
||||
|
||||
Port Features
|
||||
=============
|
||||
The platform has the following key features:
|
||||
The Zoul has the following key features:
|
||||
|
||||
* Deep Sleep support with RAM retention for ultra-low energy consumption.
|
||||
* Native USB support (CDC-ACM). SLIP over UART for border routers is no longer a bottleneck.
|
||||
* DMA transfers for increased performance (RAM to/from RF, RAM to/from USB).
|
||||
* Shutdown mode controlled externally by the Co-processor, completely power the
|
||||
platform OFF, further reducing current consumption.
|
||||
|
||||
In terms of hardware support, the following drivers have been implemented:
|
||||
In terms of hardware support, the following drivers have been implemented for the Zoul-based platforms:
|
||||
|
||||
* CC2538 System-on-Chip:
|
||||
* Standard Cortex M3 peripherals (NVIC, SCB, SysTick)
|
||||
* Sleep Timer (underpins rtimers)
|
||||
* SysTick (underpins the platform clock and Contiki's timers infrastructure)
|
||||
* RF
|
||||
* RF (2.4GHz)
|
||||
* UART
|
||||
* Watchdog (in watchdog mode)
|
||||
* USB (in CDC-ACM)
|
||||
@ -49,26 +56,22 @@ In terms of hardware support, the following drivers have been implemented:
|
||||
* Flash-based port of Coffee
|
||||
* LEDs
|
||||
* Buttons
|
||||
* Internal/external 2.4GHz antenna switch controllable by SW.
|
||||
* Built-in core temperature and battery sensor.
|
||||
* TMP102 temperature sensor driver.
|
||||
* CC1120 sub-1GHz radio interface:
|
||||
* Ported in Contiki, SPI based.
|
||||
* Micro-SD external storage:
|
||||
* Pending to port, SPI based.
|
||||
* CC1200 sub-1GHz radio interface.
|
||||
|
||||
There is a Zoul powering the RE-Mote and Firefly platforms, check out its specific README files for more information about on-board features.
|
||||
|
||||
Requirements
|
||||
============
|
||||
To start using Contiki, the following is required:
|
||||
|
||||
* A zoul-based board (RE-Mote, firefly)
|
||||
* A toolchain to compile Contiki for the CC2538.
|
||||
* Drivers so that your OS can communicate with your hardware.
|
||||
* Software to upload images to the CC2538.
|
||||
|
||||
|
||||
Install a Toolchain
|
||||
-------------------
|
||||
Forked from `platform/cc2538dk/README.md`.
|
||||
The toolchain used to build contiki is arm-gcc, also used by other arm-based Contiki ports. If you are using Instant Contiki, you will have a version pre-installed in your system. To find out if this is the case, try this:
|
||||
|
||||
$ arm-none-eabi-gcc -v
|
||||
@ -88,47 +91,25 @@ The platform is currently being used/tested with the following toolchains:
|
||||
|
||||
Drivers
|
||||
-------
|
||||
The Re-Mote features a FTDI serial-to-USB module, the driver is commonly found in most OS, but if required it can be downloaded
|
||||
from <http://www.ftdichip.com/Drivers/VCP.htm>
|
||||
|
||||
Depending on your Zoul flavour, there are different options. As today the RE-Mote and Firefly platforms host a Zoul with a CP2104 USB-to-serial converter, governed by a low-power PIC to handle resetting and flashing the Zoul over USB, without having to press any button or use external tools.
|
||||
|
||||
### For the CC2538EM (USB CDC-ACM)
|
||||
The Re-Mote has built-in support for USB 2.0 USB, Vendor and Product IDs are the following:
|
||||
The driver is available at <https://www.silabs.com/products/mcu/Pages/USBtoUARTBridgeVCPDrivers.aspx>
|
||||
|
||||
* VID 0x0451
|
||||
* PID 0x16C8
|
||||
Check the board's specific README files for more information.
|
||||
|
||||
The implementation in Contiki is pure CDC-ACM: The Linux and OS X kernels know exactly what to do and drivers are not required.
|
||||
For windows users, if using the USB 2.0 interface (via CDC-ACM driver), there is an available driver in this folder:
|
||||
|
||||
On windows, you will need to provide a driver:
|
||||
|
||||
* Download this LUFA CDC-ACM driver:
|
||||
<https://github.com/abcminiuser/lufa/blob/master/Demos/Device/LowLevel/VirtualSerial/LUFA%20VirtualSerial.inf>
|
||||
* Adjust the VID and PID near the end with the values at the start of this section.
|
||||
* Next time you get prompted for the driver, include the directory containing the .inf file in the search path and the driver will be installed.
|
||||
|
||||
### Device Enumerations
|
||||
For the UART, serial line settings are 115200 8N1, no flow control.
|
||||
|
||||
Once all drivers have been installed correctly:
|
||||
|
||||
On windows, devices will appear as a virtual COM port.
|
||||
|
||||
On Linux and OS X, devices will appear under `/dev/`.
|
||||
|
||||
On OS X:
|
||||
|
||||
* XDS backchannel: `tty.usbserial-<serial number>`
|
||||
* EM in CDC-ACM: `tty.usbmodemf<X><ABC>` (X a letter, ABC a number e.g. `tty.usbmodemfd121`)
|
||||
|
||||
On Linux:
|
||||
|
||||
* Re-Mote over FTDI: `ttyUSB1`
|
||||
* Re-Mote over USB driver (in CDC-ACM): `ttyACMn` (n=0, 1, ....)
|
||||
`zolertia-zoul-cdc-acm`
|
||||
|
||||
Software to Program the Nodes
|
||||
-----------------------------
|
||||
The Re-Mote can be programmed via the jtag interface or via the serial boot loader on the chip.
|
||||
The Zoul can be programmed via the jtag interface or via the serial boot loader on the chip.
|
||||
|
||||
Both the RE-Mote and Firefly has a mini JTAG 10-pin male header, compatible with the `SmartRF06` development board, which can be used to flash and debug the platforms. Alternatively one could use the `JLink` programmer with a 20-to-10 pin converter like the following: <https://www.olimex.com/Products/ARM/JTAG/ARM-JTAG-20-10/>.
|
||||
|
||||
The serial boot loader on the chip is exposed to the user via an USB interface. In the not so distant past we used to press a button sequence to unlock the boot loader, but now an on-board PIC in both RE-Motes and Fireflies handles this on its own, so it will detect the BSL sequence and flash the CC2538 without user intervention.
|
||||
|
||||
Instructions to flash for different OS are given below.
|
||||
|
||||
* On Windows:
|
||||
* Nodes can be programmed with TI's ArmProgConsole or the [SmartRF Flash Programmer 2][smart-rf-flashprog]. The README should be self-explanatory. With ArmProgConsole, upload the file with a `.bin` extension. (jtag + serial)
|
||||
@ -141,7 +122,7 @@ The Re-Mote can be programmed via the jtag interface or via the serial boot load
|
||||
* On OSX:
|
||||
* The `cc2538-bsl.py` script in `tools/cc2538-bsl/` is the only option. No extra software needs to be installed. (serial)
|
||||
|
||||
The file with a `.remote` extension is a copy of the `.elf` file.
|
||||
The file with a `.zoul` extension is a copy of the `.elf` file.
|
||||
|
||||
Use the Port
|
||||
============
|
||||
@ -155,24 +136,29 @@ The following examples are intended to work off-the-shelf:
|
||||
|
||||
Build your First Examples
|
||||
-------------------------
|
||||
It is recommended to start with the `remote-demo`, it is a simple example that walkthroughs the platform features, such as
|
||||
the built-in sensors, LEDs, user button operation modes (press, release, hold-press), radio (Rime broadcast).
|
||||
It is recommended to start with the `zoul-demo`, it is a simple example that walkthroughs the zoul features (can be compiled for both the RE-Mote and the Firefly), such as the built-in sensors, LEDs, user button operation modes (press, release, hold-press), radio (Rime broadcast).
|
||||
|
||||
The `Makefile.target` includes the `TARGET=` argument, predefining which is the target platform to compile for, it is automatically included at compilation. To generate or override an existing one, you can run:
|
||||
The `Makefile.target` includes the `TARGET=` argument, predefining which is the target platform to compile for, it is automatically included at compilation. The `BOARD=` argument is using as a glue switch to pull in specific platform files, for example the specific RE-Mote core drivers. If no `BOARD` argument is given, it will default to `remote` and compile for the RE-Mote platform.
|
||||
|
||||
`make TARGET=remote savetarget`
|
||||
To generate or override an existing one, you can run:
|
||||
|
||||
Then you can just run `make` to compile an application, otherwise you will need to do `make TARGET=remote`.
|
||||
`make TARGET=zoul savetarget`
|
||||
|
||||
Then you can just run `make` to compile an application, otherwise you will need to do `make TARGET=zoul`.
|
||||
|
||||
Alternatively you can export the following to your work environment:
|
||||
|
||||
`export BOARD=remote` or `export BOARD=firefly`
|
||||
|
||||
This will avoid having to type this argument at each compilation.
|
||||
|
||||
If you want to upload the compiled firmware to a node via the serial boot loader you need first to either manually enable the boot loader, or just let the Co-Processor detect the flash sequence and do it on your behalf, as simple as not pressing anything at all!
|
||||
|
||||
Then use `make remote-demo.upload PORT=/dev/ttyUSB1`.
|
||||
Then use `make zoul-demo.upload`.
|
||||
|
||||
The `PORT` argument is used to specify in which port the device is connected, as we are currently using a dual-channel FTDI chip, at the moment the programming channel is always assigned to the second FTDI channel, so the FTDI will enumerate as `/dev/ttyUSB0`, `/dev/ttyUSB1`, and we would need to use the later one and specify when flashing using the `cc2538-bsl` script, as it will use the first port found by default. This will be improved in the next release.
|
||||
The `PORT` argument could be used to specify in which port the device is connected, in case we have multiple devices connected at the same time.
|
||||
|
||||
To manually enable the boot loader, press the `reset` button on the board while holding the `user` button. (The boot loader backdoor needs to be enabled on the chip for this to work, see README in the `tools/cc2538-bsl` directory for more info)
|
||||
|
||||
To generate an assembly listing of the compiled firmware, run `make remote-demo.lst`. This may be useful for debugging or optimizing your application code. To intersperse the C source code within the assembly listing, you must instruct the compiler to include debugging information by adding `CFLAGS += -g` to the project Makefile and rebuild by running `make clean remote-demo.lst`.
|
||||
To generate an assembly listing of the compiled firmware, run `make zoul-demo.lst`. This may be useful for debugging or optimizing your application code. To intersperse the C source code within the assembly listing, you must instruct the compiler to include debugging information by adding `CFLAGS += -g` to the project Makefile and rebuild by running `make clean zoul-demo.lst`.
|
||||
|
||||
Node IEEE/RIME/IPv6 Addresses
|
||||
-----------------------------
|
||||
@ -194,16 +180,12 @@ This will result in the 2 last bytes of the IEEE address getting set to 0x79 0xA
|
||||
|
||||
Note: Some early production devices do not have am IEEE address written on the Info Page. For those devices, using value 0 above will result in a Rime address of all 0xFFs. If your device is in this category, define `IEEE_ADDR_CONF_HARDCODED` to 1 and specify `NODEID` to differentiate between devices.
|
||||
|
||||
|
||||
|
||||
Low-Power Modes
|
||||
---------------
|
||||
The CC2538 port supports power modes for low energy consumption. The SoC will enter a low power mode as part of the main loop when there are no more events to service.
|
||||
|
||||
LPM support can be disabled in its entirety by setting `LPM_CONF_ENABLE` to 0 in `contiki-conf.h` or `project-conf.h`.
|
||||
|
||||
NOTE: If you are using PG2 version of the Evaluation Module, the SoC will refuse to enter Power Modes 1+ if the debugger is connected and will always enter PM0 regardless of configuration. In order to get real low power mode functionality, make sure the debugger is disconnected. The Battery Board is ideal to test this.
|
||||
|
||||
The Low-Power module uses a simple heuristic to determine the best power mode, depending on anticipated Deep Sleep duration and the state of various peripherals.
|
||||
|
||||
In a nutshell, the algorithm first answers the following questions:
|
||||
@ -233,7 +215,7 @@ LPM is highly related to the operations of the Radio Duty Cycling (RDC) driver o
|
||||
* When NullRDC is in use, the radio will be always on. As a result, the algorithm discussed above will always choose PM0 and will never attempt to drop to PM1/2.
|
||||
|
||||
### Shutdown Mode
|
||||
The Re-Mote allows to further reduce power consumption by shutting down entirely all the components but the Co-Processor, powering completely of the CC2538 and CC1120 even preventing quiescent current from being drawn, allowing the platform to awake after a given period governed by the Co-Processor and the built-in battery management IC. This effectively reduces the power consumption down to 3-4uA.
|
||||
The RE-Mote has a built-in shutdown mode which effectively reduces the power consumption down to 300nA. Check its specific README file for more information.
|
||||
|
||||
Build headless nodes
|
||||
--------------------
|
||||
@ -259,7 +241,7 @@ This port's code has been documented with doxygen. To build the documentation, n
|
||||
|
||||
If you want to build this platform's documentation only and skip the remaining platforms, run this:
|
||||