-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
kw2xrf: CSMA support missing in driver #10364
Comments
Some pointers towards the kw41zrf implementation: TX initialization: CCA feedback using the CCAIRQ flag: |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions. |
I am working on this right now and there is one thing I don't understand;
Where are these timing parameters coming from? I have perused the MKW41Z/31Z/21Z Reference Manual but were not able to find them except Furthermore, why are these timing parameters even a thing? These parameters are currently used to start a timer, which is supposed to indicate whether the acknowledge frame in a TR-sequence has timed out. The timer is set BEFORE issuing the operation to hardware, using these timing parameters to estimate, when the TX operation will be complete and adding Why isn't the timer just set to |
These parameters result from the 802.15.4 specification. For example: 802.15.4 has a data rate of 250kbit/s. How long does it take to transmit one bit? 1 bit / 250kbit/s = 4 us and (1bit x 8) / 250kbps/s = 32us for one byte respectively. How does this relate to |
I don't understand. But in any way, please note that the driver that you are referring to is WIP and not part of the official RIOT master.
I'm not familiar with the implementation in that detail. Your concerns seem reasonable to me. Maybe @benemorius can shed light on the as he indicated to take over #7107. |
That's how it is. I checked it before. https://github.com/gebart/RIOT/blob/pr/kw41zrf/drivers/kw41zrf/kw41zrf.c#L177 |
Another thing; kw2xrf supports CSMA emulation via usage of automatic CCA is exactly what NETOPT_AUTOCCA defines and should be supported here.
Actually, according to the documentation, it is even WRONG to support NETOPT_CSMA here;
Neither kw2xrf nor kw41zrf support CSMA in hardware. None should support The advantage of supporting |
For efficiency's sake, for now I'll just throw out |
I was puzzled at first by the timer usage too. These radios have a tighter integration with software than others I've used. The use of the radio timer isn't just to fire callbacks in software. It's actually used to trigger events in the radio hardware like timing out an ACK wait for example. In other words:
Because the hardware waits to signal us the outcome of the TX operation until it has received an ACK or not, and the timer is what causes it to stop waiting for a missed ACK and signal us. At least that's the case with kw41zrf. It looks like kw2xrf does as you say where the hardware signals TX complete before waiting for ACK and only then the driver starts an ACK timer. It's possible that both radios could support either paradigm and the difference in the two drivers is just developers' preference. You could save an otherwise unnecessary interrupt here. My interpretation of NETOPT_AUTOCCA is that the clear channel assessment should be performed but NOT the retries. Meaning if CCA succeeds then the packet is transmitted but if it fails then the radio driver returns a medium-busy failure rather than retrying. I interpret NETOPT_CSMA to mean NETOPT_AUTOCCA plus retries. And you're right the documentation specifically says that it must be hardware CSMA support which is interesting. Is that because we have (or intend to have (or used to indend to have)) software CSMA retries implemented in an upper layer? And maybe it's getting implemented in netdev drivers because the upper layer implementation is missing so far? I haven't looked in to that. |
By the way there's a bug in the #7107 CSMA implementation that prevents any retransmissions from actually happening if the initial CCA fails. After But with that fixed I think it works as intended. |
@PeterKietzmann |
The kinetis hardware provides dedicated timers for CSMA. Although a SubMAC might solve the issue already using AutoCCA, a CSMA driver is missing which might reduce load. |
Originally posted by @PeterKietzmann in #10355
The kw2xrf driver does not support NETOPT_CSMA, but it does support NETOPT_AUTOCCA instead (and is currently the only driver which supports that flag)
The kw41z radio also does not support CSMA in hardware but only automatic CCA before TX (i.e. no automatic backoff and retry). The kw41zrf driver (#7107) implements CSMA exponential backoff and retry in software but utilizing the autocca hardware support. The same method could be used in the kw2xrf driver.
Whether the implementations can be shared between the two drivers or if it is better to reimplement the same behavior is left as an exercise to the reader.
The text was updated successfully, but these errors were encountered: