Skip to content

Conversation

daniel-k
Copy link
Member

@daniel-k daniel-k commented Jun 1, 2015

When enabling CSMA it defaults to 4 retries and sets min BE to 3 and max BE 5. I'm not sure if these are sensible defaults, they are the reset values of the transceiver.

The BE cannot yet be configured though. I wasn't sure how to integrate the BE setting into the given interfaces, so any proposal is welcome!

I'm not sure if there is a way to test and verify this in the current state, but I've got more changes in the pipe that depend on this (namely TX feedback, see #3125).

@@ -754,7 +754,7 @@ int kw2xrf_set(ng_netdev_t *netdev, ng_netconf_opt_t opt, void *value, size_t va
((bool *)value)[0]);
return sizeof(ng_netconf_enable_t);

case NETCONF_OPT_AUTOCCA:
case NETCONF_OPT_CSMA:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change intensional?
nvm

@jonas-rem
Copy link
Contributor

When enabling CSMA it defaults to 4 retries and sets min BE to 3 and max BE 5. I'm not sure if these are sensible defaults, they are the reset values of the transceiver.

The IEEE 802.15.4 (2011) standard also defines them as standard values. However, if one want to send out data at a precise time, without (unpredictable) delay, BE should be set to 0. Figure 11 (p. 23) in the IEEE 802.15.4 standard shows that the backoff-wait is performed always initially before CCA (and of course later again, if the channel was busy).

Since this behaviour could be of interest for other MAC-protocols and is "hidden" in HW in this Atmel device, we should maybe document that somewhere in the driver. I think e.g. Contiki-MAC would expect a min BE value of 0 to avoid any delays before sending.

The wait-time, after which the packet will be send again, is defined as:

  • random(2^(BE–1)) * backoffPeriod
  • backoffPeriod = 320µs

@daniel-k
Copy link
Member Author

daniel-k commented Jun 1, 2015

Since this behaviour could be of interest for other MAC-protocols and is hidden "hidden" in HW in this Atmel device, we should maybe document that somewhere in the driver. I think e.g. Contiki-MAC would expect a min BE value of 0 to avoid any delays before sending.

That's actually a very good point. I wasn't aware that the random backoff wait is already active before the first attempt to transmitting. As I'm aiming for a MAC layer is even more important to me.

So in the first step it would be ok for me to have minBE=0 as a default, but I guess this should be configurable somehow. While going through all the interfaces involved, I still fail to find a good place for this, as it's really hardware specific and maybe not well placed as a NETCONF option.

What do you say?

@jonas-rem
Copy link
Contributor

yes, I guess making this option configurable is a good idea.

I actually think it should be an ordinary NETCONF option. All devices that implements CSMA/backoff in hardware will be able to set this option. All other devices simply don't implement it and will automatically return -ENOTSUP by design. But we should clarify in the documentation, that this option is explicitly described as hardware-only function. If the option can not be set, the MAC layer has to handle the CSMA/backoff procedure. @haukepetersen do you agree?

To go further, this could even be an indication for the MAC layer to en/disable software CSMA/backoff.

@biboc biboc added this to the Release 2015.06 milestone Jun 2, 2015
@biboc biboc added the Area: drivers Area: Device drivers label Jun 2, 2015
@OlegHahm OlegHahm assigned haukepetersen and unassigned OlegHahm Jun 3, 2015
@OlegHahm
Copy link
Member

OlegHahm commented Jun 3, 2015

I'm without a computer for the next two and a half weeks - hence, someone else should review this.

@daniel-k
Copy link
Member Author

@OlegHahm ping

@OlegHahm OlegHahm assigned OlegHahm and unassigned haukepetersen Jun 28, 2015
* @brief Set the maximum number of channel access attempts per frame (CSMA)
*
* This setting specifies the number of attempts to access the channel to
* transmit a frame. If the channel is busy *retries* times, then frame
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@p retries

@OlegHahm OlegHahm added CI: needs squashing Commits in this PR need to be squashed; If set, CI systems will mark this PR as unmergable Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation labels Jul 1, 2015
before sending the channel is clear. */
NETCONF_OPT_CSMA, /**< en/disable to check automatically
* before sending the channel is clear. */
NETCONF_OPT_CSMA_RETRIES /**< get/set the number of retries when
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a semicolon, there were other options added below in the meanwhile.

@daniel-k daniel-k force-pushed the net_at86rf2xx_csma branch from d89b1ae to 91f8e27 Compare July 6, 2015 11:34
@daniel-k
Copy link
Member Author

daniel-k commented Jul 6, 2015

@jremmert-phytec-iot I updated the docs and now _AUTOCCA and _CSMA options exist both in parallel. But there is no "AUTOCCA-emulation" for at86rf2xx yet.

@thomaseichinger
Copy link
Member

Please rebase.

@OlegHahm
Copy link
Member

@daniel-k, willing to provide an extension to the ifconfig shell command to control this? If not, please rebase, squash, and send me a ping so I can test it.

@daniel-k daniel-k force-pushed the net_at86rf2xx_csma branch from 91f8e27 to 1f19589 Compare August 22, 2015 11:27
@daniel-k
Copy link
Member Author

Rebased. Will look into ifconfig now.

@daniel-k daniel-k force-pushed the net_at86rf2xx_csma branch from fec3841 to 58bc85d Compare August 22, 2015 11:31
@daniel-k
Copy link
Member Author

@OlegHahm
sc_netif.c has functions for setting u16 und i16 sized netopt options, while my new option NETOPT_CSMA_RETRIES expects uint8_t. I wonder now if I should expand my option to uint16_t or if I should add another function to sc_netif.c handling uint8_t. That would mostly depend on what those NETOPT options should look like in general.

@OlegHahm
Copy link
Member

I would suggest to add either a setter for uint8_t to the shell commands or see if you can come up with a unified setter function that take different widths.

@daniel-k
Copy link
Member Author

@OlegHahm
Shell controls are now implemented for enabling/disabling CSMA and setting retries. Waiting for (N)ACK now.

@OlegHahm
Copy link
Member

OlegHahm commented Sep 1, 2015

ACK. Please rebase and squash!

@daniel-k daniel-k added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: needs squashing Commits in this PR need to be squashed; If set, CI systems will mark this PR as unmergable labels Sep 1, 2015
@OlegHahm
Copy link
Member

OlegHahm commented Sep 1, 2015

You have to add a string representation of the new netopt types.

@daniel-k
Copy link
Member Author

daniel-k commented Sep 1, 2015

@OlegHahm string representations added and squashed again

OlegHahm added a commit that referenced this pull request Sep 1, 2015
ng_at86rf2xx: Implement CSMA en/disable and setting retries
@OlegHahm OlegHahm merged commit 3b4cc81 into RIOT-OS:master Sep 1, 2015
@daniel-k daniel-k deleted the net_at86rf2xx_csma branch September 16, 2015 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: drivers Area: Device drivers CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants