From 324d03b53c9ebc9cd642eefc15221b246cb3871e Mon Sep 17 00:00:00 2001 From: Billy Kozak Date: Mon, 14 Sep 2015 13:18:01 -0600 Subject: [PATCH 1/3] CC26xx - fully shutdown the rf-core & abort rx op Prior to this patch, the ieee radio driver did not explicitly abort the rx operation or power down the analog components of the radio prior to shutting down the rf-core. The result of this was that the rf-core continued to use a lot of power even while "off". This patch fixes this problem. --- cpu/cc26xx-cc13xx/rf-core/ieee-mode.c | 2 ++ cpu/cc26xx-cc13xx/rf-core/rf-core.c | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/cpu/cc26xx-cc13xx/rf-core/ieee-mode.c b/cpu/cc26xx-cc13xx/rf-core/ieee-mode.c index b5b5cf4c1..999160de7 100644 --- a/cpu/cc26xx-cc13xx/rf-core/ieee-mode.c +++ b/cpu/cc26xx-cc13xx/rf-core/ieee-mode.c @@ -1101,6 +1101,8 @@ off(void) while(transmitting()); + /* stopping the rx explicitly results in lower sleep-mode power usage */ + rx_off(); rf_core_power_down(); /* Switch HF clock source to the RCOSC to preserve power */ diff --git a/cpu/cc26xx-cc13xx/rf-core/rf-core.c b/cpu/cc26xx-cc13xx/rf-core/rf-core.c index 45387ab42..b511ba6dd 100644 --- a/cpu/cc26xx-cc13xx/rf-core/rf-core.c +++ b/cpu/cc26xx-cc13xx/rf-core/rf-core.c @@ -201,6 +201,28 @@ rf_core_wait_cmd_done(void *cmd) == RF_CORE_RADIO_OP_STATUS_DONE_OK; } /*---------------------------------------------------------------------------*/ +static int +fs_powerdown(void) +{ + rfc_CMD_FS_POWERDOWN_t cmd; + uint32_t cmd_status; + + rf_core_init_radio_op((rfc_radioOp_t *)&cmd, sizeof(cmd), CMD_FS_POWERDOWN); + + if(rf_core_send_cmd((uint32_t)&cmd, &cmd_status) != RF_CORE_CMD_OK) { + PRINTF("fs_powerdown: CMDSTA=0x%08lx\n", cmd_status); + return RF_CORE_CMD_ERROR; + } + + if(rf_core_wait_cmd_done(&cmd) != RF_CORE_CMD_OK) { + PRINTF("fs_powerdown: CMDSTA=0x%08lx, status=0x%04x\n", + cmd_status, cmd.status); + return RF_CORE_CMD_ERROR; + } + + return RF_CORE_CMD_OK; +} +/*---------------------------------------------------------------------------*/ int rf_core_power_up() { @@ -256,6 +278,9 @@ rf_core_power_down() if(rf_core_is_accessible()) { HWREG(RFC_DBELL_NONBUF_BASE + RFC_DBELL_O_RFCPEIFG) = 0x0; HWREG(RFC_DBELL_NONBUF_BASE + RFC_DBELL_O_RFCPEIEN) = 0x0; + + /* need to send FS_POWERDOWN or analog components will use power */ + fs_powerdown(); } /* Shut down the RFCORE clock domain in the MCU VD */ From 54648591eeea46d4f77c53cc819593dedd3f2558 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Sun, 1 Nov 2015 22:53:35 +0000 Subject: [PATCH 2/3] Explicitly send CMD_ABORT in prop mode before powering down --- cpu/cc26xx-cc13xx/rf-core/prop-mode.c | 1 + 1 file changed, 1 insertion(+) diff --git a/cpu/cc26xx-cc13xx/rf-core/prop-mode.c b/cpu/cc26xx-cc13xx/rf-core/prop-mode.c index a26213f83..0a7c4692f 100644 --- a/cpu/cc26xx-cc13xx/rf-core/prop-mode.c +++ b/cpu/cc26xx-cc13xx/rf-core/prop-mode.c @@ -968,6 +968,7 @@ off(void) return RF_CORE_CMD_OK; } + rx_off_prop(); rf_core_power_down(); /* Switch HF clock source to the RCOSC to preserve power */ From 984b8cd631fb3a70c7eb628549a3dc2d3b6e3a8e Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Sun, 1 Nov 2015 23:18:42 +0000 Subject: [PATCH 3/3] Configure ContikiMAC timings for CC13xx sub-ghz operation This is required so that ContikiMAC will keep working correctly after the recent change that also turns off the RF analog part during duty cycling. --- platform/srf06-cc26xx/contiki-conf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/srf06-cc26xx/contiki-conf.h b/platform/srf06-cc26xx/contiki-conf.h index e9fc7458b..79c1d479a 100644 --- a/platform/srf06-cc26xx/contiki-conf.h +++ b/platform/srf06-cc26xx/contiki-conf.h @@ -98,7 +98,7 @@ #define CONTIKIMAC_CONF_LISTEN_TIME_AFTER_PACKET_DETECTED (RTIMER_ARCH_SECOND / 20) #define CONTIKIMAC_CONF_SEND_SW_ACK 1 #define CONTIKIMAC_CONF_AFTER_ACK_DETECTECT_WAIT_TIME (RTIMER_SECOND / 1000) -#define CONTIKIMAC_CONF_INTER_PACKET_INTERVAL (RTIMER_SECOND / 280) +#define CONTIKIMAC_CONF_INTER_PACKET_INTERVAL (RTIMER_SECOND / 250) #else #define NETSTACK_CONF_RADIO ieee_mode_driver