Add experimental RPL code

Change RF channel to 26 for econotag compatibility
This commit is contained in:
dak664 2010-08-03 19:55:42 +00:00
parent 12479c32bc
commit b706c48efd
4 changed files with 83 additions and 18 deletions

View file

@ -17,10 +17,15 @@ USB = uart_usb_lib.c \
storage_task.c \ storage_task.c \
avr_flash.c avr_flash.c
#As of August 2010 the following are needed for rpl. They need explicit inclusion since CONTIKI_NO_NET=1
#The tcpip_input routine in tcpip.c must be commented out; it expects a tcpip process and conflicts with the one in fakeuip.c
#RPL = rpl.c rpl-dag.c rpl-icmp6.c rpl-timers.c rpl-of-etx.c uip-ds6.c uip-icmp6.c uip-nd6.c uip6.c neighbor-info.c neighbor-attr.c tcpip.c uip-split.c
CONTIKI_TARGET_SOURCEFILES += cfs-eeprom.c eeprom.c random.c \ CONTIKI_TARGET_SOURCEFILES += cfs-eeprom.c eeprom.c random.c \
mmem.c contiki-raven-default-init-lowlevel.c \ mmem.c contiki-raven-default-init-lowlevel.c \
contiki-raven-default-init-net.c contiki-raven-main.c \ contiki-raven-default-init-net.c contiki-raven-main.c \
sicslow_ethernet.c queuebuf.c packetbuf.c \ sicslow_ethernet.c queuebuf.c packetbuf.c \
$(RPL) \
$(USB) $(USB)
USB_INCLUDES = -I$(CONTIKI_CPU)/dev/usb USB_INCLUDES = -I$(CONTIKI_CPU)/dev/usb

View file

@ -33,29 +33,27 @@
/** /**
* \file * \file
* Configuration for sample STK 501 Contiki kernel * Configuration for RZRAVEN USB stick "jackdaw"
* *
* \author * \author
* Simon Barner <barner@in.tum.de * Simon Barner <barner@in.tum.de>
* David Kopf <dak664@embarqmail.com>
*/ */
#ifndef __CONTIKI_CONF_H__ #ifndef __CONTIKI_CONF_H__
#define __CONTIKI_CONF_H__ #define __CONTIKI_CONF_H__
#include <stdint.h> /* MCU and clock rate */
typedef int32_t s32_t;
/*
* MCU and clock rate
*/
#define MCU_MHZ 8 #define MCU_MHZ 8
#define PLATFORM PLATFORM_AVR #define PLATFORM PLATFORM_AVR
#define RAVEN_REVISION RAVENUSB_C #define RAVEN_REVISION RAVENUSB_C
/* Cock ticks per second */ /* Clock ticks per second */
#define CLOCK_CONF_SECOND 125 #define CLOCK_CONF_SECOND 125
/* Since clock_time_t is 16 bits, maximum interval is 524 seconds */
#define RIME_CONF_BROADCAST_ANNOUNCEMENT_MAX_TIME CLOCK_CONF_SECOND * 524UL /*Default uses 600*/
/* Maximum time interval (used for timers) */ /* Maximum time interval (used for timers) */
#define INFINITE_TIME 0xffff #define INFINITE_TIME 0xffff
@ -106,8 +104,10 @@ typedef int32_t s32_t;
#define UIP_CONF_TCP_SPLIT 1 #define UIP_CONF_TCP_SPLIT 1
#define UIP_CONF_STATISTICS 1 #define UIP_CONF_STATISTICS 1
#define USB_CONF_CDC 1 /* Disable mass storage enumeration for more debug string space */
#define USB_CONF_STORAGE 1 #define USB_CONF_STORAGE 1
/* Use either USB CDC or RS232 for stdout (or neither) */
#define USB_CONF_CDC 1
//#define USB_CONF_RS232 1 //#define USB_CONF_RS232 1
#ifdef RF230BB #ifdef RF230BB
@ -158,6 +158,54 @@ typedef int32_t s32_t;
#error Network configuration not specified! #error Network configuration not specified!
#endif /* Network setup */ #endif /* Network setup */
#if 0 /* RPL */
/* Not completely working yet. Link local pings work but address prefixes do not get assigned */
/* Since the jackdaw has no uip stack additional modules must be included, uncomment the line in /plaftorm/avr-ravenusb/Makefile.avr-ravenusb */
//#define UIP_CONF_ROUTER 1
#define UIP_CONF_IPV6_RPL 1
#undef UIP_CONF_TCP
#define UIP_CONF_TCP 0
//#undef UIP_FALLBACK_INTERFACE
//#define UIP_FALLBACK_INTERFACE rpl_interface
#if 0 //too much RAM!
/* Handle 10 neighbors */
#define UIP_CONF_DS6_NBR_NBU 10
/* Handle 10 routes */
#define UIP_CONF_DS6_ROUTE_NBU 10
#define UIP_CONF_ND6_SEND_RA 0
#define UIP_CONF_ND6_REACHABLE_TIME 600000
#define UIP_CONF_ND6_RETRANS_TIMER 10000
#undef UIP_CONF_IPV6_QUEUE_PKT
#define UIP_CONF_IPV6_QUEUE_PKT 1
//#define UIP_CONF_IPV6_CHECKS 1
#define UIP_CONF_NETIF_MAX_ADDRESSES 3
#define UIP_CONF_ND6_MAX_PREFIXES 3
#define UIP_CONF_ND6_MAX_NEIGHBORS 4
#define UIP_CONF_ND6_MAX_DEFROUTERS 2
#define UIP_CONF_IP_FORWARD 0
#define UIP_CONF_BUFFER_SIZE 240
#define UIP_CONF_ICMP_DEST_UNREACH 1
#define UIP_CONF_DHCP_LIGHT
#undef UIP_CONF_LLH_LEN
#define UIP_CONF_LLH_LEN 0
//#define UIP_CONF_RECEIVE_WINDOW 48
//#define UIP_CONF_TCP_MSS 48
#undef UIP_CONF_UDP_CONNS
#define UIP_CONF_UDP_CONNS 12
#undef UIP_CONF_FWCACHE_SIZE
#define UIP_CONF_FWCACHE_SIZE 30
#define UIP_CONF_BROADCAST 1
#define UIP_ARCH_IPCHKSUM 1
#define UIP_CONF_PINGADDRCONF 0
#define UIP_CONF_LOGGING 0
#endif
#endif /* RPL */
#endif /* RF230BB */ #endif /* RF230BB */
/* Route-Under-MAC uses 16-bit short addresses */ /* Route-Under-MAC uses 16-bit short addresses */
@ -166,6 +214,9 @@ typedef int32_t s32_t;
#define UIP_DATA_RUM_OFFSET 5 #define UIP_DATA_RUM_OFFSET 5
#endif #endif
#include <stdint.h>
typedef int32_t s32_t;
typedef unsigned short clock_time_t; typedef unsigned short clock_time_t;
typedef unsigned char u8_t; typedef unsigned char u8_t;
typedef unsigned short u16_t; typedef unsigned short u16_t;

