Commit graph

206 commits

Author SHA1 Message Date
adamdunkels add426de4b Bugfixed stream mode: node listens 100% for 0.5 seconds in stream mode. Naming change: is_listening changed is_snooping. 2010-04-01 10:02:04 +00:00
adamdunkels b43f7830b3 Fine-tuned the timing and phase lock optimization 2010-03-31 20:27:15 +00:00
adamdunkels 877eb2fbe9 Fiddled with the timing 2010-03-31 11:54:38 +00:00
adamdunkels bcfa80102d Had previously not included the waiting time that the CC2420 introduces when sending a packet. Also increased the smallest packet size, just to be on the safe side. 2010-03-30 23:01:32 +00:00
adamdunkels 226abb8ec3 Removed non-existant include file 2010-03-29 22:10:03 +00:00
adamdunkels 9c58768b59 Extend packet size after creating 802.15.4 header; prepare radio chip with packet before waiting for neighbor phase to make phase wait time deterministic 2010-03-29 21:51:36 +00:00
adamdunkels b4b7e942b6 Back off a guard time for every non-ack packet 2010-03-29 21:50:01 +00:00
nifi 9508d2c4d7 * Added configurable default number of transmissions for CSMA to use when not specified using packetbuf attributes (CSMA_CONF_MAX_MAC_TRANSMISSIONS).
* Renamed packetbuf attribute PACKETBUF_ATTR_MAX_MAC_REXMIT to PACKETBUF_ATTR_MAX_MAC_TRANSMISSIONS where value 0 (attribute not set) means that default number of transmissions should be used.
2010-03-26 12:29:29 +00:00
adamdunkels 49009e9cbd Extend the length of announcement packets if they are too short 2010-03-19 13:24:58 +00:00
adamdunkels 115b3a7c5c Minor timing bugfix: the time between channel checks should not include the time required for the channel check itself 2010-03-17 18:24:06 +00:00
adamdunkels efeb9944fa Increase the required non-activity periods before turning off the radio; remove the strict phase requirement (which messes up things with low-power streaming) 2010-03-17 16:35:52 +00:00
adamdunkels 9be1a65211 Don't set the RELIABLE flag on incoming packets with the ack requested flag set, since it is set on most packets even if they aren't reliable 2010-03-16 18:11:58 +00:00
adamdunkels b1feac5a00 Bugfixes in low-power streaming mode, and re-added support for announcements. These now use the low-power streaming mode so that active listening for announcments have a radio duty cycle of 16% rather than 100% 2010-03-16 18:11:13 +00:00
adamdunkels 7bab9316da Two major changes:
* Low-power streaming. Experimental support for a low-power mode which
  allows rapid exchange of packets with a 16% duty cycle. Does not
  seem to function correctly yet though.

* Phase locking. When the phase of a neighbor has been detected, the
  sender assumes that the neighbor will keeps it phase and does not
  send more strobes than necessary to hit the receiver's channel
  check - even if the receiver does not acknowledge the reception of
  the strobes when it should have been awake. Instead, the sender
  stops strobing and tries again at a later time.
