diff --git a/platform/avr-rcb/Makefile.avr-rcb b/platform/avr-rcb/Makefile.avr-rcb index 96dcd0cd3..5c14240b0 100644 --- a/platform/avr-rcb/Makefile.avr-rcb +++ b/platform/avr-rcb/Makefile.avr-rcb @@ -5,10 +5,14 @@ CONTIKI_TARGET_MAIN = ${CONTIKI_CORE}.o CONTIKI_TARGET_SOURCEFILES += rs232.c cfs-eeprom.c eeprom.c random.c \ mmem.c contiki-rcb-main.c +MODULES += core/net core/net/mac core/net/mac/sicslowmac core/net/mac/contikimac \ + core/net/mac/cxmac core/net/rime core/net/ipv4 core/net/ip \ + core/net/ipv6 core/net/rpl core/net/llsec + CONTIKIAVR=$(CONTIKI)/cpu/avr CONTIKIBOARD=. -CONTIKI_PLAT_DEFS = -DF_CPU=8000000UL -DAUTO_CRC_PADDING=2 +CONTIKI_PLAT_DEFS = -DF_CPU=8000000UL -DAUTO_CRC_PADDING=2 -DNETSTACK_CONF_WITH_RIME=1 -DNETSTACK_CONF_WITH_IPV6=1 MCU=atmega1281 AVRDUDE_PROGRAMMER=jtag2 diff --git a/platform/avr-rcb/contiki-conf.h b/platform/avr-rcb/contiki-conf.h index 2556c310b..3ecb788db 100644 --- a/platform/avr-rcb/contiki-conf.h +++ b/platform/avr-rcb/contiki-conf.h @@ -92,11 +92,24 @@ void clock_adjust_ticks(clock_time_t howmany); #define CCIF #define CLIF -//#define NETSTACK_CONF_WITH_IPV6 1 //Let makefile determine this so ipv4 hello-world will compile - #define LINKADDR_CONF_SIZE 8 -#define PACKETBUF_CONF_HDR_SIZE 0 +#define PACKETBUF_CONF_HDR_SIZE 48 /* Choose a buffersize != 0 for the messages which should be sended over the wireless interface */ +/* Uncomment this lines to activate the specific drivers */ +//#define NETSTACK_CONF_NETWORK rime_driver +//#define NETSTACK_CONF_MAC nullmac_driver +//#define NETSTACK_CONF_RDC sicslowmac_driver +//#define NETSTACK_CONF_FRAMER framer_802154 /* Framer for 802.15.4 Medium Access Control */ +#define NETSTACK_CONF_RADIO rf230_driver /* Select the wireless driver, otherwise contiki would operate with the "nulldriver" which does nothing */ + +#define RF230_CONF_AUTOACK 1 +#define CXMAC_CONF_ANNOUNCEMENTS 10 +#define NETSTACK_CONF_RDC_CHANNEL_CHECK_RATE 8 + +/* 211 bytes per queue buffer. Burst mode will need 15 for a 1280 byte MTU */ +#define QUEUEBUF_CONF_NUM 15 +/* 54 bytes per queue ref buffer */ +#define QUEUEBUF_CONF_REF_NUM 2 /* 0 for IPv6, or 1 for HC1, 2 for HC01 */ #define SICSLOWPAN_CONF_COMPRESSION_IPV6 0 #define SICSLOWPAN_CONF_COMPRESSION_HC1 1 @@ -124,18 +137,16 @@ void clock_adjust_ticks(clock_time_t howmany); #define UIP_CONF_NETIF_MAX_ADDRESSES 3 #define UIP_CONF_ND6_MAX_PREFIXES 3 #define UIP_CONF_ND6_MAX_DEFROUTERS 2 -#if NETSTACK_CONF_WITH_IPV6 //tcpip.c error on ipv4 build if UIP_CONF_ICMP6 defined -#define UIP_CONF_ICMP6 1 +#if NETSTACK_CONF_WITH_IPV6 //tcpip.c error on ipv4 build if UIP_CONF_ICMP6 defined +#define UIP_CONF_ICMP6 1 #endif #define UIP_CONF_UDP 1 #define UIP_CONF_UDP_CHECKSUMS 1 -#define UIP_CONF_TCP 0 +#define UIP_CONF_TCP 1 #define UIP_CONF_TCP_SPLIT 0 - - /* These names are deprecated, use C99 names. */ /*typedef unsigned char u8_t; typedef unsigned short u16_t; diff --git a/platform/avr-rcb/contiki-rcb-main.c b/platform/avr-rcb/contiki-rcb-main.c index 7516c27dc..bc7a08602 100644 --- a/platform/avr-rcb/contiki-rcb-main.c +++ b/platform/avr-rcb/contiki-rcb-main.c @@ -109,17 +109,18 @@ init_lowlevel(void) rs232_redirect_stdout(RS232_PORT_1); DDRE |= LED1 | LED2 | LED3; + + ctimer_init(); + } static struct etimer et; PROCESS_THREAD(rcb_leds, ev, data) { - uint8_t error; PROCESS_BEGIN(); - if((error = icmp6_new(NULL)) == 0) { while(1) { PROCESS_YIELD(); @@ -134,7 +135,6 @@ PROCESS_THREAD(rcb_leds, ev, data) LEDOff(LED2); } } - } PROCESS_END(); } @@ -142,14 +142,10 @@ PROCESS_THREAD(rcb_leds, ev, data) int main(void) { - //calibrate_rc_osc_32k(); //CO: Had to comment this out - /* Initialize hardware */ - init_lowlevel(); - + init_lowlevel(); /* Clock */ clock_init(); - LEDOff(LED1 | LED2); /* Process subsystem */ @@ -157,17 +153,29 @@ main(void) /* Register initial processes */ procinit_init(); + + /* It is very important to do the NETSTACK_* initializations right here + * to enable the PROCESS_YIELD** functionality. + * The receive process is an single protothread which handles the + * received packets. This process needs PROCESS_YIELD_UNTIL(). + **/ + /* Start radio and radio receive process */ + NETSTACK_RADIO.init(); + /* Initialize stack protocols */ + queuebuf_init(); + NETSTACK_RDC.init(); + NETSTACK_MAC.init(); + NETSTACK_NETWORK.init(); /* Autostart processes */ autostart_start(autostart_processes); printf_P(PSTR("\n********BOOTING CONTIKI*********\n")); - printf_P(PSTR("System online.\n")); /* Main scheduler loop */ while(1) { - process_run(); + process_run(); } return 0;