stm32w platforms: contikimac support in the Rime case, with EUI-64

This commit is contained in:
simonduq 2012-03-20 16:15:51 +01:00
parent 0eb9a46e3a
commit e4fb360262
5 changed files with 48 additions and 33 deletions

View File

@ -38,6 +38,7 @@
* \author * \author
* Salvatore Pitrulli * Salvatore Pitrulli
* Chi-Anh La la@imag.fr * Chi-Anh La la@imag.fr
* Simon Duquennoy <simonduq@sics.se>
*/ */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
@ -61,6 +62,12 @@
#include "dev/leds.h" #include "dev/leds.h"
#define LED_ACTIVITY 0 #define LED_ACTIVITY 0
#ifdef ST_CONF_RADIO_AUTOACK
#define ST_RADIO_AUTOACK ST_CONF_RADIO_AUTOACK
#else
#define ST_RADIO_AUTOACK 0
#endif /* ST_CONF_RADIO_AUTOACK */
#if RDC_CONF_DEBUG_LED #if RDC_CONF_DEBUG_LED
#define LED_RDC RDC_CONF_DEBUG_LED #define LED_RDC RDC_CONF_DEBUG_LED
#define LED_ACTIVITY 1 #define LED_ACTIVITY 1
@ -108,7 +115,7 @@
#define LED_RDC_OFF() #define LED_RDC_OFF()
#endif #endif
#if NETSTACK_CONF_RDC_ENABLED #if RDC_CONF_HARDWARE_CSMA
#define MAC_RETRIES 0 #define MAC_RETRIES 0
#endif #endif
@ -145,7 +152,7 @@
ENERGEST_OFF(ENERGEST_TYPE_LISTEN); \ ENERGEST_OFF(ENERGEST_TYPE_LISTEN); \
} \ } \
} }
#if NETSTACK_CONF_RDC_ENABLED #if RDC_CONF_HARDWARE_CSMA
#define ST_RADIO_CHECK_CCA FALSE #define ST_RADIO_CHECK_CCA FALSE
#define ST_RADIO_CCA_ATTEMPT_MAX 0 #define ST_RADIO_CCA_ATTEMPT_MAX 0
#define ST_BACKOFF_EXP_MIN 0 #define ST_BACKOFF_EXP_MIN 0
@ -274,12 +281,17 @@ static int stm32w_radio_init(void)
ST_RadioInit(ST_RADIO_POWER_MODE_OFF); ST_RadioInit(ST_RADIO_POWER_MODE_OFF);
onoroff = OFF; onoroff = OFF;
ST_RadioSetNodeId(STM32W_NODE_ID); // To be deleted.
ST_RadioSetPanId(IEEE802154_PANID); ST_RadioSetPanId(IEEE802154_PANID);
CLEAN_RXBUFS(); CLEAN_RXBUFS();
CLEAN_TXBUF(); CLEAN_TXBUF();
ST_RadioEnableAutoAck(1);
#if ST_RADIO_AUTOACK && !(UIP_CONF_LL_802154 && RIMEADDR_CONF_SIZE==8)
#error "Autoack and address filtering can only be used with EUI 64"
#endif
ST_RadioEnableAutoAck(ST_RADIO_AUTOACK);
ST_RadioEnableAddressFiltering(ST_RADIO_AUTOACK);
locked = 0; locked = 0;
process_start(&stm32w_radio_process, NULL); process_start(&stm32w_radio_process, NULL);

View File

@ -56,6 +56,10 @@
#define RF_CHANNEL 16 #define RF_CHANNEL 16
/* 802.15.4 PAN ID */ /* 802.15.4 PAN ID */
#define IEEE802154_CONF_PANID 0x1234 #define IEEE802154_CONF_PANID 0x1234
/* Use EID 64, enable hardware autoack and address filtering */
#define RIMEADDR_CONF_SIZE 8
#define UIP_CONF_LL_802154 1
#define ST_CONF_RADIO_AUTOACK 1
/* Number of buffers for incoming frames */ /* Number of buffers for incoming frames */
#define RADIO_RXBUFS 2 #define RADIO_RXBUFS 2
/* Set to 0 for non ethernet links */ /* Set to 0 for non ethernet links */
@ -78,7 +82,6 @@
#define NETSTACK_CONF_RDC contikimac_driver #define NETSTACK_CONF_RDC contikimac_driver
#define NETSTACK_CONF_FRAMER framer_802154 #define NETSTACK_CONF_FRAMER framer_802154
#define NETSTACK_CONF_RADIO stm32w_radio_driver #define NETSTACK_CONF_RADIO stm32w_radio_driver
#define NETSTACK_CONF_RDC_ENABLED 1
/* ContikiMAC config */ /* ContikiMAC config */
#define CONTIKIMAC_CONF_COMPOWER 1 #define CONTIKIMAC_CONF_COMPOWER 1
@ -125,8 +128,6 @@
#define UIP_CONF_MAX_CONNECTIONS 4 #define UIP_CONF_MAX_CONNECTIONS 4
#define UIP_CONF_MAX_LISTENPORTS 8 #define UIP_CONF_MAX_LISTENPORTS 8
#define UIP_CONF_UDP_CONNS 4 #define UIP_CONF_UDP_CONNS 4
#define RIMEADDR_CONF_SIZE 8
#define UIP_CONF_LL_802154 1
#include "net/sicslowpan.h" #include "net/sicslowpan.h"
#define SICSLOWPAN_CONF_COMPRESSION SICSLOWPAN_CONF_COMPRESSION_HC06 #define SICSLOWPAN_CONF_COMPRESSION SICSLOWPAN_CONF_COMPRESSION_HC06

