Adding the avr-rss2 platform based on AtMega256RFR2
This commit is contained in:
parent
d3980668ee
commit
ce8e87d60e
91 changed files with 9349 additions and 0 deletions
|
@ -0,0 +1,25 @@
|
|||
|
||||
# Atmega256RFR2 @ 20C, UNT-61E, RSS2 Mote 2015-12-30
|
||||
# TX-PWR RPC=0x0 vs RPC=0xFF. Current mA
|
||||
#
|
||||
15 14.6 11.8
|
||||
14 15.0 12.1
|
||||
13 15.3 12.5
|
||||
12 15.6 12.8
|
||||
11 15.9 13.1
|
||||
10 16.1 13.4
|
||||
9 16.3 13.7
|
||||
8 16.5 13.8
|
||||
7 16.7 13.9
|
||||
6 16.9 14.0
|
||||
5 17.0 14.2
|
||||
4 17.2 14.3
|
||||
3 17.2 14.5
|
||||
2 17.2 14.6
|
||||
1 17.3 14.6
|
||||
0 17.4 14.5
|
||||
RX 13.7 7.3
|
||||
IDLE 0 0
|
||||
|
||||
|
||||
|
9
platform/avr-rss2/examples/avr_radio_power/Makefile
Normal file
9
platform/avr-rss2/examples/avr_radio_power/Makefile
Normal file
|
@ -0,0 +1,9 @@
|
|||
CFLAGS += -DPROJECT_CONF_H=\"project-conf.h\"
|
||||
|
||||
CONTIKI_PROJECT = avr_radio_power
|
||||
APPS+=powertrace
|
||||
all: $(CONTIKI_PROJECT)
|
||||
|
||||
CONTIKI = ../../../..
|
||||
CONTIKI_WITH_RIME = 1
|
||||
include $(CONTIKI)/Makefile.include
|
79
platform/avr-rss2/examples/avr_radio_power/README.md
Normal file
79
platform/avr-rss2/examples/avr_radio_power/README.md
Normal file
|
@ -0,0 +1,79 @@
|
|||
avr_radio_power
|
||||
===============
|
||||
|
||||
Motivation
|
||||
-----------
|
||||
Spins over different radio seting for the Atmel radio. The motivation is to
|
||||
get understanding and also to get correct data for avrora and Contiki
|
||||
simulations. Program loops over different TX-power setting and measures
|
||||
RX consumption also radio off and idle power use in SLEEP_MODE_PWR_SAVE is
|
||||
measured. Program disables radio duty cycling (RDC) and sets MCU in deep
|
||||
sleep mode to only get radio consumption.
|
||||
|
||||
Usage
|
||||
-----
|
||||
The different setting is printed on the terminal. You need a way to measure
|
||||
the current consumption and relate to the tests.
|
||||
|
||||
Example
|
||||
-------
|
||||
Program printout with added measurements. The used board was RSS2 mote
|
||||
with a AtMega256RFR2 CPU. Max is when 0xFF is written to the RPC register.
|
||||
|
||||
|
||||
Run/setup Current use
|
||||
------------------------------------------------
|
||||
TX with PWR=0 RPC=0x00 17.80 mA (MAX TX-pwr)
|
||||
TX with PWR=1 RPC=0x00 17.74
|
||||
TX with PWR=2 RPC=0x00
|
||||
TX with PWR=3 RPC=0x00
|
||||
TX with PWR=4 RPC=0x00
|
||||
TX with PWR=5 RPC=0x00 17.43
|
||||
TX with PWR=6 RPC=0x00
|
||||
TX with PWR=7 RPC=0x00
|
||||
TX with PWR=8 RPC=0x00
|
||||
TX with PWR=9 RPC=0x00 17.68
|
||||
TX with PWR=10 RPC=0x00
|
||||
TX with PWR=11 RPC=0x00
|
||||
TX with PWR=12 RPC=0x00
|
||||
TX with PWR=13 RPC=0x00
|
||||
TX with PWR=14 RPC=0x00
|
||||
TX with PWR=15 RPC=0x00
|
||||
RX with RPC=0x00 -------------------- 13.43 (RX)
|
||||
|
||||
-------------------------------------------------
|
||||
TX with PWR=0 RPC=0xff 14.63 mA (MAX TX-pwr)
|
||||
TX with PWR=1 RPC=0xff
|
||||
TX with PWR=2 RPC=0xff
|
||||
TX with PWR=3 RPC=0xff
|
||||
TX with PWR=4 RPC=0xff
|
||||
TX with PWR=5 RPC=0xff
|
||||
TX with PWR=6 RPC=0xff 14.45
|
||||
TX with PWR=7 RPC=0xff
|
||||
TX with PWR=8 RPC=0xff
|
||||
TX with PWR=9 RPC=0xff
|
||||
TX with PWR=10 RPC=0xff
|
||||
TX with PWR=11 RPC=0xff
|
||||
TX with PWR=12 RPC=0xff
|
||||
TX with PWR=13 RPC=0xff
|
||||
TX with PWR=14 RPC=0xff
|
||||
TX with PWR=15 RPC=0xff
|
||||
RX with RPC=0xFF -------------------- 7.11 (RX)
|
||||
|
||||
RX radio off 0.001 mA
|
||||
|
||||
|
||||
Comments
|
||||
--------
|
||||
We see TX consumption decreases from 17.80 to 14.63 mA using Max RPC (0xFF).
|
||||
NOTE! For RX 13.43 to 7.11 mA. Nice. This actual measurements.
|
||||
The avr-rss2 port adds support for the AtMegaXXXRFR2 including the new RPC
|
||||
function.
|
||||
|
||||
|
||||
References
|
||||
----------
|
||||
Atmel application note. AT02594: Smart Reduced Power Consumption Techniques
|
||||
[Here] (http://www.atmel.com/images/atmel-42356-smart-reduced-power-consumption-techniques_applicationnote_at02594.pdf)
|
||||
|
||||
Multimeter UNI-T UT61E with USB-logging.
|
164
platform/avr-rss2/examples/avr_radio_power/avr_radio_power.c
Normal file
164
platform/avr-rss2/examples/avr_radio_power/avr_radio_power.c
Normal file
|
@ -0,0 +1,164 @@
|
|||
/*
|
||||
* Copyright (c) 2015, Copyright Robert Olsson / Radio Sensors AB
|
||||
* 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 Institute 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 INSTITUTE 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 INSTITUTE 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.
|
||||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*
|
||||
*
|
||||
* Author : Robert Olsson robert@radio-sensors.com
|
||||
* Created : 2015-12-30
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file
|
||||
* An application for monitoring current use on Atmel
|
||||
* radios also supporting the RPC function on RFR2 chips.
|
||||
* Current needs to be measured with amp-meter.
|
||||
*/
|
||||
|
||||
#include "contiki.h"
|
||||
#include "net/rime/rime.h"
|
||||
#include "powertrace.h"
|
||||
#include <stdio.h>
|
||||
#include "dev/leds.h"
|
||||
#include "rf230bb.h"
|
||||
#include "net/packetbuf.h"
|
||||
#include "net/rime/rimestats.h"
|
||||
#include "net/netstack.h"
|
||||
#include <avr/sleep.h>
|
||||
#include <dev/watchdog.h>
|
||||
|
||||
#define TEST_PERIOD 6
|
||||
|
||||
static int ps = 0; /* Power-save false */
|
||||
static char buf[110];
|
||||
static struct etimer et;
|
||||
|
||||
PROCESS(power_use_process, "Power use test");
|
||||
PROCESS(sleep_process, "Sleep process");
|
||||
AUTOSTART_PROCESSES(&power_use_process, &sleep_process);
|
||||
|
||||
static void
|
||||
broadcast_recv(struct broadcast_conn *c, const linkaddr_t *from)
|
||||
{
|
||||
printf("broadcast message received from %d.%d: '%s'\n",
|
||||
from->u8[0], from->u8[1], (char *)packetbuf_dataptr());
|
||||
}
|
||||
|
||||
static const struct broadcast_callbacks broadcast_call = {broadcast_recv};
|
||||
static struct broadcast_conn broadcast;
|
||||
|
||||
|
||||
PROCESS_THREAD(power_use_process, ev, data)
|
||||
{
|
||||
static int i, j;
|
||||
PROCESS_EXITHANDLER(broadcast_close(&broadcast);)
|
||||
PROCESS_BEGIN();
|
||||
|
||||
/* powertrace_start(CLOCK_SECOND * 2); */
|
||||
broadcast_open(&broadcast, 129, &broadcast_call);
|
||||
leds_init();
|
||||
rf230_set_channel(25);
|
||||
|
||||
for(i=0; i < 2; i++) { /* Loop over min and max rpc settings */
|
||||
|
||||
NETSTACK_RADIO.off(); /* Radio off for rpc change */
|
||||
NETSTACK_RADIO.off();
|
||||
etimer_set(&et, CLOCK_SECOND * 8);
|
||||
PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et));
|
||||
if(i == 0)
|
||||
rf230_set_rpc(0x0); /* Disbable all RPC features */
|
||||
else
|
||||
rf230_set_rpc(0xFF); /* Enable all RPC features. Only XRFR2 radios */
|
||||
NETSTACK_RADIO.on();
|
||||
|
||||
/* Loop over the different TX power settings 0-15 */
|
||||
|
||||
for(j=15; j >= 0; j--) {
|
||||
NETSTACK_RADIO.on();
|
||||
rf230_set_txpower(j);
|
||||
ps = 0;
|
||||
printf("TX with PWR=%d RPC=0x%02x\n", rf230_get_txpower(), rf230_get_rpc());
|
||||
ps = 1;
|
||||
|
||||
etimer_set(&et, CLOCK_SECOND * TEST_PERIOD);
|
||||
|
||||
while(1) {
|
||||
if(etimer_expired(&et))
|
||||
break;
|
||||
packetbuf_copyfrom(buf, sizeof(buf)); /* Dummy data */
|
||||
broadcast_send(&broadcast);
|
||||
PROCESS_PAUSE();
|
||||
//leds_on(LEDS_RED);
|
||||
}
|
||||
/* Barrier so we can see next run */
|
||||
NETSTACK_RADIO.off();
|
||||
etimer_set(&et, CLOCK_SECOND * TEST_PERIOD);
|
||||
PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et));
|
||||
}
|
||||
|
||||
/* RX */
|
||||
NETSTACK_RADIO.on();
|
||||
ps = 0;
|
||||
printf("RX radio on RPC=0x%02x\n", rf230_get_rpc());
|
||||
ps = 1;
|
||||
etimer_set(&et, CLOCK_SECOND * TEST_PERIOD);
|
||||
PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et));
|
||||
NETSTACK_RADIO.off();
|
||||
}
|
||||
|
||||
/* Last just RX OFF*/
|
||||
ps = 0;
|
||||
printf("RX radio off\n");
|
||||
ps = 1;
|
||||
etimer_set(&et, CLOCK_SECOND * TEST_PERIOD);
|
||||
PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et));
|
||||
|
||||
PROCESS_END();
|
||||
}
|
||||
|
||||
/* Sleep process is just put MCU in sleep so we minimiza MCU impact */
|
||||
PROCESS_THREAD(sleep_process, ev, data)
|
||||
{
|
||||
PROCESS_BEGIN();
|
||||
while(1) {
|
||||
watchdog_periodic();
|
||||
if(ps)
|
||||
set_sleep_mode(SLEEP_MODE_PWR_SAVE);
|
||||
else
|
||||
set_sleep_mode(SLEEP_MODE_IDLE);
|
||||
cli();
|
||||
sleep_enable();
|
||||
sei();
|
||||
sleep_cpu();
|
||||
sleep_disable();
|
||||
sei();
|
||||
PROCESS_PAUSE();
|
||||
}
|
||||
PROCESS_END();
|
||||
}
|
||||
|
51
platform/avr-rss2/examples/avr_radio_power/project-conf.h
Normal file
51
platform/avr-rss2/examples/avr_radio_power/project-conf.h
Normal file
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright (c) 2015, Copyright Robert Olsson / Radio Sensors AB
|
||||
* 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 Institute 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 INSTITUTE 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 INSTITUTE 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.
|
||||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*
|
||||
*
|
||||
* Author : Robert Olsson robert@radio-sensors.com
|
||||
* Created : 2015-11-22
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file
|
||||
* Project specific configuration defines for example
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef PROJECT_CONF_H_
|
||||
#define PROJECT_CONF_H_
|
||||
|
||||
#define NETSTACK_CONF_RDC nullrdc_driver
|
||||
#define NETSTACK_CONF_MAC nullmac_driver
|
||||
|
||||
//#define NETSTACK_CONF_MAC csma_driver
|
||||
//#define NETSTACK_CONF_RDC contikimac_driver
|
||||
|
||||
#endif /* PROJECT_CONF_H_ */
|
Loading…
Add table
Add a link
Reference in a new issue