Clean up setting channel and CCA-threshold for CC2420 based motes.
The CCA-threshold now defaults to -46 which give better simulation results and typically also better experimental results. This adjustment is also needed due to commit 0a13f99 in mspsim. As promised in https://github.com/mspsim/mspsim/pull/18 it broke the regression tests.
This commit is contained in:
parent
c89e827d6c
commit
c67c048cac
9 changed files with 69 additions and 43 deletions
|
@ -60,6 +60,15 @@
|
||||||
#define CC2420_CONF_CHECKSUM 0
|
#define CC2420_CONF_CHECKSUM 0
|
||||||
#endif /* CC2420_CONF_CHECKSUM */
|
#endif /* CC2420_CONF_CHECKSUM */
|
||||||
|
|
||||||
|
#ifndef CC2420_CONF_CHANNEL
|
||||||
|
#define CC2420_CONF_CHANNEL 26
|
||||||
|
#endif /* CC2420_CONF_CHANNEL */
|
||||||
|
|
||||||
|
#ifndef CC2420_CONF_CCA_THRESH
|
||||||
|
#define CC2420_CONF_CCA_THRESH -45
|
||||||
|
#endif /* CC2420_CONF_CCA_THRESH */
|
||||||
|
|
||||||
|
|
||||||
#ifndef CC2420_CONF_AUTOACK
|
#ifndef CC2420_CONF_AUTOACK
|
||||||
#define CC2420_CONF_AUTOACK 0
|
#define CC2420_CONF_AUTOACK 0
|
||||||
#endif /* CC2420_CONF_AUTOACK */
|
#endif /* CC2420_CONF_AUTOACK */
|
||||||
|
@ -331,7 +340,8 @@ cc2420_init(void)
|
||||||
setreg(CC2420_SECCTRL0, reg);
|
setreg(CC2420_SECCTRL0, reg);
|
||||||
|
|
||||||
cc2420_set_pan_addr(0xffff, 0x0000, NULL);
|
cc2420_set_pan_addr(0xffff, 0x0000, NULL);
|
||||||
cc2420_set_channel(26);
|
cc2420_set_channel(CC2420_CONF_CHANNEL);
|
||||||
|
cc2420_set_cca_threshold(CC2420_CONF_CCA_THRESH);
|
||||||
|
|
||||||
flushrx();
|
flushrx();
|
||||||
|
|
||||||
|
|
|
@ -90,9 +90,17 @@
|
||||||
|
|
||||||
#define PACKETBUF_CONF_ATTRS_INLINE 1
|
#define PACKETBUF_CONF_ATTRS_INLINE 1
|
||||||
|
|
||||||
#ifndef RF_CHANNEL
|
#ifdef RF_CHANNEL
|
||||||
#define RF_CHANNEL 26
|
#define CC2420_CONF_CHANNEL RF_CHANNEL
|
||||||
#endif /* RF_CHANNEL */
|
#endif
|
||||||
|
|
||||||
|
#ifndef CC2420_CONF_CHANNEL
|
||||||
|
#define CC2420_CONF_CHANNEL 26
|
||||||
|
#endif /* CC2420_CONF_CHANNEL */
|
||||||
|
|
||||||
|
#ifndef CC2420_CONF_CCA_THRESH
|
||||||
|
#define CC2420_CONF_CCA_THRESH -45
|
||||||
|
#endif /* CC2420_CONF_CCA_THRESH */
|
||||||
|
|
||||||
#define CONTIKIMAC_CONF_BROADCAST_RATE_LIMIT 0
|
#define CONTIKIMAC_CONF_BROADCAST_RATE_LIMIT 0
|
||||||
|
|
||||||
|
|
|
@ -71,10 +71,6 @@ extern unsigned char node_mac[8];
|
||||||
|
|
||||||
//SENSORS(&button_sensor);
|
//SENSORS(&button_sensor);
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
#ifndef RF_CHANNEL
|
|
||||||
#define RF_CHANNEL 26
|
|
||||||
#endif
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
static void
|
static void
|
||||||
set_rime_addr(void)
|
set_rime_addr(void)
|
||||||
{
|
{
|
||||||
|
@ -200,8 +196,6 @@ main(int argc, char **argv)
|
||||||
cc2420_set_pan_addr(IEEE802154_PANID, shortaddr, longaddr);
|
cc2420_set_pan_addr(IEEE802154_PANID, shortaddr, longaddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
cc2420_set_channel(RF_CHANNEL);
|
|
||||||
|
|
||||||
leds_off(LEDS_ALL);
|
leds_off(LEDS_ALL);
|
||||||
|
|
||||||
if(node_id > 0) {
|
if(node_id > 0) {
|
||||||
|
@ -224,7 +218,7 @@ main(int argc, char **argv)
|
||||||
NETSTACK_RDC.name,
|
NETSTACK_RDC.name,
|
||||||
CLOCK_SECOND / (NETSTACK_RDC.channel_check_interval() == 0 ? 1:
|
CLOCK_SECOND / (NETSTACK_RDC.channel_check_interval() == 0 ? 1:
|
||||||
NETSTACK_RDC.channel_check_interval()),
|
NETSTACK_RDC.channel_check_interval()),
|
||||||
RF_CHANNEL);
|
CC2420_CONF_CHANNEL);
|
||||||
|
|
||||||
process_start(&tcpip_process, NULL);
|
process_start(&tcpip_process, NULL);
|
||||||
|
|
||||||
|
@ -265,7 +259,7 @@ main(int argc, char **argv)
|
||||||
NETSTACK_RDC.name,
|
NETSTACK_RDC.name,
|
||||||
CLOCK_SECOND / (NETSTACK_RDC.channel_check_interval() == 0? 1:
|
CLOCK_SECOND / (NETSTACK_RDC.channel_check_interval() == 0? 1:
|
||||||
NETSTACK_RDC.channel_check_interval()),
|
NETSTACK_RDC.channel_check_interval()),
|
||||||
RF_CHANNEL);
|
CC2420_CONF_CHANNEL);
|
||||||
#endif /* WITH_UIP6 */
|
#endif /* WITH_UIP6 */
|
||||||
|
|
||||||
#if !WITH_UIP6
|
#if !WITH_UIP6
|
||||||
|
|
|
@ -90,9 +90,17 @@
|
||||||
|
|
||||||
#define PACKETBUF_CONF_ATTRS_INLINE 1
|
#define PACKETBUF_CONF_ATTRS_INLINE 1
|
||||||
|
|
||||||
#ifndef RF_CHANNEL
|
#ifdef RF_CHANNEL
|
||||||
#define RF_CHANNEL 26
|
#define CC2420_CONF_CHANNEL RF_CHANNEL
|
||||||
#endif /* RF_CHANNEL */
|
#endif
|
||||||
|
|
||||||
|
#ifndef CC2420_CONF_CHANNEL
|
||||||
|
#define CC2420_CONF_CHANNEL 26
|
||||||
|
#endif /* CC2420_CONF_CHANNEL */
|
||||||
|
|
||||||
|
#ifndef CC2420_CONF_CCA_THRESH
|
||||||
|
#define CC2420_CONF_CCA_THRESH -45
|
||||||
|
#endif /* CC2420_CONF_CCA_THRESH */
|
||||||
|
|
||||||
#define CONTIKIMAC_CONF_BROADCAST_RATE_LIMIT 0
|
#define CONTIKIMAC_CONF_BROADCAST_RATE_LIMIT 0
|
||||||
|
|
||||||
|
|
|
@ -139,14 +139,12 @@ init_net(void)
|
||||||
|
|
||||||
cc2420_set_pan_addr(IEEE802154_PANID, shortaddr, longaddr);
|
cc2420_set_pan_addr(IEEE802154_PANID, shortaddr, longaddr);
|
||||||
}
|
}
|
||||||
cc2420_set_channel(RF_CHANNEL);
|
|
||||||
|
|
||||||
|
|
||||||
#if WITH_UIP6
|
#if WITH_UIP6
|
||||||
memcpy(&uip_lladdr.addr, ds2401_id, sizeof(uip_lladdr.addr));
|
memcpy(&uip_lladdr.addr, ds2401_id, sizeof(uip_lladdr.addr));
|
||||||
/* Setup nullmac-like MAC for 802.15.4 */
|
/* Setup nullmac-like MAC for 802.15.4 */
|
||||||
/* sicslowpan_init(sicslowmac_init(&cc2420_driver)); */
|
/* sicslowpan_init(sicslowmac_init(&cc2420_driver)); */
|
||||||
/* printf(" %s channel %u\n", sicslowmac_driver.name, RF_CHANNEL); */
|
/* printf(" %s channel %u\n", sicslowmac_driver.name, CC2420_CONF_CHANNEL); */
|
||||||
|
|
||||||
/* Setup X-MAC for 802.15.4 */
|
/* Setup X-MAC for 802.15.4 */
|
||||||
queuebuf_init();
|
queuebuf_init();
|
||||||
|
@ -158,7 +156,7 @@ init_net(void)
|
||||||
NETSTACK_MAC.name, NETSTACK_RDC.name,
|
NETSTACK_MAC.name, NETSTACK_RDC.name,
|
||||||
CLOCK_SECOND / (NETSTACK_RDC.channel_check_interval() == 0 ? 1:
|
CLOCK_SECOND / (NETSTACK_RDC.channel_check_interval() == 0 ? 1:
|
||||||
NETSTACK_RDC.channel_check_interval()),
|
NETSTACK_RDC.channel_check_interval()),
|
||||||
RF_CHANNEL);
|
CC2420_CONF_CHANNEL);
|
||||||
|
|
||||||
process_start(&tcpip_process, NULL);
|
process_start(&tcpip_process, NULL);
|
||||||
|
|
||||||
|
@ -199,7 +197,7 @@ init_net(void)
|
||||||
NETSTACK_MAC.name, NETSTACK_RDC.name,
|
NETSTACK_MAC.name, NETSTACK_RDC.name,
|
||||||
CLOCK_SECOND / (NETSTACK_RDC.channel_check_interval() == 0? 1:
|
CLOCK_SECOND / (NETSTACK_RDC.channel_check_interval() == 0? 1:
|
||||||
NETSTACK_RDC.channel_check_interval()),
|
NETSTACK_RDC.channel_check_interval()),
|
||||||
RF_CHANNEL);
|
CC2420_CONF_CHANNEL);
|
||||||
#endif /* WITH_UIP6 */
|
#endif /* WITH_UIP6 */
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -90,9 +90,17 @@
|
||||||
|
|
||||||
#define PACKETBUF_CONF_ATTRS_INLINE 1
|
#define PACKETBUF_CONF_ATTRS_INLINE 1
|
||||||
|
|
||||||
#ifndef RF_CHANNEL
|
#ifdef RF_CHANNEL
|
||||||
#define RF_CHANNEL 26
|
#define CC2420_CONF_CHANNEL RF_CHANNEL
|
||||||
#endif /* RF_CHANNEL */
|
#endif
|
||||||
|
|
||||||
|
#ifndef CC2420_CONF_CHANNEL
|
||||||
|
#define CC2420_CONF_CHANNEL 26
|
||||||
|
#endif /* CC2420_CONF_CHANNEL */
|
||||||
|
|
||||||
|
#ifndef CC2420_CONF_CCA_THRESH
|
||||||
|
#define CC2420_CONF_CCA_THRESH -45
|
||||||
|
#endif /* CC2420_CONF_CCA_THRESH */
|
||||||
|
|
||||||
#define CONTIKIMAC_CONF_BROADCAST_RATE_LIMIT 0
|
#define CONTIKIMAC_CONF_BROADCAST_RATE_LIMIT 0
|
||||||
|
|
||||||
|
|
|
@ -115,10 +115,7 @@ force_float_inclusion()
|
||||||
#endif
|
#endif
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void uip_log(char *msg) { puts(msg); }
|
void uip_log(char *msg) { puts(msg); }
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
#ifndef RF_CHANNEL
|
|
||||||
#define RF_CHANNEL 26
|
|
||||||
#endif
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
#if 0
|
#if 0
|
||||||
void
|
void
|
||||||
|
@ -272,7 +269,6 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
cc2420_set_pan_addr(IEEE802154_PANID, shortaddr, longaddr);
|
cc2420_set_pan_addr(IEEE802154_PANID, shortaddr, longaddr);
|
||||||
}
|
}
|
||||||
cc2420_set_channel(RF_CHANNEL);
|
|
||||||
|
|
||||||
printf(CONTIKI_VERSION_STRING " started. ");
|
printf(CONTIKI_VERSION_STRING " started. ");
|
||||||
if(node_id > 0) {
|
if(node_id > 0) {
|
||||||
|
@ -289,7 +285,7 @@ main(int argc, char **argv)
|
||||||
memcpy(&uip_lladdr.addr, ds2411_id, sizeof(uip_lladdr.addr));
|
memcpy(&uip_lladdr.addr, ds2411_id, sizeof(uip_lladdr.addr));
|
||||||
/* Setup nullmac-like MAC for 802.15.4 */
|
/* Setup nullmac-like MAC for 802.15.4 */
|
||||||
/* sicslowpan_init(sicslowmac_init(&cc2420_driver)); */
|
/* sicslowpan_init(sicslowmac_init(&cc2420_driver)); */
|
||||||
/* printf(" %s channel %u\n", sicslowmac_driver.name, RF_CHANNEL); */
|
/* printf(" %s channel %u\n", sicslowmac_driver.name, CC2420_CONF_CCA_THRESH); */
|
||||||
|
|
||||||
/* Setup X-MAC for 802.15.4 */
|
/* Setup X-MAC for 802.15.4 */
|
||||||
queuebuf_init();
|
queuebuf_init();
|
||||||
|
@ -297,11 +293,12 @@ main(int argc, char **argv)
|
||||||
NETSTACK_MAC.init();
|
NETSTACK_MAC.init();
|
||||||
NETSTACK_NETWORK.init();
|
NETSTACK_NETWORK.init();
|
||||||
|
|
||||||
printf("%s %s, channel check rate %lu Hz, radio channel %u\n",
|
printf("%s %s, channel check rate %lu Hz, radio channel %u, CCA threshold %i\n",
|
||||||
NETSTACK_MAC.name, NETSTACK_RDC.name,
|
NETSTACK_MAC.name, NETSTACK_RDC.name,
|
||||||
CLOCK_SECOND / (NETSTACK_RDC.channel_check_interval() == 0 ? 1:
|
CLOCK_SECOND / (NETSTACK_RDC.channel_check_interval() == 0 ? 1:
|
||||||
NETSTACK_RDC.channel_check_interval()),
|
NETSTACK_RDC.channel_check_interval()),
|
||||||
RF_CHANNEL);
|
CC2420_CONF_CHANNEL,
|
||||||
|
CC2420_CONF_CCA_THRESH);
|
||||||
|
|
||||||
process_start(&tcpip_process, NULL);
|
process_start(&tcpip_process, NULL);
|
||||||
|
|
||||||
|
@ -342,7 +339,7 @@ main(int argc, char **argv)
|
||||||
NETSTACK_MAC.name, NETSTACK_RDC.name,
|
NETSTACK_MAC.name, NETSTACK_RDC.name,
|
||||||
CLOCK_SECOND / (NETSTACK_RDC.channel_check_interval() == 0? 1:
|
CLOCK_SECOND / (NETSTACK_RDC.channel_check_interval() == 0? 1:
|
||||||
NETSTACK_RDC.channel_check_interval()),
|
NETSTACK_RDC.channel_check_interval()),
|
||||||
RF_CHANNEL);
|
CC2420_CONF_CCA_THRESH);
|
||||||
#endif /* WITH_UIP6 */
|
#endif /* WITH_UIP6 */
|
||||||
|
|
||||||
#if !WITH_UIP && !WITH_UIP6
|
#if !WITH_UIP && !WITH_UIP6
|
||||||
|
|
|
@ -92,9 +92,17 @@
|
||||||
|
|
||||||
#define PACKETBUF_CONF_ATTRS_INLINE 1
|
#define PACKETBUF_CONF_ATTRS_INLINE 1
|
||||||
|
|
||||||
#ifndef RF_CHANNEL
|
#ifdef RF_CHANNEL
|
||||||
#define RF_CHANNEL 26
|
#define CC2420_CONF_CHANNEL RF_CHANNEL
|
||||||
#endif /* RF_CHANNEL */
|
#endif
|
||||||
|
|
||||||
|
#ifndef CC2420_CONF_CHANNEL
|
||||||
|
#define CC2420_CONF_CHANNEL 26
|
||||||
|
#endif /* CC2420_CONF_CHANNEL */
|
||||||
|
|
||||||
|
#ifndef CC2420_CONF_CCA_THRESH
|
||||||
|
#define CC2420_CONF_CCA_THRESH -45
|
||||||
|
#endif /* CC2420_CONF_CCA_THRESH */
|
||||||
|
|
||||||
#define IEEE802154_CONF_PANID 0xABCD
|
#define IEEE802154_CONF_PANID 0xABCD
|
||||||
|
|
||||||
|
|
|
@ -123,10 +123,6 @@ force_float_inclusion()
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void uip_log(char *msg) { puts(msg); }
|
void uip_log(char *msg) { puts(msg); }
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
#ifndef RF_CHANNEL
|
|
||||||
#define RF_CHANNEL 26
|
|
||||||
#endif
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
#if 0
|
#if 0
|
||||||
void
|
void
|
||||||
force_inclusion(int d1, int d2)
|
force_inclusion(int d1, int d2)
|
||||||
|
@ -289,7 +285,6 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
cc2420_set_pan_addr(IEEE802154_PANID, shortaddr, longaddr);
|
cc2420_set_pan_addr(IEEE802154_PANID, shortaddr, longaddr);
|
||||||
}
|
}
|
||||||
cc2420_set_channel(RF_CHANNEL);
|
|
||||||
|
|
||||||
leds_off(LEDS_ALL);
|
leds_off(LEDS_ALL);
|
||||||
|
|
||||||
|
@ -306,7 +301,7 @@ main(int argc, char **argv)
|
||||||
memcpy(&uip_lladdr.addr, node_mac, sizeof(uip_lladdr.addr));
|
memcpy(&uip_lladdr.addr, node_mac, sizeof(uip_lladdr.addr));
|
||||||
/* Setup nullmac-like MAC for 802.15.4 */
|
/* Setup nullmac-like MAC for 802.15.4 */
|
||||||
/* sicslowpan_init(sicslowmac_init(&cc2420_driver)); */
|
/* sicslowpan_init(sicslowmac_init(&cc2420_driver)); */
|
||||||
/* printf(" %s channel %u\n", sicslowmac_driver.name, RF_CHANNEL); */
|
/* printf(" %s channel %u\n", sicslowmac_driver.name, CC2420_CONF_CHANNEL); */
|
||||||
|
|
||||||
/* Setup X-MAC for 802.15.4 */
|
/* Setup X-MAC for 802.15.4 */
|
||||||
queuebuf_init();
|
queuebuf_init();
|
||||||
|
@ -319,7 +314,7 @@ main(int argc, char **argv)
|
||||||
NETSTACK_MAC.name, NETSTACK_RDC.name,
|
NETSTACK_MAC.name, NETSTACK_RDC.name,
|
||||||
CLOCK_SECOND / (NETSTACK_RDC.channel_check_interval() == 0 ? 1:
|
CLOCK_SECOND / (NETSTACK_RDC.channel_check_interval() == 0 ? 1:
|
||||||
NETSTACK_RDC.channel_check_interval()),
|
NETSTACK_RDC.channel_check_interval()),
|
||||||
RF_CHANNEL);
|
CC2420_CONF_CHANNEL);
|
||||||
|
|
||||||
process_start(&tcpip_process, NULL);
|
process_start(&tcpip_process, NULL);
|
||||||
|
|
||||||
|
@ -360,7 +355,7 @@ main(int argc, char **argv)
|
||||||
NETSTACK_MAC.name, NETSTACK_RDC.name,
|
NETSTACK_MAC.name, NETSTACK_RDC.name,
|
||||||
CLOCK_SECOND / (NETSTACK_RDC.channel_check_interval() == 0? 1:
|
CLOCK_SECOND / (NETSTACK_RDC.channel_check_interval() == 0? 1:
|
||||||
NETSTACK_RDC.channel_check_interval()),
|
NETSTACK_RDC.channel_check_interval()),
|
||||||
RF_CHANNEL);
|
CC2420_CONF_CHANNEL);
|
||||||
#endif /* WITH_UIP6 */
|
#endif /* WITH_UIP6 */
|
||||||
|
|
||||||
#if !WITH_UIP && !WITH_UIP6
|
#if !WITH_UIP && !WITH_UIP6
|
||||||
|
|
Loading…
Add table
Reference in a new issue