2010-03-14 22:59:23 +00:00
oliverschmidt def540e6c0 Avoid newlines in macro expansions as cc65 doesn't support them between the macro name and the open parenthesis of the arguments.
There were btw other even longer lines with expansions of the same macro already present.
2010-03-14 12:13:54 +00:00
nifi 2cf0fb9cce Changed to use short address mode with short rime addresses 2010-03-12 14:49:21 +00:00
adamdunkels 4b60301727 Don't set the ack flag for broadcast packets 2010-03-09 20:40:11 +00:00
adamdunkels 17f6b3a324 Simplified the structure of the code 2010-03-09 20:38:55 +00:00
adamdunkels d0e6436a20 Don't call up the netstack if the transmission was deferred 2010-03-09 20:37:02 +00:00
adamdunkels edda6dd86c Minor bugfix: don't subtract collisions and deferrals from the number of transmissions 2010-03-09 13:23:58 +00:00
adamdunkels 2c3d3e3d73 Bugfix: handle deferred transmissions correctly (don't count them) 2010-03-09 13:20:08 +00:00
adamdunkels 79722b4247 Rework of the timing conditions of ContikiMAC: the old timing did not work well on real hardware, the new one seems to work better 2010-03-09 13:19:05 +00:00
nvt-se 96eb20d235 forward arguments even if REXMIT is not set 2010-03-04 14:17:43 +00:00
nifi 5e43a6998b Replaced old framer (framer_get/framer_set) with new NETSTACK style configuration. Added nullrdc-framer that is a nullrdc with framer support. 2010-03-01 13:30:21 +00:00
nifi 0c084b8c68 added random init of sequence number 2010-03-01 13:17:01 +00:00
adamdunkels 410d860a93 Improved handling of neighbor phase estimation: instead of busy-waiting while waiting for neighbor's phase, the new code schedules a timer just before neighbor wakes up 2010-02-28 20:19:47 +00:00
adamdunkels e6fceb7200 Added MAC-layer return value to indicate that a packet transmission was deferred 2010-02-28 20:18:30 +00:00
adamdunkels e06acc4525 Prod the watchdog if waiting for along time 2010-02-28 14:15:16 +00:00
adamdunkels 74da90a06b Don't count collisions as transmissions 2010-02-28 10:07:17 +00:00
adamdunkels b6b4941871 Made the number of MAC-layer retransmissions configurable on a per-packet basis, via a packet attribute 2010-02-28 08:35:16 +00:00
adamdunkels ed88f487c8 Improved detection of link-layer ACKs; increased the time ContikiMAC waits when it has detected a link-layer ACK; increased the number of silence periods required to detect a CCA false positive 2010-02-28 08:33:21 +00:00
nifi b50d47fb80 added missing function in sicslowmac_driver 2010-02-23 22:45:11 +00:00
nifi 1cfcc8a73a Removed the combined name of CSMA and NETSTACK_RDC. The name of NETSTACK_RDC can be accessed separately if needed. 2010-02-23 20:42:45 +00:00
nifi c20047f657 Changed the network stack to use different structures for the different layers (network_driver, mac_driver, rdc_driver, radio_driver). This helps to avoid incorrect configuration. 2010-02-23 20:09:11 +00:00
adamdunkels bb62749de7 Made debug printfs optional 2010-02-23 18:49:58 +00:00
adamdunkels 0ab2ba433f Bugfix: the wrong callback pointer was passed to higher layers. 2010-02-23 18:49:45 +00:00
adamdunkels ed52586e18 Rework of parts of the ContikiMAC code based on input from experimental results. When channel check is triggered because of a false positive, the new version checks the radio several times to make sure that there really is an incoming packet. Otherwise, the radio is switched off. Cleaned up and removed old unused code. Added a few temporary debugging mechanisms and functions. 2010-02-23 18:49:05 +00:00
adamdunkels 0b2b7bcdba Removed inadvertedly left-over include file 2010-02-18 23:52:34 +00:00
adamdunkels e34eb54960 A work-in-progress rework of the Contiki MAC and radio layers. The
main ideas are:

* Separates the Contiki low-layer network stack into four layers:
  network (e.g. sicslowpan / rime), Medium Access Control MAC
  (e.g. CSMA), Radio Duty Cycling RDC (e.g. ContikiMAC, X-MAC), and
  radio (e.g. cc2420).
* Introduces a new way to configure the network stack. Four #defines
  that specify what mechanism/protocol/driver to use at the four
  layers: NETSTACK_CONF_NETWORK, NETSTACK_CONF_MAC, NETSTACK_CONF_RDC,
  NETSTACK_CONF_RADIO.
* Adds a callback mechanism to inform the MAC and network layers about
  the fate of a transmitted packet: if the packet was not possible to
  transmit, the cause of the failure is reported, and if the packets
  was successfully transmitted, the number of tries before it was
  finally transmitted is reported.
* NULL-protocols at both the MAC and RDC layers: nullmac and nullrdc,
  which can be used when MAC and RDC functionality is not needed.
* Extends the radio API with three new functions that enable more
  efficient radio duty cycling protocols: channel check, pending
  packet, and receiving packet.
* New initialization mechanism, which takes advantage of the NETSTACK
  #defines.
2010-02-18 21:48:39 +00:00
adamdunkels f8c804e28b ntikiMAC: a new radio duty cycling mechanism that uses a combination
of link-layer and MAC-layer mechanisms to achieve a very low power
consumption: during idle listening the radio is switched off between
99.2% and 99.6% of the time. One unicast transmission typically adds
between 0.07% and 1.2% additional radio time, depending on packet
size.

ContikiMAC uses the standard IEEE 802.15.4 message format and adds no
additional headers.

ContikiMAC is simple: it uses periodic two-shot channel sampling
during idle listening to keep the radio on-time down. Transmissions
are done with repeated transmissions until a link-layer ACK is
received.
2010-02-18 21:26:15 +00:00
adamdunkels f5c48751b5 Reworked 802.15.4 header creation and parsing so that it works regardless of the size of the rimeaddr_t typedef 2010-02-18 21:00:28 +00:00
adamdunkels 2fbf21b2b3 Refactored the phase optimization functionality into a separate module 2010-02-18 20:58:59 +00:00
adamdunkels 75e1c0c8c7 Include contiki-conf.h to let the MAC channel check rate be configurable 2010-02-03 16:45:12 +00:00
adamdunkels 06d17c7e1c Remove unused rtimer code 2010-02-03 16:44:43 +00:00
adamdunkels e419eb3cc5 Retransmit packet if it didn't receive a MAC layer ack 2010-02-03 01:17:54 +00:00
adamdunkels d68af249ec Added a MAC layer return value that informs the caller that a packet did not receive a MAC layer acknowledgement 2010-02-03 01:17:32 +00:00
adamdunkels 181213124b Added a configuration option for setting the MAC channel check rate (which must be a power of two). The configuration is independent of the MAC protocol. 2010-02-02 23:28:58 +00:00
adamdunkels fcf60e9260 Removed the csma_init declaration in the mac_driver struct since it isn't needed and it breaks sdcc 2010-02-02 20:45:58 +00:00
adamdunkels cc2be0f111 Remove compiler warnings 2010-02-02 16:33:07 +00:00
adamdunkels 1a13d25d33 Revised version of the X-MAC implementation that uses a ctimer instead
of an rtimer for the periodic radio duty cycling. The benefit of this
implementation is that it leaves an rtimer free for user tasks. The
drawback is a slightly higher idle power consumption. This new version
is based on the current rtimer-based X-MAC.
2010-01-31 18:44:23 +00:00
adamdunkels e4168db633 Bugfix: deallocate queuebuf only if there was no collision 2010-01-31 13:55:36 +00:00
adamdunkels 2ae7ed827c Increase the default X-MAC channel check rate to 4 Hz instead of 2 Hz 2010-01-28 13:40:47 +00:00
adamdunkels 8430dab039 Typecast to fix nightly build problem 2010-01-27 07:36:31 +00:00
adamdunkels 4f3e8d565c Added a simple CSMA (Carrier Sense Multiple Access) mechanism that
works on top of an underlying duty cycling mechanism. The CSMA layer
retransmits packets that could not be sent because of a collision was
detected.
2010-01-25 11:46:44 +00:00
adamdunkels 7ad93e5d18 Added a field to the struct mac interface:
channel_check_interval(). This function returns the interval by which
the duty cycling mechanism checks the radio channel for activity. It
is used by higher layer mechanisms to determine suitable timeouts for
retransmissions.
2010-01-25 11:43:32 +00:00
adamdunkels 743e93e650 Do not remove encounters - there is no need to, as they are only an optimization 2010-01-14 20:14:03 +00:00
adamdunkels 2f105e933a Variable xmac_is_on was used both in interrupt and non-interrupt contexts and needs to be volatile 2009-12-06 23:29:38 +00:00
adamdunkels 53457eb1f0 Fixed compilation warning 2009-12-06 17:10:54 +00:00
adamdunkels 8bcc838d8a Bugfix: don't set the 'we are sending' flag until we are actually sending 2009-12-06 17:05:45 +00:00
adamdunkels 6897270289 Bugfix to the Contiki LPP encounter timing code: encounters are now
properly timed.
2009-12-06 13:18:32 +00:00
adamdunkels 822149f943 Significant improvements to the Contiki X-MAC:
* the code is simplified, particularly the duty cycling logic
* old unused code has been removed
* Contiki X-MAC now listens before sending a strobe to avoid MAC-level
  collisions
* broadcasts are sent directly, without strobes, reducing the power
  consumption of receivers
* turn off radio for 1 ms between sending a strobe and expecting the
  strobe ack
2009-12-06 13:16:59 +00:00
adamdunkels cef2e65c9b Added an error type for signalling a MAC-layer collision 2009-12-05 21:49:51 +00:00
adamdunkels 4a1a823a49 Code style fix 2009-12-05 13:29:41 +00:00
fros4943 a1b4597b95 fixed announcement compilation error 2009-11-27 14:27:50 +00:00
adamdunkels aeefa75304 Fixed alignment problems in announcement packet creation 2009-11-27 12:49:27 +00:00
fros4943 0034fd7bca generic return values for sent packet 2009-11-13 10:09:02 +00:00
fros4943 26bb5ecd21 added radio and MAC generic return values to allow applications finding out whether the packet was transmitted 2009-11-13 08:59:22 +00:00
adamdunkels 70fc23ac7e Enable stream mode by default, remove LED debug mode 2009-11-04 16:02:45 +00:00
adamdunkels 5aab2eb77d A simple addition with significant performance implications:
sicslowpan tags TCP packets with the PACKETBUF_ATTR_PACKET_TYPE_STREAM
flag, which makes the underlying power-saving MAC layer keep the radio
on for some time after transmitting the packet. This allows reply
packets to be processed directly, significantly increasing TCP latency
and throughput.
2009-11-02 11:58:56 +00:00
nifi 223fa1c8e5 added missing include 2009-10-20 07:42:03 +00:00
adamdunkels 7cdfbca973 Alignment problems with announcements fixed 2009-10-19 21:27:02 +00:00
adamdunkels 9ec57d61ad Added MAC layer framing support to X-MAC so that packets now are standard 802.15.4 frames 2009-10-19 20:53:56 +00:00
adamdunkels 4de1816e36 Added a new module called "framer" that creates MAC level frames to
the packetbuf from packet attributes. Two framer modules are included,
one that creates 802.15.4 frame headers, and one that creates a
minimal "nullmac"-style header that only contains the link-local
addresses.
2009-10-19 18:30:03 +00:00
nifi ae226c5917 * Set sender and receiver packet attributes on incoming packets
* Added link layer destination check
2009-10-19 11:25:54 +00:00
adamdunkels 10c873018d Ensure that DEFAULT_PERIOD is != 0, to avoid a modulo with 0 2009-10-19 06:39:29 +00:00
adamdunkels 9d26bd663e A new optimization to X-MAC: senders now keep track of when neighbors
last were known to be awake. When sending a packet, a sender does not
start to send strobes until the neighbor is expected to be awake. This
reduces power consumption for senders and decreases the contention in
the network as there are less packets in the air. Additionally, the
ACK optimization was improved so that data/ack exchanges now are
more efficient.
2009-10-18 13:19:25 +00:00
nifi 0ad51b8dcc Moved the link layer destination check to sicslowmac 2009-09-18 16:37:17 +00:00
adamdunkels 2181e90f69 Added the possibility to switch lpp off. Fixed sdcc compiler issue 2009-09-09 21:09:23 +00:00
adamdunkels 1cafbc6002 sdcc compiler issue fix: compound assignments are not supported, so we use memcpy() instead 2009-09-09 21:08:46 +00:00
nvt-se 4d21a3e203 Don't assume that radio->send turns on the radio automatically. 2009-09-04 10:59:30 +00:00
adamdunkels 522f991f14 Set sender and receiver packet attributes on incoming packets: patch by Gidon Ernst 2009-08-20 18:59:17 +00:00
nifi 912aba7280 added init function in MAC driver for easier configuration 2009-06-22 11:14:11 +00:00
nifi f39d2bd4c6 Fixed link panid for broadcasts to be standard compliant. Ignore packets addressed to other non-broadcast panids. 2009-05-26 12:08:29 +00:00
adamdunkels fe5a1f1068 Added an optimization option that avoids multiple simultaneous broadcasts from neighbors: when a broadcast is to be sent, a sender does not send until it knows that no other nodes are broadcasting. 2009-05-10 21:09:05 +00:00
adamdunkels 0adceb63b4 Code cleanup; made encounter optimization explicit; added optimization for adaptive off-time, but it currently seems to work bad with broadcasts 2009-05-06 15:06:38 +00:00
adamdunkels 9fff85757d Code cleanup; made strobe transmission time longer again (seems to work better in cooja?) 2009-05-06 15:05:28 +00:00
adamdunkels cc44e89415 Reduced default strobe time, which seems to work well. Avoid running the interrupt if the power-save feature is turned off (fixes problems with serial data reception on a gateway mote) 2009-04-29 11:42:13 +00:00
adamdunkels 81ef83b856 Added option to wait randomly before sending a packet. A few code cleanups. Avoid switching radio off when sending a packet with end-to-end acks, because an ACK may arrive shortly after the transmission. 2009-04-28 14:00:53 +00:00
nifi 84b38de494 removed bitfields for compatibility with cc65 2009-04-09 21:54:09 +00:00
nvt-se 03cd533712 made LISTEN_TIME and OFF_TIME configurable. 2009-04-07 11:29:08 +00:00
adamdunkels 5e456aea7d Added optimization for sending ACKs immediately. Turned optimizations on. Increased listening time to 1/64 s again due to problems with broadcasts with the 1/128 s setting 2009-04-06 22:50:35 +00:00
nifi 9f2ff48fda added 802.15.4 frame packeter 2009-04-06 13:19:03 +00:00
adamdunkels ed1e945e66 Added guard code so that OFF_TIME is never zero 2009-04-03 20:08:05 +00:00
adamdunkels 8dbd2b2337 Significant power consumption optimization: LPP now keeps track of encounters with neighbors and uses this information to keep the radio switched off longer. 2009-04-03 19:59:22 +00:00
adamdunkels 1d86b01bfb Made optimizations explicit (and configurable). Added missing initialization of dutycycle protothread. Reduced default listen time and off time. 2009-04-03 11:45:06 +00:00
adamdunkels 04101aae36 Fixed alignment problem on the MSP430, where the LPP header may be misaligned 2009-03-31 17:39:54 +00:00
nvt-se e2cc8b2a3e send all queued packet once we have the chance. 2009-03-31 14:44:13 +00:00
nvt-se 1d47e2a8da send immediate probes only if the packet is directed to us.
sleep for OFF_TIME if the queue is empty.

restrict double packet lifetime timeouts to unicast packets.

stop ctimer in remove_queued_packet in case the function is not called
via the ctimer callback. it could overwrite a valid packet otherwise.
2009-03-31 14:11:25 +00:00
nvt-se dd082f7fcf improvements to lpp based on code from Adam and discussions with Thiemo.
* queue multiple packets
* send a strobe back immediately after receiving a data packet
* double the packet lifetime to allow for a missed probe
2009-03-31 12:47:00 +00:00
nvt-se d8caaca289 listen time and off time parameters configurable from outside because cc1020 needs longer listen time. 2009-03-26 12:50:57 +00:00