Commit graph

223 commits

Author SHA1 Message Date
fros4943 12b6f35ce7 PRINTF()ed debugging output 2010-04-27 12:56:35 +00:00
nifi 85d6f6c514 removed unused variable 2010-04-26 22:41:50 +00:00
nifi b26f45a35b code cleanup 2010-04-26 17:55:11 +00:00
nifi d761b6e89a Added MAC header to handle padding 2010-04-26 17:46:21 +00:00
nifi 14b1bb9f57 Fixed to only use leds when DEBUG is set 2010-04-20 11:41:16 +00:00
adamdunkels 3670fac618 Bugfix: timing fixed 2010-04-08 18:23:24 +00:00
adamdunkels 91ff8574ad Improved handling of duplicate packets 2010-04-08 09:32:56 +00:00
nvt-se ac4ba199bc Turn off DEBUG mode by default. 2010-04-06 21:37:54 +00:00
adamdunkels 497111bcc9 Added an optional rate limit for broadcast transmissions 2010-04-06 11:57:43 +00:00
adamdunkels e06a30fdb0 Added MAC-layer duplicate message suppression, which is very helpful when running with duty cycling turned off 2010-04-05 19:28:07 +00:00
adamdunkels c68ee6e577 Bugfix: memory from the wrong memb was freed. 2010-04-04 21:02:09 +00:00
adamdunkels a4c328785a Small timing tweaks 2010-04-04 21:01:24 +00:00
adamdunkels 62039a530d Removed non-existant cooja-debug.h include 2010-04-04 12:31:47 +00:00
adamdunkels 7d6ff0289e Fiddled more with the timing: the phase seems stable now at least. Still bugs left though... 2010-04-04 12:28:29 +00:00
adamdunkels be117afe04 After a lot of tweaking and twiddling with the timing of the ContikiMAC code and the mechanisms in the CC2420 driver, things seem to work somewhat stable now - knock on wood! 2010-04-04 07:49:30 +00:00
adamdunkels 121ca946e1 Improved phase lock behaviour when neighbor is not duty cycling: senders notify receivers via the 802.15.4 pending bit that they are not duty cycling. Neighbors then will start sending packets immediately and not wait for neighbors' phase. Tweaking of ContikiMAC timers to make it more reliable. 2010-04-03 13:28:30 +00:00
joxe 6ae86d001d made number of phase neighbors configurable 2010-04-01 17:17:36 +00:00
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