Updated RE-Mote revision A support and cleaning up Zolertia platforms
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
@ -0,0 +1 @@
|
||||
TARGET = zoul
|
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
@ -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
@ -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:
|
||||
|
||||
make basedirs="platform/remote core cpu/cc2538 examples/remote examples/cc2538dk"
|
||||
make basedirs="platform/zoul core cpu/cc2538 examples/remote examples/cc2538dk"
|
||||
|
||||
Once you've built the docs, open `$(CONTIKI)/doc/html/index.html` and enjoy.
|
||||
|
||||
@ -272,14 +254,19 @@ If you prefer this guide in other formats, use the excellent [pandoc] to convert
|
||||
|
||||
More Reading
|
||||
============
|
||||
1. [Zolertia Re-Mote website][remote-site]
|
||||
2. [CC2538 System-on-Chip Solution for 2.4-GHz IEEE 802.15.4 and ZigBee®/ZigBee IP® Applications, (SWRU319B)][cc2538]
|
||||
3. [CC1120 sub-1GHz RF transceiver][cc1120]
|
||||
1. [Zolertia website][zolertia-site]
|
||||
2. [CC2538 System-on-Chip Solution][cc2538]
|
||||
3. [CC1200 sub-1GHz RF transceiver][cc1200]
|
||||
4. [Zolertia Hackster channel][hackster]
|
||||
|
||||
[remote-site]: http://www.zolertia.io/products "Zolertia Re-Mote"
|
||||
[cc1120]: http://www.ti.com/cc1120 "CC1120"
|
||||
[zolertia-site]: http://www.zolertia.io/products "Zolertia"
|
||||
[cc1200]: http://www.ti.com/product/cc1200 "CC1200"
|
||||
[smart-rf-studio]: http://www.ti.com/tool/smartrftm-studio "SmartRF Studio"
|
||||
[smart-rf-flashprog]: http://www.ti.com/tool/flash-programmer "SmartRF Flash Programmer"
|
||||
[cc2538]: http://www.ti.com/product/cc2538 "CC2538"
|
||||
[uniflash]: http://processors.wiki.ti.com/index.php/Category:CCS_UniFlash "UniFlash"
|
||||
[pandoc]: http://johnmacfarlane.net/pandoc/ "Pandoc - a universal document converter"
|
||||
[hackster]: https://www.hackster.io/zolertia "Zolertia Hackster Channel"
|
||||
[zoul]: images/zoul-front.png "Zolertia Zoul Module"
|
||||
[zoul-pinout-front]: images/zoul-pinout-front.png "Zoul pin-out (front)"
|
||||
[zoul-pinout-back]: images/zoul-pinout-back.png "Zoul pin-out (back)"
|
@ -1,9 +1,46 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Zolertia - http://www.zolertia.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
|
||||
* \addtogroup zoul
|
||||
* @{
|
||||
*
|
||||
* \defgroup zoul-platforms Zolertia platforms based on the Zoul core module
|
||||
*
|
||||
* The Zoul allows a fast reuse and easy integration to most applications and
|
||||
* products. Its small size and module format eases to place in different PCB
|
||||
* designs and to integrate in existing products. The Zoul-based platforms
|
||||
* share most of the Zoul core implementation.
|
||||
*
|
||||
* \file
|
||||
* Configuration for the Re-Mote platform
|
||||
* Configuration for the Zoul-based platforms
|
||||
*/
|
||||
#ifndef CONTIKI_CONF_H_
|
||||
#define CONTIKI_CONF_H_
|
||||
@ -57,6 +94,15 @@ typedef uint32_t rtimer_clock_t;
|
||||
#define FLASH_CCA_CONF_BOOTLDR_BACKDOOR_ACTIVE_HIGH 0 /**< A logic low level activates the boot loader */
|
||||
#endif
|
||||
/** @} */
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \name CFS configuration
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
#define COFFEE_CONF_SIZE 0x78000
|
||||
/** @} */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \name Watchdog Timer configuration
|
||||
@ -308,11 +354,29 @@ typedef uint32_t rtimer_clock_t;
|
||||
#endif /* NETSTACK_CONF_WITH_IPV6 */
|
||||
#endif /* NETSTACK_CONF_FRAMER */
|
||||
|
||||
/* This can be overriden to use the cc1120_driver instead */
|
||||
/* This can be overriden to use the cc1200_driver instead */
|
||||
#ifndef NETSTACK_CONF_RADIO
|
||||
#define NETSTACK_CONF_RADIO cc2538_rf_driver
|
||||
#define NETSTACK_CONF_RADIO cc2538_rf_driver
|
||||
#endif
|
||||
|
||||
/*
|
||||
* RE-Mote specific:
|
||||
* If dual RF enabled, we set the RF switch to enable the CC1200 and use 2.4GHz
|
||||
* on the available uFl/chip antenna (not mounted as default). In contiki main
|
||||
* platform routine we set the right antenna depending on NETSTACK_CONF_RADIO,
|
||||
* but as changing the RF antenna also implies enabling/disabling the CC1200,
|
||||
* is better to start off with the right configuration
|
||||
*/
|
||||
#if REMOTE_DUAL_RF_ENABLED
|
||||
#define ANTENNA_SW_SELECT_DEFAULT ANTENNA_SW_SELECT_SUBGHZ
|
||||
#else /* REMOTE_DUAL_RF_ENABLED */
|
||||
#ifndef ANTENNA_SW_SELECT_DEF_CONF
|
||||
#define ANTENNA_SW_SELECT_DEFAULT ANTENNA_SW_SELECT_2_4GHZ
|
||||
#else /* ANTENNA_SW_SELECT_DEF_CONF */
|
||||
#define ANTENNA_SW_SELECT_DEFAULT ANTENNA_SW_SELECT_DEF_CONF
|
||||
#endif /* ANTENNA_SW_SELECT_DEF_CONF */
|
||||
#endif /* REMOTE_DUAL_RF_ENABLED */
|
||||
|
||||
/** @} */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
@ -383,7 +447,7 @@ typedef uint32_t rtimer_clock_t;
|
||||
#endif
|
||||
|
||||
#ifndef CC2538_RF_CONF_CHANNEL
|
||||
#define CC2538_RF_CONF_CHANNEL 25
|
||||
#define CC2538_RF_CONF_CHANNEL 26
|
||||
#endif /* CC2538_RF_CONF_CHANNEL */
|
||||
|
||||
#ifndef CC2538_RF_CONF_AUTOACK
|
@ -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
|
||||
@ -32,14 +33,15 @@
|
||||
* \addtogroup platform
|
||||
* @{
|
||||
*
|
||||
* \defgroup remote Zolertia Re-Mote platform
|
||||
* \defgroup zoul Zolertia Zoul core module
|
||||
*
|
||||
* The Re-Mote is the new platform by Zolertia based on the cc2538, featuring a
|
||||
* cc2538 SoC with an ARM Cortex-M3 core plus the CC1120 Sub-1Ghz transceiver
|
||||
* The Zoul comprises the CC2538SF53 and CC1200 in a single module
|
||||
* format, which allows a fast reuse of its core components in different
|
||||
* formats and form-factors.
|
||||
* @{
|
||||
*
|
||||
* \file
|
||||
* Main module for the Re-Mote platform
|
||||
* Main module for the Zolertia Zoul core and based platforms
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#include "contiki.h"
|
||||
@ -66,7 +68,6 @@
|
||||
#include "reg.h"
|
||||
#include "ieee-addr.h"
|
||||
#include "lpm.h"
|
||||
#include "dev/antenna-sw.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
@ -84,6 +85,9 @@
|
||||
#define PUTS(s)
|
||||
#endif
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** \brief Board specific iniatialisation */
|
||||
void board_init(void);
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
fade(unsigned char l)
|
||||
{
|
||||
@ -135,7 +139,7 @@ set_rf_params(void)
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \brief Main routine for the Re-Mote platform
|
||||
* \brief Main routine for the Zoul-based platforms
|
||||
*/
|
||||
int
|
||||
main(void)
|
||||
@ -147,14 +151,10 @@ main(void)
|
||||
lpm_init();
|
||||
rtimer_init();
|
||||
gpio_init();
|
||||
|
||||
leds_init();
|
||||
fade(LEDS_RED);
|
||||
|
||||
process_init();
|
||||
|
||||
watchdog_init();
|
||||
SENSORS_ACTIVATE(button_sensor);
|
||||
|
||||
/*
|
||||
* Character I/O Initialisation.
|
||||
@ -185,13 +185,6 @@ main(void)
|
||||
PUTS(CONTIKI_VERSION_STRING);
|
||||
PUTS(BOARD_STRING);
|
||||
|
||||
PRINTF(" Net: ");
|
||||
PRINTF("%s\n", NETSTACK_NETWORK.name);
|
||||
PRINTF(" MAC: ");
|
||||
PRINTF("%s\n", NETSTACK_MAC.name);
|
||||
PRINTF(" RDC: ");
|
||||
PRINTF("%s\n", NETSTACK_RDC.name);
|
||||
|
||||
/* Initialise the H/W RNG engine. */
|
||||
random_init(0);
|
||||
|
||||
@ -200,8 +193,17 @@ main(void)
|
||||
process_start(&etimer_process, NULL);
|
||||
ctimer_init();
|
||||
|
||||
set_rf_params();
|
||||
board_init();
|
||||
|
||||
netstack_init();
|
||||
set_rf_params();
|
||||
|
||||
PRINTF(" Net: ");
|
||||
PRINTF("%s\n", NETSTACK_NETWORK.name);
|
||||
PRINTF(" MAC: ");
|
||||
PRINTF("%s\n", NETSTACK_MAC.name);
|
||||
PRINTF(" RDC: ");
|
||||
PRINTF("%s\n", NETSTACK_RDC.name);
|
||||
|
||||
#if NETSTACK_CONF_WITH_IPV6
|
||||
memcpy(&uip_lladdr.addr, &linkaddr_node_addr, sizeof(uip_lladdr.addr));
|
||||
@ -209,8 +211,6 @@ main(void)
|
||||
process_start(&tcpip_process, NULL);
|
||||
#endif /* NETSTACK_CONF_WITH_IPV6 */
|
||||
|
||||
antenna_sw_config();
|
||||
|
||||
process_start(&sensors_process, NULL);
|
||||
|
||||
SENSORS_ACTIVATE(button_sensor);
|
@ -31,11 +31,11 @@
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \addtogroup remote-phidget-sensor
|
||||
* \addtogroup zoul-adc-sensors
|
||||
* @{
|
||||
*
|
||||
* \file
|
||||
* Generic driver for the Re-Mote Phidget/ADC sensors
|
||||
* Generic driver for the Zoul ADC sensors
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#include "contiki.h"
|
||||
@ -43,16 +43,13 @@
|
||||
#include "dev/ioc.h"
|
||||
#include "dev/gpio.h"
|
||||
#include "dev/adc.h"
|
||||
#include "dev/phidget-sensor.h"
|
||||
#include "dev/remote-sensors.h"
|
||||
#include "adc-sensors.h"
|
||||
#include "zoul-sensors.h"
|
||||
|
||||
#include <stdint.h>
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#define ADC_PHIDGET_PORT_BASE GPIO_PORT_TO_BASE(ADC_PHIDGET_PORT)
|
||||
#define ADC_PHIDGET_ADC2_PIN_MASK GPIO_PIN_MASK(ADC_PHIDGET_ADC2_PIN)
|
||||
#define ADC_PHIDGET_ADC3_PIN_MASK GPIO_PIN_MASK(ADC_PHIDGET_ADC3_PIN)
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static uint8_t decimation_rate;
|
||||
static uint8_t enabled_channels;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static int
|
||||
set_decimation_rate(uint8_t rate)
|
||||
@ -65,31 +62,44 @@ set_decimation_rate(uint8_t rate)
|
||||
decimation_rate = rate;
|
||||
break;
|
||||
default:
|
||||
return REMOTE_SENSORS_ERROR;
|
||||
return ZOUL_SENSORS_ERROR;
|
||||
}
|
||||
|
||||
return decimation_rate;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static int
|
||||
get_channel_pin(int type)
|
||||
{
|
||||
if((ZOUL_SENSORS_ADC1) && (type == ZOUL_SENSORS_ADC1)) {
|
||||
return SOC_ADC_ADCCON_CH_AIN0 + ADC_SENSORS_ADC1_PIN;
|
||||
}
|
||||
if((ZOUL_SENSORS_ADC2) && (type == ZOUL_SENSORS_ADC2)) {
|
||||
return SOC_ADC_ADCCON_CH_AIN0 + ADC_SENSORS_ADC2_PIN;
|
||||
}
|
||||
if((ZOUL_SENSORS_ADC3) && (type == ZOUL_SENSORS_ADC3)) {
|
||||
return SOC_ADC_ADCCON_CH_AIN0 + ADC_SENSORS_ADC3_PIN;
|
||||
}
|
||||
return ZOUL_SENSORS_ERROR;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static int
|
||||
value(int type)
|
||||
{
|
||||
uint8_t channel;
|
||||
int channel;
|
||||
int16_t res;
|
||||
|
||||
switch(type) {
|
||||
case PHIDGET_SENSORS_ADC2:
|
||||
channel = SOC_ADC_ADCCON_CH_AIN0 + ADC_PHIDGET_ADC2_PIN;
|
||||
break;
|
||||
case PHIDGET_SENSORS_ADC3:
|
||||
channel = SOC_ADC_ADCCON_CH_AIN0 + ADC_PHIDGET_ADC3_PIN;
|
||||
break;
|
||||
default:
|
||||
return REMOTE_SENSORS_ERROR;
|
||||
if(!(type & enabled_channels)) {
|
||||
return ZOUL_SENSORS_ERROR;
|
||||
}
|
||||
|
||||
res = adc_get(channel, SOC_ADC_ADCCON_REF_INT, decimation_rate);
|
||||
channel = get_channel_pin(type);
|
||||
|
||||
if(channel == ZOUL_SENSORS_ERROR) {
|
||||
return ZOUL_SENSORS_ERROR;
|
||||
}
|
||||
|
||||
res = adc_get(channel, SOC_ADC_ADCCON_REF_AVDD5, decimation_rate);
|
||||
return res;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
@ -98,18 +108,40 @@ configure(int type, int value)
|
||||
{
|
||||
switch(type) {
|
||||
case SENSORS_HW_INIT:
|
||||
GPIO_SOFTWARE_CONTROL(GPIO_A_BASE, ADC_PHIDGET_ADC2_PIN_MASK);
|
||||
GPIO_SET_INPUT(GPIO_A_BASE, ADC_PHIDGET_ADC2_PIN_MASK);
|
||||
ioc_set_over(GPIO_A_NUM, ADC_PHIDGET_ADC2_PIN, IOC_OVERRIDE_ANA);
|
||||
|
||||
GPIO_SOFTWARE_CONTROL(GPIO_A_BASE, ADC_PHIDGET_ADC3_PIN_MASK);
|
||||
GPIO_SET_INPUT(GPIO_A_BASE, ADC_PHIDGET_ADC3_PIN_MASK);
|
||||
ioc_set_over(GPIO_A_NUM, ADC_PHIDGET_ADC3_PIN, IOC_OVERRIDE_ANA);
|
||||
/* This should filter out disabled sensors as its value should be zero */
|
||||
if((value < ZOUL_SENSORS_ADC_MIN) || (value > ZOUL_SENSORS_ADC_ALL)) {
|
||||
return ZOUL_SENSORS_ERROR;
|
||||
}
|
||||
|
||||
if((value != ZOUL_SENSORS_ADC1) && (value != ZOUL_SENSORS_ADC2) &&
|
||||
(value != ZOUL_SENSORS_ADC3) && (value != ZOUL_SENSORS_ADC12) &&
|
||||
(value != ZOUL_SENSORS_ADC13) && (value != ZOUL_SENSORS_ADC23)) {
|
||||
return ZOUL_SENSORS_ERROR;
|
||||
}
|
||||
|
||||
GPIO_SOFTWARE_CONTROL(GPIO_A_BASE, value);
|
||||
GPIO_SET_INPUT(GPIO_A_BASE, value);
|
||||
|
||||
if(value & ZOUL_SENSORS_ADC1) {
|
||||
ioc_set_over(GPIO_A_NUM, ADC_SENSORS_ADC1_PIN, IOC_OVERRIDE_ANA);
|
||||
}
|
||||
if(value & ZOUL_SENSORS_ADC2) {
|
||||
ioc_set_over(GPIO_A_NUM, ADC_SENSORS_ADC2_PIN, IOC_OVERRIDE_ANA);
|
||||
}
|
||||
if(value & ZOUL_SENSORS_ADC3) {
|
||||
ioc_set_over(GPIO_A_NUM, ADC_SENSORS_ADC3_PIN, IOC_OVERRIDE_ANA);
|
||||
}
|
||||
adc_init();
|
||||
set_decimation_rate(SOC_ADC_ADCCON_DIV_512);
|
||||
enabled_channels = value;
|
||||
break;
|
||||
case REMOTE_SENSORS_CONFIGURE_TYPE_DECIMATION_RATE:
|
||||
|
||||
case ZOUL_SENSORS_CONFIGURE_TYPE_DECIMATION_RATE:
|
||||
return set_decimation_rate((uint8_t)value);
|
||||
|
||||
default:
|
||||
return ZOUL_SENSORS_ERROR;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -120,6 +152,7 @@ status(int type)
|
||||
return 1;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
SENSORS_SENSOR(phidget_sensor, PHIDGET_SENSOR, value, configure, status);
|
||||
SENSORS_SENSOR(adc_sensors, ADC_SENSORS, value, configure, status);
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @} */
|
||||
|
133
platform/zoul/dev/adc-sensors.h
Normal file
@ -0,0 +1,133 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Zolertia - http://www.zolertia.com
|
||||
* Copyright (c) 2015, University of Bristol - http://www.bristol.ac.uk
|
||||
* 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 zoul-sensors
|
||||
* @{
|
||||
*
|
||||
* \defgroup zoul-adc-sensors Zoul Generic ADC sensor
|
||||
*
|
||||
* Driver for the Zoul ADC sensors
|
||||
*
|
||||
* This driver supports analogue sensors connected to ADC1, ADC2 and AND3 inputs
|
||||
* This is controlled by the type argument of the value() function. Possible
|
||||
* choices are:
|
||||
* - ZOUL_SENSORS_ADC1
|
||||
* - ZOUL_SENSORS_ADC2
|
||||
* - ZOUL_SENSORS_ADC3
|
||||
*
|
||||
* To initialize the ADC sensors use the configure() function, using as first
|
||||
* argument SENSORS_HW_INIT, and choose which ADC channels to enable passing as
|
||||
* second argument any single or combined (sum) values as below:
|
||||
* - ZOUL_SENSORS_ADC1
|
||||
* - ZOUL_SENSORS_ADC2
|
||||
* - ZOUL_SENSORS_ADC3
|
||||
* - ZOUL_SENSORS_ADC_ALL (all channels above)
|
||||
*
|
||||
* Using an invalid combination will return ZOUL_SENSORS_ERROR.
|
||||
*
|
||||
* The decimation rate can be set by passing
|
||||
* ZOUL_SENSORS_CONFIGURE_TYPE_DECIMATION_RATE as the type argument to the
|
||||
* configure() function and then specifying the rate through the value
|
||||
* argument. Valid values are:
|
||||
* - SOC_ADC_ADCCON_DIV_64 (64 bit rate)
|
||||
* - SOC_ADC_ADCCON_DIV_128 (128 bit rate)
|
||||
* - SOC_ADC_ADCCON_DIV_256 (256 bit rate)
|
||||
* - SOC_ADC_ADCCON_DIV_512 (512 bit rate)
|
||||
* @{
|
||||
*
|
||||
* \file
|
||||
* Header file for the Zoul Generic Driver for ADC sensors
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#ifndef ADC_SENSORS_H_
|
||||
#define ADC_SENSORS_H_
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#include "lib/sensors.h"
|
||||
#include "dev/soc-adc.h"
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \name Generic ADC sensors
|
||||
* @{
|
||||
*/
|
||||
#define ADC_SENSORS "ADC sensors"
|
||||
#define ADC_SENSORS_PORT_BASE GPIO_PORT_TO_BASE(ADC_SENSORS_PORT)
|
||||
|
||||
/*
|
||||
* PA0-PA3 are hardcoded to UART0 and the user button for most Zolertia
|
||||
* platforms, the following assumes PA0 shall not be used as ADC input, else
|
||||
* re-write the below definitions
|
||||
*/
|
||||
#define ZOUL_SENSORS_ADC_MIN 4
|
||||
/* ADC phidget-like connector ADC1 */
|
||||
#if ADC_SENSORS_ADC1_PIN >= ZOUL_SENSORS_ADC_MIN
|
||||
#define ZOUL_SENSORS_ADC1 GPIO_PIN_MASK(ADC_SENSORS_ADC1_PIN)
|
||||
#else
|
||||
#define ZOUL_SENSORS_ADC1 0
|
||||
#endif
|
||||
/* ADC phidget-like connector ADC2 */
|
||||
#if ADC_SENSORS_ADC2_PIN >= ZOUL_SENSORS_ADC_MIN
|
||||
#define ZOUL_SENSORS_ADC2 GPIO_PIN_MASK(ADC_SENSORS_ADC2_PIN)
|
||||
#else
|
||||
#define ZOUL_SENSORS_ADC2 0
|
||||
#endif
|
||||
/* ADC phidget-like connector ADC3 */
|
||||
#if ADC_SENSORS_ADC3_PIN >= ZOUL_SENSORS_ADC_MIN
|
||||
#define ZOUL_SENSORS_ADC3 GPIO_PIN_MASK(ADC_SENSORS_ADC3_PIN)
|
||||
#else
|
||||
#define ZOUL_SENSORS_ADC3 0
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This is safe as the disabled sensors should have a zero value thus not
|
||||
* affecting the mask operations
|
||||
*/
|
||||
|
||||
/* Enable all channels */
|
||||
#define ZOUL_SENSORS_ADC_ALL (ZOUL_SENSORS_ADC1 + ZOUL_SENSORS_ADC2 + \
|
||||
ZOUL_SENSORS_ADC3)
|
||||
/* Other allowed combinations */
|
||||
#define ZOUL_SENSORS_ADC12 (ZOUL_SENSORS_ADC1 + ZOUL_SENSORS_ADC2)
|
||||
#define ZOUL_SENSORS_ADC13 (ZOUL_SENSORS_ADC1 + ZOUL_SENSORS_ADC3)
|
||||
#define ZOUL_SENSORS_ADC23 (ZOUL_SENSORS_ADC2 + ZOUL_SENSORS_ADC3)
|
||||
|
||||
/** @} */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
extern const struct sensors_sensor adc_sensors;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#endif /* ADC_SENSORS_H_ */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
*/
|
||||
|
@ -32,11 +32,11 @@
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \addtogroup remote-button-sensor
|
||||
* \addtogroup zoul-button-sensor
|
||||
* @{
|
||||
*
|
||||
* \file
|
||||
* Driver for the Re-Mote user button
|
||||
* Driver for the Zoul user button
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#include "contiki.h"
|
@ -32,17 +32,17 @@
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \addtogroup remote-sensors
|
||||
* \addtogroup zoul-sensors
|
||||
* @{
|
||||
*
|
||||
* \defgroup remote-button-sensor Re-Mote User Button Driver
|
||||
* \defgroup zoul-button-sensor Zoul User Button Driver
|
||||
*
|
||||
* Driver for the Re-Mote user button
|
||||
* Driver for the Zoul user button
|
||||
*
|
||||
* The Re-Mote button will generate a sensors_changed event on press as well
|
||||
* as on release.
|
||||
* The user button (on Zoul-based platforms like the RE-Mote and the Firefly)
|
||||
* will generate a sensors_changed event on press as well as on release.
|
||||
*
|
||||
* Unlike many other platforms, the Re-Mote user button has the ability to
|
||||
* Unlike many other platforms, the user button has the ability to
|
||||
* generate events when the user keeps the button pressed. The user can
|
||||
* configure the button driver with a timer interval in clock ticks. When the
|
||||
* button is kept pressed, the driver will then generate a broadcast event
|
||||
@ -53,7 +53,7 @@
|
||||
* @{
|
||||
*
|
||||
* \file
|
||||
* Header file for the Re-Mote User Button Driver
|
||||
* Header file for the Zoul User Button Driver
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#ifndef BUTTON_SENSOR_H_
|
289
platform/zoul/dev/cc1200-zoul-arch.c
Normal file
@ -0,0 +1,289 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Zolertia
|
||||
* 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 zoul
|
||||
* @{
|
||||
*
|
||||
* \defgroup zoul-cc1200 Zoul CC1200 arch
|
||||
*
|
||||
* CC1200 Zoul arch specifics
|
||||
* @{
|
||||
*
|
||||
* \file
|
||||
* CC1200 Zoul arch specifics
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#include "contiki.h"
|
||||
#include "contiki-net.h"
|
||||
#include "dev/leds.h"
|
||||
#include "reg.h"
|
||||
#include "spi-arch.h"
|
||||
#include "dev/ioc.h"
|
||||
#include "dev/sys-ctrl.h"
|
||||
#include "dev/spi.h"
|
||||
#include "dev/ssi.h"
|
||||
#include "dev/gpio.h"
|
||||
#include <stdio.h>
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#define CC1200_SPI_CLK_PORT_BASE GPIO_PORT_TO_BASE(SPI0_CLK_PORT)
|
||||
#define CC1200_SPI_CLK_PIN_MASK GPIO_PIN_MASK(SPI0_CLK_PIN)
|
||||
#define CC1200_SPI_MOSI_PORT_BASE GPIO_PORT_TO_BASE(SPI0_TX_PORT)
|
||||
#define CC1200_SPI_MOSI_PIN_MASK GPIO_PIN_MASK(SPI0_TX_PIN)
|
||||
#define CC1200_SPI_MISO_PORT_BASE GPIO_PORT_TO_BASE(SPI0_RX_PORT)
|
||||
#define CC1200_SPI_MISO_PIN_MASK GPIO_PIN_MASK(SPI0_RX_PIN)
|
||||
#define CC1200_SPI_CSN_PORT_BASE GPIO_PORT_TO_BASE(CC1200_SPI_CSN_PORT)
|
||||
#define CC1200_SPI_CSN_PIN_MASK GPIO_PIN_MASK(CC1200_SPI_CSN_PIN)
|
||||
#define CC1200_GDO0_PORT_BASE GPIO_PORT_TO_BASE(CC1200_GDO0_PORT)
|
||||
#define CC1200_GDO0_PIN_MASK GPIO_PIN_MASK(CC1200_GDO0_PIN)
|
||||
#define CC1200_GDO2_PORT_BASE GPIO_PORT_TO_BASE(CC1200_GDO2_PORT)
|
||||
#define CC1200_GDO2_PIN_MASK GPIO_PIN_MASK(CC1200_GDO2_PIN)
|
||||
#define CC1200_RESET_PORT_BASE GPIO_PORT_TO_BASE(CC1200_RESET_PORT)
|
||||
#define CC1200_RESET_PIN_MASK GPIO_PIN_MASK(CC1200_RESET_PIN)
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#ifndef DEBUG_CC1200_ARCH
|
||||
#define DEBUG_CC1200_ARCH 0
|
||||
#endif
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#if DEBUG_CC1200_ARCH > 0
|
||||
#define PRINTF(...) printf(__VA_ARGS__)
|
||||
#define BUSYWAIT_UNTIL(cond, max_time) \
|
||||
do { \
|
||||
rtimer_clock_t t0; \
|
||||
t0 = RTIMER_NOW(); \
|
||||
while(!(cond) && RTIMER_CLOCK_LT(RTIMER_NOW(), t0 + (max_time))) {} \
|
||||
if(!(RTIMER_CLOCK_LT(RTIMER_NOW(), t0 + (max_time)))) { \
|
||||
printf("ARCH: Timeout exceeded in line %d!\n", __LINE__); \
|
||||
} \
|
||||
} while(0)
|
||||
#else
|
||||
#define PRINTF(...)
|
||||
#define BUSYWAIT_UNTIL(cond, max_time) while(!cond)
|
||||
#endif
|
||||
/*---------------------------------------------------------------------------*/
|
||||
extern int cc1200_rx_interrupt(void);
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
cc1200_arch_spi_select(void)
|
||||
{
|
||||
/* Set CSn to low (0) */
|
||||
GPIO_CLR_PIN(CC1200_SPI_CSN_PORT_BASE, CC1200_SPI_CSN_PIN_MASK);
|
||||
/* The MISO pin should go low before chip is fully enabled. */
|
||||
BUSYWAIT_UNTIL(
|
||||
GPIO_READ_PIN(CC1200_SPI_MISO_PORT_BASE, CC1200_SPI_MISO_PIN_MASK) == 0,
|
||||
RTIMER_SECOND/100);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
cc1200_arch_spi_deselect(void)
|
||||
{
|
||||
/* Set CSn to high (1) */
|
||||
GPIO_SET_PIN(CC1200_SPI_CSN_PORT_BASE, CC1200_SPI_CSN_PIN_MASK);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
int
|
||||
cc1200_arch_spi_rw_byte(uint8_t c)
|
||||
{
|
||||
SPI_WAITFORTx_BEFORE();
|
||||
SPIX_BUF(CC1200_SPI_INSTANCE) = c;
|
||||
SPIX_WAITFOREOTx(CC1200_SPI_INSTANCE);
|
||||
SPIX_WAITFOREORx(CC1200_SPI_INSTANCE);
|
||||
c = SPIX_BUF(CC1200_SPI_INSTANCE);
|
||||
|
||||
return c;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
int
|
||||
cc1200_arch_spi_rw(uint8_t *inbuf, const uint8_t *write_buf, uint16_t len)
|
||||
{
|
||||
int i;
|
||||
uint8_t c;
|
||||
|
||||
if((inbuf == NULL && write_buf == NULL) || len <= 0) {
|
||||
return 1;
|
||||
|
||||
} else if(inbuf == NULL) {
|
||||
for(i = 0; i < len; i++) {
|
||||
SPI_WAITFORTx_BEFORE();
|
||||
SPIX_BUF(CC1200_SPI_INSTANCE) = write_buf[i];
|
||||
SPIX_WAITFOREOTx(CC1200_SPI_INSTANCE);
|
||||
SPIX_WAITFOREORx(CC1200_SPI_INSTANCE);
|
||||
c = SPIX_BUF(CC1200_SPI_INSTANCE);
|
||||
/* read and discard to avoid "variable set but not used" warning */
|
||||
(void)c;
|
||||
}
|
||||
|
||||
} else if(write_buf == NULL) {
|
||||
for(i = 0; i < len; i++) {
|
||||
SPI_WAITFORTx_BEFORE();
|
||||
SPIX_BUF(CC1200_SPI_INSTANCE) = 0;
|
||||
SPIX_WAITFOREOTx(CC1200_SPI_INSTANCE);
|
||||
SPIX_WAITFOREORx(CC1200_SPI_INSTANCE);
|
||||
inbuf[i] = SPIX_BUF(CC1200_SPI_INSTANCE);
|
||||
}
|
||||
|
||||
} else {
|
||||
for(i = 0; i < len; i++) {
|
||||
SPI_WAITFORTx_BEFORE();
|
||||
SPIX_BUF(CC1200_SPI_INSTANCE) = write_buf[i];
|
||||
SPIX_WAITFOREOTx(CC1200_SPI_INSTANCE);
|
||||
SPIX_WAITFOREORx(CC1200_SPI_INSTANCE);
|
||||
inbuf[i] = SPIX_BUF(CC1200_SPI_INSTANCE);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
cc1200_arch_gpio0_setup_irq(int rising)
|
||||
{
|
||||
|
||||
GPIO_SOFTWARE_CONTROL(CC1200_GDO0_PORT_BASE, CC1200_GDO0_PIN_MASK);
|
||||
GPIO_SET_INPUT(CC1200_GDO0_PORT_BASE, CC1200_GDO0_PIN_MASK);
|
||||
GPIO_DETECT_EDGE(CC1200_GDO0_PORT_BASE, CC1200_GDO0_PIN_MASK);
|
||||
GPIO_TRIGGER_SINGLE_EDGE(CC1200_GDO0_PORT_BASE, CC1200_GDO0_PIN_MASK);
|
||||
|
||||
if (rising){
|
||||
GPIO_DETECT_RISING(CC1200_GDO0_PORT_BASE, CC1200_GDO0_PIN_MASK);
|
||||
} else {
|
||||
GPIO_DETECT_FALLING(CC1200_GDO0_PORT_BASE, CC1200_GDO0_PIN_MASK);
|
||||
}
|
||||
|
||||
GPIO_ENABLE_INTERRUPT(CC1200_GDO0_PORT_BASE, CC1200_GDO0_PIN_MASK);
|
||||
ioc_set_over(CC1200_GDO0_PORT, CC1200_GDO0_PIN, IOC_OVERRIDE_PUE);
|
||||
nvic_interrupt_enable(CC1200_GPIOx_VECTOR);
|
||||
gpio_register_callback(cc1200_rx_interrupt, CC1200_GDO0_PORT,
|
||||
CC1200_GDO0_PIN);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
cc1200_arch_gpio2_setup_irq(int rising)
|
||||
{
|
||||
|
||||
GPIO_SOFTWARE_CONTROL(CC1200_GDO2_PORT_BASE, CC1200_GDO2_PIN_MASK);
|
||||
GPIO_SET_INPUT(CC1200_GDO2_PORT_BASE, CC1200_GDO2_PIN_MASK);
|
||||
GPIO_DETECT_EDGE(CC1200_GDO2_PORT_BASE, CC1200_GDO2_PIN_MASK);
|
||||
GPIO_TRIGGER_SINGLE_EDGE(CC1200_GDO2_PORT_BASE, CC1200_GDO2_PIN_MASK);
|
||||
|
||||
if (rising){
|
||||
GPIO_DETECT_RISING(CC1200_GDO2_PORT_BASE, CC1200_GDO2_PIN_MASK);
|
||||
} else {
|
||||
GPIO_DETECT_FALLING(CC1200_GDO2_PORT_BASE, CC1200_GDO2_PIN_MASK);
|
||||
}
|
||||
|
||||
GPIO_ENABLE_INTERRUPT(CC1200_GDO2_PORT_BASE, CC1200_GDO2_PIN_MASK);
|
||||
ioc_set_over(CC1200_GDO2_PORT, CC1200_GDO2_PIN, IOC_OVERRIDE_PUE);
|
||||
nvic_interrupt_enable(CC1200_GPIOx_VECTOR);
|
||||
gpio_register_callback(cc1200_rx_interrupt, CC1200_GDO2_PORT,
|
||||
CC1200_GDO2_PIN);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
cc1200_arch_gpio0_enable_irq(void)
|
||||
{
|
||||
GPIO_ENABLE_INTERRUPT(CC1200_GDO0_PORT_BASE, CC1200_GDO0_PIN_MASK);
|
||||
ioc_set_over(CC1200_GDO0_PORT, CC1200_GDO0_PIN, IOC_OVERRIDE_PUE);
|
||||
nvic_interrupt_enable(CC1200_GPIOx_VECTOR);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
cc1200_arch_gpio0_disable_irq(void)
|
||||
{
|
||||
GPIO_DISABLE_INTERRUPT(CC1200_GDO0_PORT_BASE, CC1200_GDO0_PIN_MASK);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
cc1200_arch_gpio2_enable_irq(void)
|
||||
{
|
||||
GPIO_ENABLE_INTERRUPT(CC1200_GDO2_PORT_BASE, CC1200_GDO2_PIN_MASK);
|
||||
ioc_set_over(CC1200_GDO2_PORT, CC1200_GDO2_PIN, IOC_OVERRIDE_PUE);
|
||||
nvic_interrupt_enable(CC1200_GPIOx_VECTOR);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
cc1200_arch_gpio2_disable_irq(void)
|
||||
{
|
||||
GPIO_DISABLE_INTERRUPT(CC1200_GDO2_PORT_BASE, CC1200_GDO2_PIN_MASK);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
int
|
||||
cc1200_arch_gpio0_read_pin(void)
|
||||
{
|
||||
return GPIO_READ_PIN(CC1200_GDO0_PORT_BASE, CC1200_GDO0_PIN_MASK);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
int
|
||||
cc1200_arch_gpio2_read_pin(void)
|
||||
{
|
||||
return GPIO_READ_PIN(CC1200_GDO2_PORT_BASE, CC1200_GDO2_PIN_MASK);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
int
|
||||
cc1200_arch_gpio3_read_pin(void)
|
||||
{
|
||||
return 0x00;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
cc1200_arch_init(void)
|
||||
{
|
||||
/* First leave RESET high */
|
||||
GPIO_SOFTWARE_CONTROL(CC1200_RESET_PORT_BASE, CC1200_RESET_PIN_MASK);
|
||||
GPIO_SET_OUTPUT(CC1200_RESET_PORT_BASE, CC1200_RESET_PIN_MASK);
|
||||
ioc_set_over(CC1200_RESET_PORT, CC1200_RESET_PIN, IOC_OVERRIDE_OE);
|
||||
GPIO_SET_PIN(CC1200_RESET_PORT_BASE, CC1200_RESET_PIN_MASK);
|
||||
|
||||
/* Initialize CSn, enable CSn and then wait for MISO to go low*/
|
||||
spix_cs_init(CC1200_SPI_CSN_PORT, CC1200_SPI_CSN_PIN);
|
||||
|
||||
/* Initialize SPI */
|
||||
spix_init(CC1200_SPI_INSTANCE);
|
||||
|
||||
/* Configure GPIOx */
|
||||
GPIO_SOFTWARE_CONTROL(CC1200_GDO0_PORT_BASE, CC1200_GDO0_PIN_MASK);
|
||||
GPIO_SET_INPUT(CC1200_GDO0_PORT_BASE, CC1200_GDO0_PIN_MASK);
|
||||
GPIO_SOFTWARE_CONTROL(CC1200_GDO2_PORT_BASE, CC1200_GDO2_PIN_MASK);
|
||||
GPIO_SET_INPUT(CC1200_GDO2_PORT_BASE, CC1200_GDO2_PIN_MASK);
|
||||
|
||||
/* Leave CSn as default */
|
||||
cc1200_arch_spi_deselect();
|
||||
|
||||
/* Ensure MISO is high */
|
||||
BUSYWAIT_UNTIL(
|
||||
GPIO_READ_PIN(CC1200_SPI_MISO_PORT_BASE, CC1200_SPI_MISO_PIN_MASK),
|
||||
RTIMER_SECOND/10);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
*/
|
||||
|
@ -29,7 +29,7 @@
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \addtogroup remote-led-strip
|
||||
* \addtogroup zoul-led-strip
|
||||
* @{
|
||||
*
|
||||
* Driver to control a bright LED strip powered at 3VDC, drawing power directly
|
||||
@ -38,7 +38,7 @@
|
||||
* @{
|
||||
*
|
||||
* \file
|
||||
* Driver for the Re-Mote bright LED strip Driver
|
||||
* Driver for a bright LED strip
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#include "contiki.h"
|
||||
@ -65,7 +65,7 @@ led_strip_config(void)
|
||||
GPIO_SOFTWARE_CONTROL(LED_STRIP_PORT_BASE, LED_STRIP_PIN_MASK);
|
||||
/* Set pin to output */
|
||||
GPIO_SET_OUTPUT(LED_STRIP_PORT_BASE, LED_STRIP_PIN_MASK);
|
||||
/* Set the antenna selector to a default position */
|
||||
/* Set the pin to a default position */
|
||||
GPIO_SET_PIN(LED_STRIP_PORT_BASE, LED_STRIP_PIN_MASK);
|
||||
|
||||
initialized = 1;
|
@ -28,10 +28,10 @@
|
||||
*/
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/**
|
||||
* \addtogroup remote-sensors
|
||||
* \addtogroup zoul-sensors
|
||||
* @{
|
||||
*
|
||||
* \defgroup remote-led-strip Re-Mote LED strip driver
|
||||
* \defgroup zoul-led-strip LED strip compatible with Zoul-based platforms
|
||||
*
|
||||
* Driver to control a bright LED strip powered at 3VDC, drawing power directly
|
||||
* from the battery power supply. An example on how to adapt 12VDC LED strips
|
||||
@ -39,7 +39,7 @@
|
||||
* @{
|
||||
*
|
||||
* \file
|
||||
* Header file for the Re-Mote bright LED strip Driver
|
||||
* Header file for a bright LED strip driver
|
||||
*/
|
||||
/* -------------------------------------------------------------------------- */
|
||||
#ifndef LED_STRIP_H_
|
@ -30,78 +30,40 @@
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/**
|
||||
* \addtogroup remote
|
||||
* \addtogroup zoul
|
||||
* @{
|
||||
*
|
||||
* \defgroup remote-leds Re-Mote LED driver
|
||||
* \defgroup zoul-leds Zoul LED driver
|
||||
*
|
||||
* LED driver implementation for the Re-Mote platform
|
||||
* LED driver implementation for the Zoul-based platforms
|
||||
* @{
|
||||
*
|
||||
* \file
|
||||
* LED driver implementation for the Re-Mote platform
|
||||
* LED driver implementation for the Zoul-based platforms
|
||||
*/
|
||||
#include "contiki.h"
|
||||
#include "reg.h"
|
||||
#include "dev/leds.h"
|
||||
#include "dev/gpio.h"
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#define LED_GREEN_PORT GPIO_D_BASE
|
||||
#define LED_GREEN_PIN (1 << 5)
|
||||
|
||||
#define LED_BLUE_PORT GPIO_C_BASE
|
||||
#define LED_BLUE_PIN (1 << 3)
|
||||
|
||||
#define LED_RED_PORT GPIO_D_BASE
|
||||
#define LED_RED_PIN (1 << 2)
|
||||
|
||||
#define PORT_D_LEDS (LED_RED_PIN | LED_GREEN_PIN)
|
||||
#define PORT_C_LEDS LED_BLUE_PIN
|
||||
#define LEDS_GPIO_PIN_MASK LEDS_ALL
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
leds_arch_init(void)
|
||||
{
|
||||
/* Initialize LED1 (Red) and LED3 (Green) */
|
||||
GPIO_SET_OUTPUT(GPIO_D_BASE, PORT_D_LEDS);
|
||||
GPIO_SET_PIN(GPIO_D_BASE, PORT_D_LEDS);
|
||||
|
||||
/* Initialize LED2 - Blue */
|
||||
GPIO_SET_OUTPUT(GPIO_C_BASE, PORT_C_LEDS);
|
||||
GPIO_SET_PIN(GPIO_C_BASE, PORT_C_LEDS);
|
||||
GPIO_SET_OUTPUT(GPIO_D_BASE, LEDS_GPIO_PIN_MASK);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
unsigned char
|
||||
leds_arch_get(void)
|
||||
{
|
||||
uint8_t mask_leds;
|
||||
|
||||
mask_leds = GPIO_READ_PIN(LED_GREEN_PORT, LED_GREEN_PIN) == 0? LEDS_GREEN : 0;
|
||||
mask_leds |= GPIO_READ_PIN(LED_BLUE_PORT, LED_BLUE_PIN) == 0? LEDS_BLUE : 0;
|
||||
mask_leds |= GPIO_READ_PIN(LED_RED_PORT, LED_RED_PIN) == 0? LEDS_RED : 0;
|
||||
|
||||
return mask_leds;
|
||||
return GPIO_READ_PIN(GPIO_D_BASE, LEDS_GPIO_PIN_MASK);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
leds_arch_set(unsigned char leds)
|
||||
{
|
||||
if(leds & LEDS_GREEN) {
|
||||
GPIO_CLR_PIN(LED_GREEN_PORT, LED_GREEN_PIN);
|
||||
} else {
|
||||
GPIO_SET_PIN(LED_GREEN_PORT, LED_GREEN_PIN);
|
||||
}
|
||||
|
||||
if(leds & LEDS_BLUE) {
|
||||
GPIO_CLR_PIN(LED_BLUE_PORT, LED_BLUE_PIN);
|
||||
} else {
|
||||
GPIO_SET_PIN(LED_BLUE_PORT, LED_BLUE_PIN);
|
||||
}
|
||||
|
||||
if(leds & LEDS_RED) {
|
||||
GPIO_CLR_PIN(LED_RED_PORT, LED_RED_PIN);
|
||||
} else {
|
||||
GPIO_SET_PIN(LED_RED_PORT, LED_RED_PIN);
|
||||
}
|
||||
GPIO_WRITE_PIN(GPIO_D_BASE, LEDS_GPIO_PIN_MASK, leds);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
@ -29,7 +29,7 @@
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \addtogroup remote-mp3-wtv020sd
|
||||
* \addtogroup zoul-mp3-wtv020sd
|
||||
* @{
|
||||
*
|
||||
* Driver to control the MP3 WTV020SD board in MP3 mode (GPIO based) and the
|
@ -28,10 +28,11 @@
|
||||
*/
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/**
|
||||
* \addtogroup remote-sensors
|
||||
* \addtogroup zoul-sensors
|
||||
* @{
|
||||
*
|
||||
* \defgroup remote-mp3-wtv020sd Re-Mote MP3 WTV020SD driver
|
||||
* \defgroup zoul-mp3-wtv020sd MP3 WTV020SD driver compatible with Zoul-based
|
||||
* platforms
|
||||
*
|
||||
* Driver to control the MP3 WTV020SD board in MP3 mode (GPIO based) and the
|
||||
* 2-line serial mode (CLK/DI). Loop Mode and Key Modes not implemented.
|
@ -31,7 +31,7 @@
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \addtogroup remote-sht25-sensor
|
||||
* \addtogroup zoul-sht25-sensor
|
||||
* @{
|
||||
*
|
||||
* \file
|
||||
@ -46,8 +46,6 @@
|
||||
#include "dev/sht25.h"
|
||||
#include "lib/sensors.h"
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#warning I2C SDA AND SCL are inverted in JP8 connector, inverted in init() call
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static uint8_t enabled;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static int
|
||||
@ -57,7 +55,7 @@ configure(int type, int value)
|
||||
return SHT25_ERROR;
|
||||
}
|
||||
if(value) {
|
||||
i2c_init(I2C_SCL_PORT, I2C_SCL_PIN, I2C_SDA_PORT, I2C_SDA_PIN,
|
||||
i2c_init(I2C_SDA_PORT, I2C_SDA_PIN, I2C_SCL_PORT, I2C_SCL_PIN,
|
||||
I2C_SCL_NORMAL_BUS_SPEED);
|
||||
}
|
||||
enabled = value;
|
@ -31,10 +31,10 @@
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \addtogroup remote-sensors
|
||||
* \addtogroup zoul-sensors
|
||||
* @{
|
||||
*
|
||||
* \defgroup remote-sht25-sensor Re-Mote SHT25 digital temperature sensor
|
||||
* \defgroup zoul-sht25-sensor SHT25 digital temperature sensor
|
||||
* @{
|
||||
*
|
||||
* \file
|
@ -29,11 +29,11 @@
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \addtogroup remote-tmp102-sensor
|
||||
* \addtogroup zoul-tmp102-sensor
|
||||
* @{
|
||||
*
|
||||
* \file
|
||||
* Driver for the Re-Mote TMP102 temperature sensor
|
||||
* Driver for the TMP102 temperature sensor
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#include <stdio.h>
|
@ -31,19 +31,19 @@
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \addtogroup remote-sensors
|
||||
* \addtogroup zoul-sensors
|
||||
* @{
|
||||
*
|
||||
* \defgroup remote-tmp102-sensor Re-Mote TMP102 Sensor
|
||||
* \defgroup zoul-tmp102-sensor TMP102 Sensor
|
||||
*
|
||||
* Driver for the Re-Mote TMP102 sensor
|
||||
* Driver for the TMP102 sensor
|
||||
*
|
||||
* The TMP102 driver returns the converted temperature value in centiCelsius
|
||||
* with 2 digits precision, to get Celsius just divide by 100.
|
||||
* @{
|
||||
*
|
||||
* \file
|
||||
* Header file for the Re-Mote TMP102 Sensor Driver
|
||||
* Header file for the TMP102 Sensor Driver
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#ifndef TMP102_H_
|
@ -29,11 +29,11 @@
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \addtogroup remote-tsl2563-sensor
|
||||
* \addtogroup zoul-tsl2563-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>
|
||||
@ -46,8 +46,6 @@
|
||||
#include "lib/sensors.h"
|
||||
#include "tsl2563.h"
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#warning I2C SDA AND SCL are inverted in JP8 connector, inverted in init() call
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static uint8_t enabled;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static uint16_t
|
||||
@ -142,7 +140,7 @@ configure(int type, int value)
|
||||
}
|
||||
enabled = value;
|
||||
if(value) {
|
||||
i2c_init(I2C_SCL_PORT, I2C_SCL_PIN, I2C_SDA_PORT, I2C_SDA_PIN,
|
||||
i2c_init(I2C_SDA_PORT, I2C_SDA_PIN, I2C_SCL_PORT, I2C_SCL_PIN,
|
||||
I2C_SCL_NORMAL_BUS_SPEED);
|
||||
} else {
|
||||
light_ziglet_off();
|
@ -31,18 +31,18 @@
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \addtogroup remote-sensors
|
||||
* \addtogroup zoul-sensors
|
||||
* @{
|
||||
*
|
||||
* \defgroup remote-tsl2563-sensor Re-Mote TSL2563 Sensor
|
||||
* \defgroup zoul-tsl2563-sensor TSL2563 Sensor
|
||||
*
|
||||
* Driver for the Re-Mote TSL2563 sensor
|
||||
* Driver for the TSL2563 sensor
|
||||
*
|
||||
* The TSL2563 driver returns the converted light value value in lux
|
||||
* @{
|
||||
*
|
||||
* \file
|
||||
* Header file for the Re-Mote external TSL2563 Sensor Driver
|
||||
* Header file for the external TSL2563 Sensor Driver
|
||||
*
|
||||
* \author
|
||||
* Antonio Lignan <alinan@zolertia.com>
|
@ -31,26 +31,24 @@
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \addtogroup remote-sensors
|
||||
* \addtogroup zoul-sensors
|
||||
* @{
|
||||
*
|
||||
* Generic module controlling sensors on the Re-Mote platform
|
||||
* Generic module controlling sensors on the Zoul platform
|
||||
* @{
|
||||
*
|
||||
* \file
|
||||
* Implementation of a generic module controlling Re-Mote sensors
|
||||
* Implementation of a generic module controlling Zoul sensors
|
||||
*/
|
||||
#include "contiki.h"
|
||||
#include "dev/cc2538-sensors.h"
|
||||
#include "dev/button-sensor.h"
|
||||
#include "dev/phidget-sensor.h"
|
||||
#include "adc-sensors.h"
|
||||
|
||||
#include <string.h>
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* TODO: include the tmp102 sensor as well */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** \brief Exports global symbols for the sensor API */
|
||||
SENSORS(&button_sensor, &vdd3_sensor, &cc2538_temp_sensor, &phidget_sensor);
|
||||
SENSORS(&button_sensor, &vdd3_sensor, &cc2538_temp_sensor, &adc_sensors);
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @}
|
@ -31,39 +31,38 @@
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \addtogroup remote
|
||||
* \addtogroup zoul
|
||||
* @{
|
||||
*
|
||||
* \defgroup remote-sensors Re-Mote Sensors
|
||||
* \defgroup zoul-sensors Zoul Sensors
|
||||
*
|
||||
* Generic module controlling sensors on the Re-Mote platform
|
||||
* Generic module controlling sensors on the Zoul platform
|
||||
* @{
|
||||
*
|
||||
* \file
|
||||
* Implementation of a generic module controlling Re-Mote sensors
|
||||
* Implementation of a generic module controlling Zoul sensors
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#ifndef REMOTE_SENSORS_H_
|
||||
#define REMOTE_SENSORS_H_
|
||||
#ifndef ZOUL_SENSORS_H_
|
||||
#define ZOUL_SENSORS_H_
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#include "lib/sensors.h"
|
||||
#include "dev/cc2538-sensors.h"
|
||||
#include "dev/button-sensor.h"
|
||||
#include "dev/phidget-sensor.h"
|
||||
#include "adc-sensors.h"
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \name ReMote sensor constants
|
||||
* \name Zoul sensor constants
|
||||
*
|
||||
* These constants are used by various sensors on the ReMote. They can be used
|
||||
* These constants are used by various sensors on the Zoul. They can be used
|
||||
* to configure ADC decimation rate (where applicable).
|
||||
* @{
|
||||
*/
|
||||
#define REMOTE_SENSORS_CONFIGURE_TYPE_DECIMATION_RATE 0x0100 /**< Change decimation rate (used with configure()) */
|
||||
|
||||
#define REMOTE_SENSORS_ERROR CC2538_SENSORS_ERROR /**< Error */
|
||||
#define ZOUL_SENSORS_CONFIGURE_TYPE_DECIMATION_RATE 0x0100
|
||||
#define ZOUL_SENSORS_ERROR CC2538_SENSORS_ERROR
|
||||
/** @} */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#endif /* REMOTE_SENSORS_H_ */
|
||||
#endif /* ZOUL_SENSORS_H_ */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @}
|
2
platform/zoul/firefly/Makefile.firefly
Normal file
@ -0,0 +1,2 @@
|
||||
MOTELIST_ZOLERTIA = firefly
|
||||
BOARD_SOURCEFILES += board.c
|
28
platform/zoul/firefly/README.md
Normal file
@ -0,0 +1,28 @@
|
||||
Zolertia Firefly platform
|
||||
============================================
|
||||
|
||||
![Zolertia Firefly breakout board][firefly]
|
||||
|
||||
The Firefly is a breakout board designed to inspire.
|
||||
|
||||
It exposes the most basic Zoul features, sporting only the most down-to-core features to work with the Zoul, providing the following:
|
||||
|
||||
* ARM Cortex-M3 with 512KB flash and 32KB RAM (16KB retention), 32MHz.
|
||||
* ISM 2.4-GHz IEEE 802.15.4 & Zigbee compliant.
|
||||
* ISM 868-, 915-, 920-, 950-MHz ISM/SRD Band.
|
||||
* On-board printed PCB sub-1GHz antenna, alternatively u.FL for sub-1GHz/2.4GHz external antennas.
|
||||
* AES-128/256, SHA2 Hardware Encryption Engine.
|
||||
* ECC-128/256, RSA Hardware Acceleration Engine for Secure Key Exchange.
|
||||
* Compatible with breadboards and protoboards.
|
||||
* On-board CP2104/PIC to flash over USB.
|
||||
* User and reset buttons.
|
||||
* RGB LED to allow more than 7 colour combinations.
|
||||
* Small form factor (53x25mm).
|
||||
|
||||
The Firefly can be seen as the "small brother" of the RE-Mote, with a slick design and a lower cost.
|
||||
|
||||
To work out of the box, the firefly includes a PCB antenna for the Sub-1GHz interface, as well as 2 x u.Fl connectors for 2.4GHz and sub-1GHz external antennas.
|
||||
|
||||
The firefly can be programmed and debugged over JTAG and USB. The board has a CP2104 USB to serial converter with a PIC, it allows to program the CC2538 without having to manually to put the device in bootloader mode.
|
||||
|
||||
[firefly]: ../images/firefly.png "Zolertia RE-Firefly breakout board"
|
@ -1,6 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Zolertia - http://www.zolertia.com
|
||||
* Copyright (c) 2015, University of Bristol - http://www.bristol.ac.uk
|
||||
* Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -11,7 +10,6 @@
|
||||
* 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.
|
||||
@ -31,54 +29,31 @@
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \addtogroup remote-sensors
|
||||
* @{
|
||||
*
|
||||
* \defgroup remote-phidget-sensor Re-Mote Generic Phidget Sensor
|
||||
*
|
||||
* Driver for the Re-Mote phidget ADC sensor
|
||||
*
|
||||
* This driver supports phidgets connected to both the ADC2 and AND3 channels.
|
||||
* This is controlled by the type argument of the value() function. Possible
|
||||
* choices are:
|
||||
* - PHIDGET_SENSORS_ADC2 (channel 2)
|
||||
* - PHIDGET_SENSORS_ADC3 (channel 3)
|
||||
*
|
||||
* The decimation rate can be set by passing
|
||||
* REMOTE_SENSORS_CONFIGURE_TYPE_DECIMATION_RATE as the type argument to the
|
||||
* configure() function and then specifying the rate through the value
|
||||
* argument. Valid values are:
|
||||
* - SOC_ADC_ADCCON_DIV_64 (64 bit rate)
|
||||
* - SOC_ADC_ADCCON_DIV_128 (128 bit rate)
|
||||
* - SOC_ADC_ADCCON_DIV_256 (256 bit rate)
|
||||
* - SOC_ADC_ADCCON_DIV_512 (512 bit rate)
|
||||
* \addtogroup firefly
|
||||
* @{
|
||||
*
|
||||
* \file
|
||||
* Header file for the Re-Mote Generic Driver for Phidget/ADC sensors
|
||||
* Board-initialisation for the Zolertia's Firefly platform
|
||||
*
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#ifndef PHIDGET_SENSOR_H_
|
||||
#define PHIDGET_SENSOR_H_
|
||||
#include "contiki-conf.h"
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#include "lib/sensors.h"
|
||||
#include "dev/soc-adc.h"
|
||||
static void
|
||||
configure_unused_pins(void)
|
||||
{
|
||||
// FIXME
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
board_init()
|
||||
{
|
||||
configure_unused_pins();
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \name Generic phidget sensor
|
||||
* @{
|
||||
* @}
|
||||
*/
|
||||
#define PHIDGET_SENSOR "Phidget ADC"
|
||||
|
||||
#define PHIDGET_SENSORS_ADC2 2 /**< 3V3 ADC phidget-like connector ADC2 */
|
||||
#define PHIDGET_SENSORS_ADC3 3 /**< 3V3 ADC phidget-like connector ADC3 */
|
||||
/** @} */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
extern const struct sensors_sensor phidget_sensor;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#endif /* PHIDGET_SENSOR_H_ */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
*/
|
305
platform/zoul/firefly/board.h
Normal file
@ -0,0 +1,305 @@
|
||||
/*
|
||||
* Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/
|
||||
* Copyright (c) 2015, Zolertia
|
||||
* 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 zoul-platforms
|
||||
* @{
|
||||
*
|
||||
* \defgroup firefly Firefly platform
|
||||
*
|
||||
* The Zolertia Firefly is the most down-to-core development platform, exposing
|
||||
* the Zoul core functionalities and features, with a slick design to allow a
|
||||
* flexible and easier user experience.
|
||||
*
|
||||
* Defines related to the Firefly platform: a Zoul-based breakout board
|
||||
*
|
||||
* This file provides connectivity information on LEDs, Buttons, UART and
|
||||
* other 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
|
||||
* Firefly platform, Zoul-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 Connector headers
|
||||
*
|
||||
* The Firefly features two 2.54 mm header rows over which exposes the following
|
||||
* pins (facing up, Zolertia logo above and Micro-USB connector below):
|
||||
* -----------------------------+---+---+--------------------------------------
|
||||
* PIN_NAME |JP3|JP2| PIN_NAME
|
||||
* -----------------------------+---+---+--------------------------------------
|
||||
* PB5/CC1200.CS |-01|01-| LED1/PD5
|
||||
* PB2/SPI0.SCLK/CC1200.SCLK |-02|02-| LED2/PD4
|
||||
* PB1/SPIO0.MOSI/CC1200.MOSI |-03|03-| LED3/PD3
|
||||
* PB3/SPIO0.MISO/CC1200.MISO |-04|04-| PD2
|
||||
* PB3/CC1200.GPIO0 |-05|05-| PD1
|
||||
* PC0/UART1.TX |-06|06-| PD0
|
||||
* PC1/UART1.RX |-07|07-| AIN7/PA7
|
||||
* PC2/I2C.SDA |-08|08-| AIN6/PA6
|
||||
* PC3/I2C.SCL |-09|09-| ADC1/AIN5/PA5
|
||||
* PC4/SPI1.SCLK |-10|10-| ADC2/AIN4/PA4
|
||||
* PC5/SPI1.MOSI |-11|11-| BUTTON.USER/PA3
|
||||
* PC6/SPI1.MISO |-12|12-| ADC3/AIN2/PA2
|
||||
* USB.D+ |-13|13-| DGND
|
||||
* USB.D- |-14|14-| D+3.3
|
||||
* ---------------------------+-+---+---+-+------------------------------------
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** \name Firefly LED configuration
|
||||
*
|
||||
* LEDs on the Firefly are connected as follows:
|
||||
* - LED1 (Red) -> PD5
|
||||
* - LED2 (Green) -> PD4
|
||||
* - LED3 (Blue) -> PD3
|
||||
*
|
||||
* LED1 pin exposed in JP2 connector
|
||||
* LED2 pin exposed in JP2 connector
|
||||
* LED3 pin exposed in JP2 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 << 4) /**< LED1 (Green) -> PD4 */
|
||||
#define LEDS_BLUE (1 << 3) /**< LED2 (Blue) -> PD3 */
|
||||
#define LEDS_RED (1 << 5) /**< LED3 (Red) -> PD5 */
|
||||
|
||||
#define LEDS_CONF_ALL (LEDS_GREEN | LEDS_BLUE | LEDS_RED)
|
||||
|
||||
#define LEDS_LIGHT_BLUE (LEDS_GREEN | LEDS_BLUE) /**< Green + Blue (24) */
|
||||
#define LEDS_YELLOW (LEDS_GREEN | LEDS_RED) /**< Green + Red (48) */
|
||||
#define LEDS_PURPLE (LEDS_BLUE | LEDS_RED) /**< Blue + Red (40) */
|
||||
#define LEDS_WHITE LEDS_ALL /**< Green + Blue + Red (56) */
|
||||
|
||||
/* Notify various examples that we have LEDs */
|
||||
#define PLATFORM_HAS_LEDS 1
|
||||
/** @} */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** \name USB configuration
|
||||
*
|
||||
* The USB pullup is to be enabled by an external resistor, as it is 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 Firefly, the UARTs are connected to the following ports/pins:
|
||||
*
|
||||
* - UART0:
|
||||
* - RX: PA0, connected to CP2104 serial-to-usb converter TX pin
|
||||
* - TX: PA1, connected to CP2104 serial-to-usb converter RX pin
|
||||
* - UART1:
|
||||
* - RX: PC1
|
||||
* - TX: PC0
|
||||
* - CTS: not used, one suggestion however is to use PD1
|
||||
* - RTS: not used, one suggestion however is to use PD0
|
||||
*
|
||||
* We configure the port to use UART0 and UART1, CTS/RTS only for UART1,
|
||||
* both without a HW pull-up resistor.
|
||||
* UART0 is not exposed anywhere, UART1 pins are exposed over the JP3 connector.
|
||||
* @{
|
||||
*/
|
||||
#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 1
|
||||
#define UART1_TX_PORT GPIO_C_NUM
|
||||
#define UART1_TX_PIN 0
|
||||
#define UART1_CTS_PORT (-1) /**< GPIO_D_NUM */
|
||||
#define UART1_CTS_PIN (-1) /**< 1 */
|
||||
#define UART1_RTS_PORT (-1) /**< GPIO_D_NUM */
|
||||
#define UART1_RTS_PIN (-1) /**< 0 */
|
||||
/** @} */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** \name Firefly Button configuration
|
||||
*
|
||||
* Buttons on the Firefly are connected as follows:
|
||||
* - BUTTON_USER -> PA3, S1 user button, shared with bootloader
|
||||
* - BUTTON_RESET -> RESET_N line
|
||||
* @{
|
||||
*/
|
||||
/** 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. There pins are suggested as they can be changed, but note that only
|
||||
* pins from PA can be configured as ADC.
|
||||
*
|
||||
* The Firefly, as it is, only allows 3.3VDC sensors.
|
||||
*
|
||||
* The internal ADC reference is 1190mV, use either a voltage divider as input,
|
||||
* or a different voltage reference, like AVDD5 or other externally (AIN7 or
|
||||
* AIN6).
|
||||
* @{
|
||||
*/
|
||||
#define ADC_SENSORS_PORT GPIO_A_NUM /**< ADC GPIO control port */
|
||||
#define ADC_SENSORS_ADC1_PIN 5 /**< ADC1 to PA5, 3V3 */
|
||||
#define ADC_SENSORS_ADC2_PIN 4 /**< ADC2 to PA4, 3V3 */
|
||||
#define ADC_SENSORS_ADC3_PIN 2 /**< ADC3 to PA2, 3V3 */
|
||||
/** @} */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \name SPI (SSI0) configuration
|
||||
*
|
||||
* These values configure which CC2538 pins to use for the SPI (SSI0) lines,
|
||||
* reserved exclusively for the CC1200 RF transceiver. These pins are exposed
|
||||
* to the JP3 connector. To disable the CC1200 and use these pins, just
|
||||
* remove the R10 resistor (0 ohm), which powers both the CC2538 and CC1200 to
|
||||
* only power the SoC.
|
||||
* TX -> MOSI, RX -> MISO
|
||||
* @{
|
||||
*/
|
||||
#define SPI0_CLK_PORT GPIO_B_NUM
|
||||
#define SPI0_CLK_PIN 2
|
||||
#define SPI0_TX_PORT GPIO_B_NUM
|
||||
#define SPI0_TX_PIN 1
|
||||
#define SPI0_RX_PORT GPIO_B_NUM
|
||||
#define SPI0_RX_PIN 3
|
||||
/** @} */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \name SPI (SSI1) configuration
|
||||
*
|
||||
* These values configure which CC2538 pins to use for the SPI (SSI1) lines,
|
||||
* exposed over JP3 connector.
|
||||
* TX -> MOSI, RX -> MISO
|
||||
* @{
|
||||
*/
|
||||
#define SPI1_CLK_PORT GPIO_C_NUM
|
||||
#define SPI1_CLK_PIN 4
|
||||
#define SPI1_TX_PORT GPIO_C_NUM
|
||||
#define SPI1_TX_PIN 5
|
||||
#define SPI1_RX_PORT GPIO_C_NUM
|
||||
#define SPI1_RX_PIN 6
|
||||
/** @} */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \name I2C configuration
|
||||
*
|
||||
* These values configure which CC2538 pins to use for the I2C lines, exposed
|
||||
* over JP3 connector.
|
||||
* @{
|
||||
*/
|
||||
#define I2C_SCL_PORT GPIO_C_NUM
|
||||
#define I2C_SCL_PIN 3
|
||||
#define I2C_SDA_PORT GPIO_C_NUM
|
||||
#define I2C_SDA_PIN 2
|
||||
/** @} */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \name Dual RF interface support
|
||||
*
|
||||
* Enables support for dual band operation (both CC1200 and 2.4GHz enabled).
|
||||
* Unlike the RE-Mote, the Firefly doesn't have a RF switch, so both interfaces
|
||||
* should be always enabled if the R10 resistor is mounted. If only using the
|
||||
* 2.4GHz RF interface, the resistor can be removed to power-off the CC1200.
|
||||
* @{
|
||||
*/
|
||||
#define REMOTE_DUAL_RF_ENABLED 1
|
||||
/** @} */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \name CC1200 configuration
|
||||
*
|
||||
* These values configure the required pins to drive the CC1200
|
||||
* None of the following pins are exposed to any connector, kept for internal
|
||||
* use only
|
||||
* @{
|
||||
*/
|
||||
#define CC1200_SPI_INSTANCE 0
|
||||
#define CC1200_SPI_SCLK_PORT SPI0_CLK_PORT
|
||||
#define CC1200_SPI_SCLK_PIN SPI0_CLK_PIN
|
||||
#define CC1200_SPI_MOSI_PORT SPI0_TX_PORT
|
||||
#define CC1200_SPI_MOSI_PIN SPI0_TX_PIN
|
||||
#define CC1200_SPI_MISO_PORT SPI0_RX_PORT
|
||||
#define CC1200_SPI_MISO_PIN SPI0_RX_PIN
|
||||
#define CC1200_SPI_CSN_PORT GPIO_B_NUM
|
||||
#define CC1200_SPI_CSN_PIN 5
|
||||
#define CC1200_GDO0_PORT GPIO_B_NUM
|
||||
#define CC1200_GDO0_PIN 4
|
||||
#define CC1200_GDO2_PORT GPIO_B_NUM
|
||||
#define CC1200_GDO2_PIN 0
|
||||
#define CC1200_RESET_PORT GPIO_C_NUM
|
||||
#define CC1200_RESET_PIN 7
|
||||
#define CC1200_GPIOx_VECTOR NVIC_INT_GPIO_PORT_B
|
||||
/** @} */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \name Device string used on startup
|
||||
* @{
|
||||
*/
|
||||
#define BOARD_STRING "Zolertia Firefly platform"
|
||||
/** @} */
|
||||
|
||||
#endif /* BOARD_H_ */
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
*/
|
BIN
platform/zoul/images/firefly.png
Executable file
After Width: | Height: | Size: 226 KiB |
BIN
platform/zoul/images/remote-back.png
Executable file
After Width: | Height: | Size: 139 KiB |
BIN
platform/zoul/images/remote-front.png
Executable file
After Width: | Height: | Size: 120 KiB |
BIN
platform/zoul/images/remote-pinout-back.png
Executable file
After Width: | Height: | Size: 124 KiB |
BIN
platform/zoul/images/remote-pinout-front.png
Executable file
After Width: | Height: | Size: 117 KiB |
BIN
platform/zoul/images/zoul-front.png
Executable file
After Width: | Height: | Size: 130 KiB |
BIN
platform/zoul/images/zoul-pinout-back.png
Executable file
After Width: | Height: | Size: 131 KiB |
BIN
platform/zoul/images/zoul-pinout-front.png
Executable file
After Width: | Height: | Size: 96 KiB |
2
platform/zoul/remote/Makefile.remote
Normal file
@ -0,0 +1,2 @@
|
||||
MOTELIST_ZOLERTIA = remote
|
||||
BOARD_SOURCEFILES += board.c antenna-sw.c
|
47
platform/zoul/remote/README.md
Normal file
@ -0,0 +1,47 @@
|
||||
Zolertia RE-Mote platform
|
||||
============================================
|
||||
|
||||
![Zolertia RE-Mote development platform][remote-front]
|
||||
|
||||
The RE-Mote is a hardware development platform to build real IoT (Internet of Things) applications and products, aimed to high skilled developers as well as Makers (Do-It-Yourself enthusiasts) and early beginners, providing an industry-ready and resilient hardware solution for most Smart Cities, Home Comfort, eHealth and Industrial applications. The RE-Mote conciliates an ultra-low power consumption with a high performance design, meeting specifications of processing resources, security and resilient operation.
|
||||
|
||||
The RE-Mote platform was designed jointly with universities and industrial partners from different countries in the context of RERUM <https://ict-rerum.eu> European Project.
|
||||
|
||||
![Zolertia RE-Mote development platform][remote-back]
|
||||
|
||||
The RE-Mote features a Zoul as its core module and it is bundled with the following features:
|
||||
|
||||
* ARM Cortex-M3 with 512KB flash and 32KB RAM (16KB retention), 32MHz.
|
||||
* ISM 2.4-GHz IEEE 802.15.4 & Zigbee compliant.
|
||||
* ISM 868-, 915-, 920-, 950-MHz ISM/SRD Band.
|
||||
* On-board RF switch to programatically select RF itnerfaces. Above RF interfaces can be used alternatively over a single RP-SMA connector for external antenna, or simultaneously by using an UFl pigtail or soldering an internal ceramic chip antenna (available on request).
|
||||
* AES-128/256, SHA2 Hardware Encryption Engine.
|
||||
* ECC-128/256, RSA Hardware Acceleration Engine for Secure Key Exchange.
|
||||
* Power consumption down to 300nA using our shutdown mode.
|
||||
* 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 3.7-26VDC.
|
||||
* On-board micro USB connector for USB 2.0 applications.
|
||||
* RGB LED to allow more than 7 colour combinations.
|
||||
* On-board nano-watt RTC.
|
||||
* User and Reset buttons.
|
||||
* On-board Micro-SD for external storage.
|
||||
* On-board external Watchdog Timer (WDT) for resilient operation.
|
||||
* Small form-factor of 73x40 mm.
|
||||
|
||||
The most prominent feature of the RE-Mote is its ultra low-power implementation, allowing a flexible and time/date-aware control of the platform operation modes by introducing a real-time clock (RTC), nanowatt external timer, ultra-low power PIC governing the battery manager, etc.
|
||||
|
||||
The RE-Mote features an optional custom-made enclosure to fit most scenarios, allowing to easily connect sensors, actuators and rechargeable LiPo batteries. Its on-board RP-SMA antenna eliminates the need to mechanize an external antenna, allowing to alternatively use either a sub-1GHz or 2.4GHz antenna, or a multiband one.
|
||||
|
||||
The external WDT with battery monitor allows a robust and resilience operation for most critical applications.
|
||||
|
||||
Zoul pin-out
|
||||
=============
|
||||
|
||||
![RE-Mote pin-out (front)][remote-pinout-front]
|
||||
![RE-Mote pin-out (back)][remote-pinout-back]
|
||||
|
||||
[remote-front]: ../images/remote-front.png "Zolertia RE-Mote development platform"
|
||||
[remote-back]: ../images/remote-back.png "Zolertia RE-Mote development platform"
|
||||
[remote-pinout-front]: ../images/remote-pinout-front.png "RE-Mote pin-out (front)"
|
||||
[remote-pinout-back]: ../images/remote-pinout-back.png "RE-Mote pin-out (back)"
|
@ -32,12 +32,22 @@
|
||||
* \addtogroup remote-antenna
|
||||
* @{
|
||||
*
|
||||
* Driver for the Re-Mote 2.4Ghz antenna switch, to enable either the internal
|
||||
* ceramic antenna or an external one connected to the uFL connector
|
||||
* Driver for the RE-Mote RF switch, to enable either the built-in 2.4GHz RF
|
||||
* interface of the CC2538, or the CC1200 Sub-1GHz RF interface, both routed to
|
||||
* the RP-SMA connector for an external antenna.
|
||||
* When the 2.4GHz RF interface is enabled, the CC1200 is powered down.
|
||||
* When the CC1200 is enabled, alternatively the 2.4GHz can be also used if
|
||||
* placing an 0Ohm resistor (R19), to connect either via a non-mounted chip
|
||||
* antenna, or with an external antenna connected to a non-mounted U.Fl
|
||||
* connector with a pigtail.
|
||||
*
|
||||
* RF switch state:
|
||||
* - LOW: 2.4GHz RF interface on RP-SMA connector, CC1200 powered-off.
|
||||
* - HIGH: Sub-1GHz RF interface on RP-SMA connector.
|
||||
* @{
|
||||
*
|
||||
* \file
|
||||
* Driver for the Re-Mote 2.4Ghz antenna switch
|
||||
* Driver for the RE-Mote RF antenna switch
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#include "contiki.h"
|
||||
@ -46,8 +56,8 @@
|
||||
|
||||
#include <stdint.h>
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#define ANTENNA_2_4GHZ_SW_PORT_BASE GPIO_PORT_TO_BASE(ANTENNA_2_4GHZ_SW_PORT)
|
||||
#define ANTENNA_2_4GHZ_SW_PIN_MASK GPIO_PIN_MASK(ANTENNA_2_4GHZ_SW_PIN)
|
||||
#define ANTENNA_RF_SW_PORT_BASE GPIO_PORT_TO_BASE(ANTENNA_RF_SW_PORT)
|
||||
#define ANTENNA_RF_SW_PIN_MASK GPIO_PIN_MASK(ANTENNA_RF_SW_PIN)
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static uint8_t initialized = 0;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
@ -55,36 +65,51 @@ void
|
||||
antenna_sw_config(void)
|
||||
{
|
||||
/* Software controlled */
|
||||
GPIO_SOFTWARE_CONTROL(ANTENNA_2_4GHZ_SW_PORT_BASE,
|
||||
ANTENNA_2_4GHZ_SW_PIN_MASK);
|
||||
GPIO_SOFTWARE_CONTROL(ANTENNA_RF_SW_PORT_BASE,
|
||||
ANTENNA_RF_SW_PIN_MASK);
|
||||
|
||||
/* Set pin to output */
|
||||
GPIO_SET_OUTPUT(ANTENNA_2_4GHZ_SW_PORT_BASE, ANTENNA_2_4GHZ_SW_PIN_MASK);
|
||||
GPIO_SET_OUTPUT(ANTENNA_RF_SW_PORT_BASE, ANTENNA_RF_SW_PIN_MASK);
|
||||
|
||||
/* Set the antenna selector to a default position */
|
||||
GPIO_CLR_PIN(ANTENNA_2_4GHZ_SW_PORT_BASE, ANTENNA_2_4GHZ_SW_PIN_MASK);
|
||||
GPIO_WRITE_PIN(ANTENNA_RF_SW_PORT_BASE, ANTENNA_RF_SW_PIN_MASK,
|
||||
ANTENNA_SW_SELECT_DEFAULT);
|
||||
|
||||
initialized = 1;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
int
|
||||
antenna_sw_get(void)
|
||||
{
|
||||
if(!initialized) {
|
||||
return ANTENNA_SW_SELECT_ERROR;
|
||||
}
|
||||
|
||||
/* Set the antenna selector */
|
||||
return GPIO_READ_PIN(ANTENNA_RF_SW_PORT_BASE, ANTENNA_RF_SW_PIN_MASK);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
int
|
||||
antenna_sw_select(uint8_t val)
|
||||
{
|
||||
if(!initialized) {
|
||||
return ANTENNA_SW_SELECT_ERROR;
|
||||
}
|
||||
|
||||
if(val != ANTENNA_SW_SELECT_INTERNAL && val != ANTENNA_SW_SELECT_EXTERNAL) {
|
||||
if(val != ANTENNA_SW_SELECT_SUBGHZ && val != ANTENNA_SW_SELECT_2_4GHZ) {
|
||||
return ANTENNA_SW_SELECT_ERROR;
|
||||
}
|
||||
|
||||
if(val & antenna_sw_get()) {
|
||||
return val;
|
||||
}
|
||||
|
||||
/* Set the antenna selector */
|
||||
GPIO_WRITE_PIN(ANTENNA_2_4GHZ_SW_PORT_BASE, ANTENNA_2_4GHZ_SW_PIN_MASK, val);
|
||||
GPIO_WRITE_PIN(ANTENNA_RF_SW_PORT_BASE, ANTENNA_RF_SW_PIN_MASK, val);
|
||||
|
||||
return val;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @}
|
@ -31,14 +31,14 @@
|
||||
* \addtogroup remote
|
||||
* @{
|
||||
*
|
||||
* \defgroup remote-antenna Re-Mote Antenna switch
|
||||
* \defgroup remote-antenna RE-Mote Antenna switch
|
||||
*
|
||||
* Driver for the Re-Mote 2.4Ghz antenna switch, to enable either the internal
|
||||
* Driver for the RE-Mote RF antenna switch, to enable either the internal
|
||||
* ceramic antenna or an external one connected to the uFL connector
|
||||
* @{
|
||||
*
|
||||
* \file
|
||||
* Header file for the Re-Mote 2.4Ghz antenna switch Driver
|
||||
* Header file for the RE-Mote RF antenna switch
|
||||
*/
|
||||
/* -------------------------------------------------------------------------- */
|
||||
#ifndef ANTENNA_SW_H_
|
||||
@ -46,17 +46,16 @@
|
||||
/* -------------------------------------------------------------------------- */
|
||||
#include <stdint.h>
|
||||
/* -------------------------------------------------------------------------- */
|
||||
#define ANTENNA_SW_SELECT_EXTERNAL 0xFF
|
||||
#define ANTENNA_SW_SELECT_INTERNAL 0x00
|
||||
|
||||
#define ANTENNA_SW_SELECT_ERROR -1
|
||||
#define ANTENNA_SW_SELECT_2_4GHZ 0
|
||||
#define ANTENNA_SW_SELECT_SUBGHZ (1 << ANTENNA_RF_SW_PIN)
|
||||
#define ANTENNA_SW_SELECT_ERROR (-1)
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/**
|
||||
* \brief Init function for the antenna switch
|
||||
*
|
||||
* The Re-Mote platform allows to programatically select between the 2.4Ghz
|
||||
* internal or external antenna.
|
||||
* The function is set to enable using the internal ceramic antenna as default,
|
||||
* The RE-Mote platform allows to programatically select between the 2.4GHz
|
||||
* RF interface of the CC2538, or the Sub-1GHz RF interface of the CC1200.
|
||||
* The function is set to enable the Sub-1GHz as default,
|
||||
* it should be called from the contiki-main initialization process.
|
||||
*
|
||||
* \return ignored
|
||||
@ -64,15 +63,24 @@
|
||||
void antenna_sw_config(void);
|
||||
|
||||
/**
|
||||
* \brief Function to select between the internal or external 2.4Ghz antenna
|
||||
* \brief Function to select between the 2.4GHz or Sub-1GHz RF interface
|
||||
*
|
||||
* \param val Select antenna.
|
||||
* External: ANTENNA_SW_SELECT_EXTERNAL or
|
||||
* Internal (ceramic): ANTENNA_SW_SELECT_INTERNAL
|
||||
* 2.4GHz : ANTENNA_SW_SELECT_2_4GHZ or
|
||||
* Sub-1GHz: ANTENNA_SW_SELECT_SUBGHZ
|
||||
* \return the selected antenna position, or ANTENNA_SW_SELECT_ERROR if not
|
||||
* previously configured
|
||||
*/
|
||||
int antenna_sw_select(uint8_t val);
|
||||
|
||||
/**
|
||||
* \brief Function to read the current status of the RF switch
|
||||
*
|
||||
*
|
||||
* \return the selected antenna position, or ANTENNA_SW_SELECT_ERROR if not
|
||||
* previously configured
|
||||
*/
|
||||
int antenna_sw_get(void);
|
||||
/* -------------------------------------------------------------------------- */
|
||||
#endif /* ifndef ANTENNA_SW_H_ */
|
||||
/* -------------------------------------------------------------------------- */
|
61
platform/zoul/remote/board.c
Normal file
@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 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
|
||||
* @{
|
||||
*
|
||||
* \file
|
||||
* Board-initialisation for the Zolertia's RE-Mote platform
|
||||
*
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#include "contiki-conf.h"
|
||||
#include "antenna-sw.h"
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
configure_unused_pins(void)
|
||||
{
|
||||
// FIXME
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
board_init()
|
||||
{
|
||||
antenna_sw_config();
|
||||
configure_unused_pins();
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
431
platform/zoul/remote/board.h
Normal file
@ -0,0 +1,431 @@
|
||||
/*
|
||||
* Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/
|
||||
* Copyright (c) 2015, Zolertia
|
||||
* 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 zoul-platforms
|
||||
* @{
|
||||
*
|
||||
* \defgroup remote RE-Mote platform
|
||||
*
|
||||
* The RE-Mote was designed jointly with universities and industry partners in
|
||||
* RERUM European project, to ease the development of private and secure
|
||||
* applications for IoT and Smart City applications. The RE-Mote packs several
|
||||
* on-board resources, like a RTC, external WDT, Micro-SD, RF switch and a
|
||||
* Shutdown mode to reduce its power consumption down to 300nA.
|
||||
*
|
||||
* 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 Connector headers
|
||||
*
|
||||
* The RE-Mote features two 2.54 mm header rows over which exposes the following
|
||||
* pins (facing up, Zolertia/RERUM logo above, buttons and micro USB at bottom):
|
||||
* ----------------------+---+---+---------------------------------------------
|
||||
* PIN_NAME |JP6|JP5| PIN_NAME
|
||||
* ----------------------+---+---+---------------------------------------------
|
||||
* LED1/EXT_WDT/PD5 |-01|18-| PC6/SPI1.MISO/USD.MISO
|
||||
* LED2/UART1.CTS/PD4 |-02|17-| PC5/SPI1.MOSI/USD.MOSI
|
||||
* LED3/UART1.RTS/PD3 |-03|16-| PC4/SPI1.SCLK/USD.SCLK
|
||||
* UART0.RX/PA0 |-04|15-| PA3/BUTTON.USER
|
||||
* UART0.TX/PA1 |-05|14-| RESET/JTAG.RESET/BUTTON.RESET
|
||||
* SHUTDOWN_ENABLE/PD1 |-06|13-| DGND
|
||||
* RTC.SDA/I2C.SDA/PC2 |-07|12-| D+3.3
|
||||
* RTC.SCL/I2C.SCL/PC3 |-08|11-| PA5/AIN5/ADC1
|
||||
* DGND |-09|10-| PA4/RTC_INT1/AIN4/ADC2
|
||||
* D+3.3 |-10|09-| DGND
|
||||
* USD.CS/AIN7/PA7 |-11|08-| D+5.1
|
||||
* SHUTDOWN_DONE/PD0 |-12|07-| PA2/AIN2/ADC3
|
||||
* UART1.RX/PC1 |-13|06-| JTAG.TMS
|
||||
* UART1.TX/PC0 |-14|05-| JTAG.TCK
|
||||
* DGND |-15|04-| PB7/JTAG.TDO
|
||||
* D+3.3 |-16|03-| PB6/JTAG.TDI
|
||||
* DGND |-17|02-| PS+EXT
|
||||
* +VBAT |-18|01-| DGND
|
||||
* ----------------------+---+---+---------------------------------------------
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** \name RE-Mote LED configuration
|
||||
*
|
||||
* LEDs on the RE-Mote are connected as follows:
|
||||
* - LED1 (Red) -> PD5
|
||||
* - LED2 (Green) -> PD4
|
||||
* - LED3 (Blue) -> PD3
|
||||
*
|
||||
* LED1 pin shared with EXT_WDT and exposed in JP6 connector
|
||||
* LED2 pin shared with UART1 CTS, pin exposed in JP6 connector
|
||||
* LED3 pin shared with UART1 RTS, exposed in JP6 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 << 4) /**< LED1 (Green) -> PD4 */
|
||||
#define LEDS_BLUE (1 << 3) /**< LED2 (Blue) -> PD3 */
|
||||
#define LEDS_RED (1 << 5) /**< LED3 (Red) -> PD5 */
|
||||
|
||||
#define LEDS_CONF_ALL (LEDS_GREEN | LEDS_BLUE | LEDS_RED)
|
||||
|
||||
#define LEDS_LIGHT_BLUE (LEDS_GREEN | LEDS_BLUE) /**< Green + Blue (24) */
|
||||
#define LEDS_YELLOW (LEDS_GREEN | LEDS_RED) /**< Green + Red (48) */
|
||||
#define LEDS_PURPLE (LEDS_BLUE | LEDS_RED) /**< Blue + Red (40) */
|
||||
#define LEDS_WHITE LEDS_ALL /**< Green + Blue + Red (56) */
|
||||
|
||||
/* 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 UARTs are connected to the following ports/pins:
|
||||
*
|
||||
* - UART0:
|
||||
* - RX: PA0, connected to CP2104 serial-to-usb converter TX pin
|
||||
* - TX: PA1, connected to CP2104 serial-to-usb converter RX pin
|
||||
* - UART1:
|
||||
* - RX: PC1
|
||||
* - TX: PC0
|
||||
* - CTS: PD4, shared with LED2 (Green), disabled as default
|
||||
* - RTS: PD3, shared with LED3 (Blue), disabled as default
|
||||
*
|
||||
* We configure the port to use UART0 and UART1, CTS/RTS only for UART1,
|
||||
* both without a HW pull-up resistor
|
||||
* UART0 and UART1 pins are exposed over the JP6 connector
|
||||
* @{
|
||||
*/
|
||||
#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 1
|
||||
#define UART1_TX_PORT GPIO_C_NUM
|
||||
#define UART1_TX_PIN 0
|
||||
#define UART1_CTS_PORT (-1)
|
||||
#define UART1_CTS_PIN (-1)
|
||||
#define UART1_RTS_PORT (-1)
|
||||
#define UART1_RTS_PIN (-1)
|
||||
/** @} */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** \name RE-Mote Button configuration
|
||||
*
|
||||
* Buttons on the RE-Mote are connected as follows:
|
||||
* - BUTTON_USER -> PA3, S1 user button, shared with bootloader and RTC_INT1
|
||||
* - BUTTON_RESET -> RESET_N line, S2 reset both CC2538 and CoP
|
||||
* - BUTTON_PIC1W -> shared with SHUTDOWN_ENABLE, not mounted.
|
||||
* @{
|
||||
*/
|
||||
/** 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/VDD/ADC)
|
||||
*
|
||||
* The RE-Mote allows both 3.3V and 5V analogue sensors as follow:
|
||||
*
|
||||
* - ADC1: up to 3.3V.
|
||||
* - ADC2: up to 3.3V, shared with RTC_INT
|
||||
* - ADC3: up to 5V, by means of a 2/3 voltage divider.
|
||||
*
|
||||
* ADC inputs can only be on port A.
|
||||
* All ADCx are exposed in JP5 connector, but only ADC1 and ADC3 have GND and
|
||||
* VDD (3/5V) pins next to it, so these can be exposed into a 3-pin phidget-like
|
||||
* connector, for ADC2 either solder a wire to connect, or use a 4-pin connector
|
||||
* to expose both ADC1 and ADC2 in a single connector, but this will leave no
|
||||
* space for a ADC3 connector.
|
||||
* The internal ADC reference is 1190mV, use either a voltage divider as input,
|
||||
* or a different voltage reference, like AVDD5 or other externally (AIN7), but
|
||||
* note the PA7 is shared with the Micro-SD CSn pin, likewise for PA6 (AIN6)
|
||||
* shared witht the Micro-SD select pin
|
||||
* To use the ADC2 pin, remove the resistor on the Zoul's PA4 pin (JP1, pin 10)
|
||||
* and enable below (replace -1 with 4).
|
||||
* @{
|
||||
*/
|
||||
#define ADC_SENSORS_PORT GPIO_A_NUM /**< ADC GPIO control port */
|
||||
#define ADC_SENSORS_ADC1_PIN 5 /**< ADC1 to PA5, 3V3 */
|
||||
#define ADC_SENSORS_ADC2_PIN (-1) /**< ADC2 to PA4, 3V3 */
|
||||
#define ADC_SENSORS_ADC3_PIN 2 /**< ADC3 to PA2, 5V0 */
|
||||
/** @} */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \name SPI (SSI0) configuration
|
||||
*
|
||||
* These values configure which CC2538 pins to use for the SPI (SSI0) lines,
|
||||
* reserved exclusively for the CC1200 RF transceiver. These pins are not
|
||||
* exposed to any connector, and should be avoid to use it.
|
||||
* TX -> MOSI, RX -> MISO
|
||||
* @{
|
||||
*/
|
||||
#define SPI0_CLK_PORT GPIO_B_NUM
|
||||
#define SPI0_CLK_PIN 2
|
||||
#define SPI0_TX_PORT GPIO_B_NUM
|
||||
#define SPI0_TX_PIN 1
|
||||
#define SPI0_RX_PORT GPIO_B_NUM
|
||||
#define SPI0_RX_PIN 3
|
||||
/** @} */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \name SPI (SSI1) configuration
|
||||
*
|
||||
* These values configure which CC2538 pins to use for the SPI (SSI1) lines,
|
||||
* shared with the microSD and exposed over JP5 connector.
|
||||
* It is advisable to use a CSn pin other than the Micro-SD's.
|
||||
* TX -> MOSI, RX -> MISO
|
||||
* @{
|
||||
*/
|
||||
#define SPI1_CLK_PORT GPIO_C_NUM
|
||||
#define SPI1_CLK_PIN 4
|
||||
#define SPI1_TX_PORT GPIO_C_NUM
|
||||
#define SPI1_TX_PIN 5
|
||||
#define SPI1_RX_PORT GPIO_C_NUM
|
||||
#define SPI1_RX_PIN 6
|
||||
/** @} */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \name I2C configuration
|
||||
*
|
||||
* These values configure which CC2538 pins to use for the I2C lines, exposed
|
||||
* over JP6 connector, also available as testpoints T2 (PC2) and T3 (PC3).
|
||||
* The I2C bus is shared with the on-board RTC.
|
||||
* @{
|
||||
*/
|
||||
#define I2C_SCL_PORT GPIO_C_NUM
|
||||
#define I2C_SCL_PIN 3
|
||||
#define I2C_SDA_PORT GPIO_C_NUM
|
||||
#define I2C_SDA_PIN 2
|
||||
/** @} */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \name Antenna switch configuration
|
||||
*
|
||||
* These values configure the required pin to drive the RF antenna switch, to
|
||||
* either enable the sub-1Ghz RF interface (power-up the CC1200) or the 2.4GHz
|
||||
* RF interface of the CC2538, both alternatively routed to a RP-SMA connector
|
||||
* to allow using an external antenna for both cases.
|
||||
*
|
||||
* Note it is also possible to enable both RF interfaces at the same time, by
|
||||
* switching On the sub-1GHz RF interface, and placing an 0Ohm resistor (R19),
|
||||
* to select between using a ceramic chip antenna (not mounted), or to connect
|
||||
* and external antenna over a pigtail to the U.Fl connector (not mounted).
|
||||
*
|
||||
* RF switch state:
|
||||
* - LOW: 2.4GHz RF interface on RP-SMA connector, CC1200 powered-off.
|
||||
* - HIGH: Sub-1GHz RF interface on RP-SMA connector.
|
||||
* @{
|
||||
*/
|
||||
#define ANTENNA_RF_SW_PORT GPIO_D_NUM
|
||||
#define ANTENNA_RF_SW_PIN 2
|
||||
/** @} */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \name Dual RF interface support
|
||||
*
|
||||
* Enables support for dual band operation (both CC1200 and 2.4GHz enabled).
|
||||
* The driver checks the selected Radio stack, and forces the antenna switch to
|
||||
* either position. Enabling the definition below forces to skip this check.
|
||||
* @{
|
||||
*/
|
||||
#define REMOTE_DUAL_RF_ENABLED 0
|
||||
/** @} */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \name CC1200 configuration
|
||||
*
|
||||
* These values configure the required pins to drive the CC1200
|
||||
* None of the following pins are exposed to any connector, kept for internal
|
||||
* use only
|
||||
* @{
|
||||
*/
|
||||
#define CC1200_SPI_INSTANCE 0
|
||||
#define CC1200_SPI_SCLK_PORT SPI0_CLK_PORT
|
||||
#define CC1200_SPI_SCLK_PIN SPI0_CLK_PIN
|
||||
#define CC1200_SPI_MOSI_PORT SPI0_TX_PORT
|
||||
#define CC1200_SPI_MOSI_PIN SPI0_TX_PIN
|
||||
#define CC1200_SPI_MISO_PORT SPI0_RX_PORT
|
||||
#define CC1200_SPI_MISO_PIN SPI0_RX_PIN
|
||||
#define CC1200_SPI_CSN_PORT GPIO_B_NUM
|
||||
#define CC1200_SPI_CSN_PIN 5
|
||||
#define CC1200_GDO0_PORT GPIO_B_NUM
|
||||
#define CC1200_GDO0_PIN 4
|
||||
#define CC1200_GDO2_PORT GPIO_B_NUM
|
||||
#define CC1200_GDO2_PIN 0
|
||||
#define CC1200_RESET_PORT GPIO_C_NUM
|
||||
#define CC1200_RESET_PIN 7
|
||||
#define CC1200_GPIOx_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
|
||||
#define USD_CSN_PORT GPIO_A_NUM
|
||||
#define USD_CSN_PIN 7
|
||||
#define USD_SEL_PORT GPIO_A_NUM
|
||||
#define USD_SEL_PIN 6
|
||||
/** @} */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \name Shutdown Mode
|
||||
*
|
||||
* The shutdown mode is an ultra-low power operation mode that effectively
|
||||
* powers-down the entire RE-Mote (CC2538, CC1200, attached sensors, etc) and
|
||||
* only keeps running a power gating timer (NanoTimer), the on-board RTC and
|
||||
* an ultra-low power consumption MCU (PIC12F635). The Shutdown mode allows:
|
||||
*
|
||||
* - Put the RE-Mote in an ultra-low power sleep (shutdown) drawing 350nA avg.
|
||||
* - Periodically awake and execute tasks, being the shutdown period selectable
|
||||
* via R47 resistor value (22KOhm as default for 1 minute shutdown period).
|
||||
* - Enter shutdown mode before the shutdown period expiration, by sending a
|
||||
* pulse to SHUTDOWN_DONE.
|
||||
*
|
||||
* To enable or disable the shutdown mode a well-known sequence has to be sent
|
||||
* to the PIC12F635 via its 1-Wire pin, when the shutdown mode is enabled,
|
||||
* confirmation is done by the PIC echoing-back the command to the CC2538.
|
||||
*
|
||||
* The shutdown mode can be disabled by hardware by short-circuiting or placing
|
||||
* an 0Ohm resistor across W1 pad.
|
||||
* @{
|
||||
*/
|
||||
#define SHUTDOWN_DONE_PORT GPIO_D_NUM
|
||||
#define SHUTDOWN_DONE_PIN 0
|
||||
#define SHUTDOWN_ENABLE_PORT GPIO_D_NUM
|
||||
#define SHUTDOWN_ENABLE_PIN 1
|
||||
/** @} */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \name On-board RTC
|
||||
*
|
||||
* The Abracon AB0805 RTC is used by both the
|
||||
* The shutdown mode can be disabled by hardware by short-circuiting or placing
|
||||
* an 0Ohm resistor across W1 pad. As the RTC_INT1 pin is also shared with the
|
||||
* BUTTON_USER, so either disable or not use the user button, or upon receiving
|
||||
* an interrupt, poll the RTC.
|
||||
*
|
||||
* The RTC_INT1 can be used to exit the CC2538's LPM3 mode.
|
||||
* A second interruption pin is connected to the PIC12F635, for applications
|
||||
* requiring to put the PIC into deep-sleep and waking up at a certain time.
|
||||
* @{
|
||||
*/
|
||||
#define RTC_SDA_PORT I2C_SDA_PORT
|
||||
#define RTC_SDA_PIN I2C_SDA_PIN
|
||||
#define RTC_SCL_PORT I2C_SCL_PORT
|
||||
#define RTC_SCL_PIN I2C_SCL_PIN
|
||||
#define RTC_INT1_PORT GPIO_A_NUM
|
||||
#define RTC_INT1_PIN 4
|
||||
#define RTC_INT1_VECTOR NVIC_INT_GPIO_PORT_A
|
||||
/** @} */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \name On-board external WDT
|
||||
* The RE-Mote features an on-board external WDT and battery monitor, which
|
||||
* adds more robustness and prevents the mote to run wild if any unexpected
|
||||
* problem shows-up.
|
||||
* The external WDT requires a short pulse (<1ms) to be sent before a 2-second
|
||||
* period. The battery monitor keeps the device in Reset if the voltage input
|
||||
* is lower than 2.5V.
|
||||
* The external WDT can be disabled by removing the R40 0Ohm resistor.
|
||||
* The EXT_WDT pin is shared with LED1 (Red). For long-time operation, it is
|
||||
* advised to remove R14 resistor to disable LED1.
|
||||
* As default the Texas Instrument's TPS3823 WDT is not mounted.
|
||||
* @{
|
||||
*/
|
||||
#define EXT_WDT_PORT GPIO_D_NUM
|
||||
#define EXT_WDT_PIN 5
|
||||
/** @} */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \name Device string used on startup
|
||||
* @{
|
||||
*/
|
||||
#define BOARD_STRING "Zolertia RE-Mote platform"
|
||||
/** @} */
|
||||
|
||||
#endif /* BOARD_H_ */
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
*/
|
64
platform/zoul/zolertia-zoul-cdc-acm.inf
Executable file
@ -0,0 +1,64 @@
|
||||
; Windows LUFA CDC ACM Setup File
|
||||
; Copyright (c) 2000 Microsoft Corporation
|
||||
|
||||
[DefaultInstall]
|
||||
CopyINF="zolertia-zoul-cdc-acm.inf"
|
||||
|
||||
[Version]
|
||||
Signature="$Windows NT$"
|
||||
Class=Ports
|
||||
ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318}
|
||||
Provider=%MFGNAME%
|
||||
DriverVer=7/1/2012,10.0.0.0
|
||||
|
||||
[Manufacturer]
|
||||
%MFGNAME%=DeviceList, NTx86, NTamd64, NTia64
|
||||
|
||||
[SourceDisksNames]
|
||||
|
||||
[SourceDisksFiles]
|
||||
|
||||
[DestinationDirs]
|
||||
DefaultDestDir=12
|
||||
|
||||
[DriverInstall]
|
||||
Include=mdmcpq.inf
|
||||
CopyFiles=FakeModemCopyFileSection
|
||||
AddReg=DriverInstall.AddReg
|
||||
|
||||
[DriverInstall.Services]
|
||||
Include=mdmcpq.inf
|
||||
AddService=usbser, 0x00000002, LowerFilter_Service_Inst
|
||||
|
||||
[DriverInstall.AddReg]
|
||||
HKR,,EnumPropPages32,,"msports.dll,SerialPortPropPageProvider"
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; Vendor and Product ID Definitions
|
||||
;------------------------------------------------------------------------------
|
||||
; When developing your USB device, the VID and PID used in the PC side
|
||||
; application program and the firmware on the microcontroller must match.
|
||||
; Modify the below line to use your VID and PID. Use the format as shown below.
|
||||
; Note: One INF file can be used for multiple devices with different VID and PIDs.
|
||||
; For each supported device, append ",USB\VID_xxxx&PID_yyyy" to the end of the line.
|
||||
;------------------------------------------------------------------------------
|
||||
[DeviceList]
|
||||
%DESCRIPTION%=DriverInstall, USB\VID_0451&PID_16C8
|
||||
|
||||
[DeviceList.NTx86]
|
||||
%DESCRIPTION%=DriverInstall, USB\VID_0451&PID_16C8
|
||||
|
||||
[DeviceList.NTamd64]
|
||||
%DESCRIPTION%=DriverInstall, USB\VID_0451&PID_16C8
|
||||
|
||||
[DeviceList.NTia64]
|
||||
%DESCRIPTION%=DriverInstall, USB\VID_0451&PID_16C8
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; String Definitions
|
||||
;------------------------------------------------------------------------------
|
||||
;Modify these strings to customize your device
|
||||
;------------------------------------------------------------------------------
|
||||
[Strings]
|
||||
MFGNAME="http://zolertia.io"
|
||||
DESCRIPTION="Zolertia Zoul Virtual COM Port"
|
@ -7,6 +7,7 @@ ipv6/rpl-border-router/ev-aducrf101mkxz \
|
||||
webserver-ipv6/ev-aducrf101mkxz \
|
||||
ipv6/multicast/ev-aducrf101mkxz \
|
||||
cc2538dk/sniffer/ev-aducrf101mkxz \
|
||||
|
||||
cc26xx/cc26xx-web-demo/srf06-cc26xx \
|
||||
cc26xx/very-sleepy-demo/srf06-cc26xx \
|
||||
hello-world/cc2538dk \
|
||||
@ -19,6 +20,12 @@ cc2538dk/sniffer/cc2538dk \
|
||||
cc2538dk/mqtt-demo/cc2538dk \
|
||||
ipv6/multicast/cc2538dk \
|
||||
|
||||
zolertia/zoul \
|
||||
zolertia/zoul/cc1200-demo/zoul \
|
||||
er-rest-example/zoul \
|
||||
hello-world/zoul \
|
||||
cc2538dk/mqtt-demo/zoul \
|
||||
|
||||
TOOLS=
|
||||
|
||||
include ../Makefile.compile-test
|
||||
|
@ -17,11 +17,13 @@ options:
|
||||
-m method to scan usb: procfs, sysfs, auto (default)
|
||||
-dev_prefix force the device prefix for the serial device
|
||||
-usb display extra usb information
|
||||
-b specify which Zolertia board to list (z1, remote, etc)
|
||||
EOF
|
||||
|
||||
my %Opt = (
|
||||
compact => 0,
|
||||
usb => 0,
|
||||
board => "",
|
||||
method => "auto",
|
||||
kernel => "auto",
|
||||
dev_prefix => [ "/dev/usb/tts/", "/dev/ttyUSB", "/dev/tts/USB" ],
|
||||
@ -38,6 +40,7 @@ while (@ARGV) {
|
||||
elsif( $opt eq "-m" ) { $Opt{method} = shift @ARGV; }
|
||||
elsif( $opt eq "-dev_prefix" ) { $Opt{dev_prefix} = shift @ARGV; }
|
||||
elsif( $opt eq "-usb" ) { $Opt{usb} = 1; }
|
||||
elsif( $opt eq "-b" ) { $Opt{board} = shift @ARGV; }
|
||||
else { print STDERR "$help\nerror, unknown command line option $opt\n"; exit 1; }
|
||||
}
|
||||
|
||||
@ -50,6 +53,12 @@ if( $Opt{method} eq "auto" ) {
|
||||
$Opt{method} = ($Opt{kernel} eq "2.4") ? "procfs" : "sysfs";
|
||||
}
|
||||
|
||||
if( $Opt{board} eq "z1" ) {
|
||||
$Opt{board} = "Zolertia Z1";
|
||||
} elsif( $Opt{board} eq "remote" ) {
|
||||
$Opt{board} = "Zolertia RE-Mote platform";
|
||||
}
|
||||
|
||||
my @devs = $Opt{method} eq "procfs" ? scan_procfs() : scan_sysfs();
|
||||
print_motelist( sort { cmp_usbdev($a,$b) } @devs );
|
||||
|
||||
@ -59,24 +68,29 @@ print_motelist( sort { cmp_usbdev($a,$b) } @devs );
|
||||
#
|
||||
sub scan_sysfs {
|
||||
|
||||
# Scan /sys/bus/usb/drivers/usb for FTDI devices
|
||||
my @ftdidevs =
|
||||
grep { ($_->{UsbVendor}||"") eq "10c4" && ($_->{UsbProduct}||"") eq "ea60" && ($_->{ProductString}||"") eq "Zolertia Z1" }
|
||||
my $tmp = '($_->{UsbVendor}||"") eq "10c4" && ($_->{UsbProduct}||"") eq "ea60"';
|
||||
|
||||
if($Opt{board}) {
|
||||
$tmp = '($_->{ProductString}||"") eq $Opt{board} && ' . $tmp
|
||||
}
|
||||
|
||||
# Scan /sys/bus/usb/drivers/usb for CP210x devices
|
||||
my @cpdevs =
|
||||
grep { eval "$tmp" }
|
||||
map { {
|
||||
SysPath => $_,
|
||||
UsbVendor => snarf("$_/idVendor",1),
|
||||
UsbProduct => snarf("$_/idProduct",1),
|
||||
ProductString => snarf("$_/product",1),
|
||||
} }
|
||||
glob("/sys/bus/usb/drivers/usb/*");
|
||||
glob("/sys/bus/usb/drivers/usb/*");
|
||||
|
||||
# Gather information about each FTDI device
|
||||
for my $f (@ftdidevs) {
|
||||
# Gather information about each CP210x device
|
||||
for my $f (@cpdevs) {
|
||||
my $syspath = $f->{SysPath};
|
||||
|
||||
$f->{InfoSerial} = snarf("$syspath/serial",1);
|
||||
$f->{InfoManufacturer} = snarf("$syspath/manufacturer",1);
|
||||
$f->{InfoProduct} = snarf("$syspath/product",1);
|
||||
$f->{InfoSerial} = snarf("$syspath/serial",1);
|
||||
$f->{UsbDevNum} = snarf("$syspath/devnum",1);
|
||||
|
||||
my $devstr = readlink($syspath);
|
||||
@ -92,8 +106,7 @@ sub scan_sysfs {
|
||||
$f->{SerialDevNum} = $1 if $f->{SerialDevName} =~ /(\d+)/;
|
||||
$f->{SerialDevName} = getSerialDevName( $f->{SerialDevNum} ) || " (none)";
|
||||
}
|
||||
|
||||
return @ftdidevs;
|
||||
return @cpdevs;
|
||||
}
|
||||
|
||||
|
||||
@ -113,7 +126,7 @@ sub scan_procfs {
|
||||
$usbtree{usbkey($tts->{path})}{usbserial} = $tts if defined $tts->{path};
|
||||
}
|
||||
|
||||
my @ftdidevs = map { {
|
||||
my @cpdevs = map { {
|
||||
UsbVendor => $_->{Vendor},
|
||||
UsbProduct => $_->{ProdID},
|
||||
InfoManufacturer => $_->{Manufacturer},
|
||||
@ -129,7 +142,7 @@ sub scan_procfs {
|
||||
grep { ($_->{Vendor}||"") eq "0403" && ($_->{ProdID}||"") eq "6001" }
|
||||
values %usbtree;
|
||||
|
||||
return @ftdidevs;
|
||||
return @cpdevs;
|
||||
}
|
||||
|
||||
sub build_usb_tree {
|
||||
@ -223,13 +236,15 @@ sub print_motelist {
|
||||
if( !$Opt{compact} ) {
|
||||
if( $Opt{usb} ) {
|
||||
print << "EOF" unless $Opt{compact};
|
||||
Bus Dev USB Path Reference Device Description
|
||||
--- --- ------------------------ ---------- ---------------- -------------------------------------
|
||||
--- --- ------------------------ -------------- ---------------- -------------------------------------
|
||||
Bus Dev USB Path Reference Device Description
|
||||
--- --- ------------------------ -------------- ---------------- -------------------------------------
|
||||
EOF
|
||||
} else {
|
||||
print << "EOF" unless $Opt{compact};
|
||||
Reference Device Description
|
||||
---------- ---------------- ---------------------------------------------
|
||||
-------------- ---------------- ---------------------------------------------
|
||||
Reference Device Description
|
||||
-------------- ---------------- ---------------------------------------------
|
||||
EOF
|
||||
}
|
||||
}
|
||||
@ -242,7 +257,7 @@ EOF
|
||||
if( $Opt{compact} ) {
|
||||
print join(",",@output) . "\n";
|
||||
} else {
|
||||
printf( ($Opt{usb}?"%3d %3d %-24s ":"")."%-10s %-16s %s\n", @output );
|
||||
printf( ($Opt{usb}?"%3d %3d %-24s ":"")."%-14s %-16s %s\n", @output );
|
||||
}
|
||||
}
|
||||
}
|