View file

@ -178,7 +178,7 @@ static void initialize(void) {
memcpy(&uip_lladdr.addr, &addr.u8, 8); memcpy(&uip_lladdr.addr, &addr.u8, 8);
rf230_set_pan_addr(IEEE802154_PANID, 0, (uint8_t *)&addr.u8); rf230_set_pan_addr(IEEE802154_PANID, 0, (uint8_t *)&addr.u8);
rf230_set_channel(24); rf230_set_channel(26);
rimeaddr_set_node_addr(&addr); rimeaddr_set_node_addr(&addr);
// set_rime_addr(); // set_rime_addr();
@ -189,11 +189,6 @@ static void initialize(void) {
NETSTACK_MAC.init(); NETSTACK_MAC.init();
NETSTACK_NETWORK.init(); NETSTACK_NETWORK.init();
#if UIP_CONF_ROUTER
rime_init(rime_udp_init(NULL));
uip_router_register(&rimeroute);
#endif
#if ANNOUNCE && USB_CONF_RS232 #if ANNOUNCE && USB_CONF_RS232
printf_P(PSTR("MAC address %x:%x:%x:%x:%x:%x:%x:%x\n"),addr.u8[0],addr.u8[1],addr.u8[2],addr.u8[3],addr.u8[4],addr.u8[5],addr.u8[6],addr.u8[7]); printf_P(PSTR("MAC address %x:%x:%x:%x:%x:%x:%x:%x\n"),addr.u8[0],addr.u8[1],addr.u8[2],addr.u8[3],addr.u8[4],addr.u8[5],addr.u8[6],addr.u8[7]);
printf_P(PSTR("%s %s, channel %u"),NETSTACK_MAC.name, NETSTACK_RDC.name,rf230_get_channel()); printf_P(PSTR("%s %s, channel %u"),NETSTACK_MAC.name, NETSTACK_RDC.name,rf230_get_channel());
@ -206,6 +201,14 @@ static void initialize(void) {
printf_P(PSTR("\n")); printf_P(PSTR("\n"));
#endif #endif
#if UIP_CONF_IPV6_RPL
/* Normally tcpip process does this, but we don't have one.
* A Compiler warning will occur since no rpl.h header include
* Still experimental, pings work to link local address only
*/
rpl_init();
#endif
#else /* RF230BB */ #else /* RF230BB */
/* The order of starting these is important! */ /* The order of starting these is important! */
process_start(&mac_process, NULL); process_start(&mac_process, NULL);

View file

@ -294,6 +294,12 @@ uint8_t prefixBuffer[PREFIX_BUFFER_SIZE][3];
/* 6lowpan max size + ethernet header size + 1 */ /* 6lowpan max size + ethernet header size + 1 */
uint8_t raw_buf[127+ UIP_LLH_LEN +1]; uint8_t raw_buf[127+ UIP_LLH_LEN +1];
/* RPL uses some core tcpip routines which includes another tcpip_input */
#if UIP_CONF_IPV6_RPL
#warning ---------------------------------------------------------------
#warning For RPL comment out the tcpip_input routine in core/net/tcpip.c
#warning ---------------------------------------------------------------
#endif
void tcpip_input( void ) void tcpip_input( void )
{ {
// printf("tcpip_input"); // printf("tcpip_input");