View File

@ -109,9 +109,6 @@ set_rime_addr(void)
eui64.u8[c] = stm32w_eui64[7 - c]; eui64.u8[c] = stm32w_eui64[7 - c];
} }
} }
PRINTF("\n\rRadio EUI-64:");
PRINTLLADDR(eui64);
PRINTF("\n\r");
#if UIP_CONF_IPV6 #if UIP_CONF_IPV6
memcpy(&uip_lladdr.addr, &eui64, sizeof(uip_lladdr.addr)); memcpy(&uip_lladdr.addr, &eui64, sizeof(uip_lladdr.addr));
@ -170,13 +167,18 @@ main(void)
netstack_init(); netstack_init();
#if !UIP_CONF_IPV6
ST_RadioEnableAutoAck(FALSE); // Because frames are not 802.15.4 compatible.
ST_RadioEnableAddressFiltering(FALSE);
#endif
set_rime_addr(); set_rime_addr();
printf("%s %s, channel check rate %lu Hz\n",
NETSTACK_MAC.name, NETSTACK_RDC.name,
CLOCK_SECOND / (NETSTACK_RDC.channel_check_interval() == 0 ? 1:
NETSTACK_RDC.channel_check_interval()));
printf("802.15.4 PAN ID 0x%x, EUI-%d:",
IEEE802154_CONF_PANID, UIP_CONF_LL_802154?64:16);
uip_debug_lladdr_print(&rimeaddr_node_addr);
printf(", radio channel %u\n", RF_CHANNEL);
procinit_init(); procinit_init();
energest_init(); energest_init();

View File

@ -56,6 +56,10 @@
#define RF_CHANNEL 16 #define RF_CHANNEL 16
/* 802.15.4 PAN ID */ /* 802.15.4 PAN ID */
#define IEEE802154_CONF_PANID 0x1234 #define IEEE802154_CONF_PANID 0x1234
/* Use EID 64, enable hardware autoack and address filtering */
#define RIMEADDR_CONF_SIZE 8
#define UIP_CONF_LL_802154 1
#define ST_CONF_RADIO_AUTOACK 1
/* Number of buffers for incoming frames */ /* Number of buffers for incoming frames */
#define RADIO_RXBUFS 2 #define RADIO_RXBUFS 2
/* Set to 0 for non ethernet links */ /* Set to 0 for non ethernet links */
@ -78,7 +82,6 @@
#define NETSTACK_CONF_RDC contikimac_driver #define NETSTACK_CONF_RDC contikimac_driver
#define NETSTACK_CONF_FRAMER framer_802154 #define NETSTACK_CONF_FRAMER framer_802154
#define NETSTACK_CONF_RADIO stm32w_radio_driver #define NETSTACK_CONF_RADIO stm32w_radio_driver
#define NETSTACK_CONF_RDC_ENABLED 1
/* ContikiMAC config */ /* ContikiMAC config */
#define CONTIKIMAC_CONF_COMPOWER 1 #define CONTIKIMAC_CONF_COMPOWER 1
@ -125,8 +128,6 @@
#define UIP_CONF_MAX_CONNECTIONS 4 #define UIP_CONF_MAX_CONNECTIONS 4
#define UIP_CONF_MAX_LISTENPORTS 8 #define UIP_CONF_MAX_LISTENPORTS 8
#define UIP_CONF_UDP_CONNS 4 #define UIP_CONF_UDP_CONNS 4
#define RIMEADDR_CONF_SIZE 8
#define UIP_CONF_LL_802154 1
#include "net/sicslowpan.h" #include "net/sicslowpan.h"
#define SICSLOWPAN_CONF_COMPRESSION SICSLOWPAN_CONF_COMPRESSION_HC06 #define SICSLOWPAN_CONF_COMPRESSION SICSLOWPAN_CONF_COMPRESSION_HC06

View File

@ -106,9 +106,6 @@ set_rime_addr(void)
eui64.u8[c] = stm32w_eui64[7 - c]; eui64.u8[c] = stm32w_eui64[7 - c];
} }
} }
PRINTF("\n\rRadio EUI-64:");
PRINTLLADDR(eui64);
PRINTF("\n\r");
#if UIP_CONF_IPV6 #if UIP_CONF_IPV6
memcpy(&uip_lladdr.addr, &eui64, sizeof(uip_lladdr.addr)); memcpy(&uip_lladdr.addr, &eui64, sizeof(uip_lladdr.addr));
@ -165,17 +162,19 @@ main(void)
process_start(&etimer_process, NULL); process_start(&etimer_process, NULL);
ctimer_init(); ctimer_init();
#if !UIP_CONF_IPV6
ST_RadioEnableAutoAck(FALSE); // Because frames are not 802.15.4 compatible.
ST_RadioEnableAddressFiltering(FALSE);
#endif
rtimer_init(); rtimer_init();
netstack_init(); netstack_init();
set_rime_addr(); set_rime_addr();
printf("%s %s, channel check rate %lu Hz\n",
NETSTACK_MAC.name, NETSTACK_RDC.name,
CLOCK_SECOND / (NETSTACK_RDC.channel_check_interval() == 0 ? 1:
NETSTACK_RDC.channel_check_interval()));
printf("802.15.4 PAN ID 0x%x, EUI-%d:",
IEEE802154_CONF_PANID, UIP_CONF_LL_802154?64:16);
uip_debug_lladdr_print(&rimeaddr_node_addr);
printf(", radio channel %u\n", RF_CHANNEL);
procinit_init(); procinit_init();
energest_init(); energest_init();