-
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
OpenThread port #5552
OpenThread port #5552
Conversation
|
||
-ROOTDIR=${PREFIX}/ | ||
+#ROOTDIR=${PREFIX}/ | ||
+ROOTDIR=/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a conflict between mkversion's PREFIX and RIOT PREFIX variable. This is not the cleanest solution, but for now it's working.
For now the pkg is being cloned, compiled and the openthread library is copied in BINDIR. |
pkg/openthread/Makefile
Outdated
.PHONY: all | ||
|
||
all: git-download | ||
$($(PKG_BUILDIR)/bootstrap) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One tab should suffice here?
Just checking: Is this WIP? (If yes, we should set the label, if not, we should update the title.) |
Not WIP anymore (now is in test phase). Cheers! |
2 known bugs after testing with IotLAB:
Since the pkg version is outdated, I'm migrating to the latest to see if this fixes the problems. |
pkg/openthread/Makefile
Outdated
PKG_NAME=openthread | ||
PKG_URL=git://github.com/openthread/openthread.git | ||
PKG_VERSION=4779fb20eb6f027b4ca3ff56f58ee789829d72f8 | ||
PKG_BUILDDIR ?= $(BINDIRBASE)/pkg/$(BOARD)/$(PKG_NAME) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't exactly this line part of pkg.mk?
For testing with the phyNODE board I rebased the updated driver from #5469 on this PR. There are some minor adaptions necessary, which can be found at [1]. I tested with the branch at my Github [2]. Status:
However, when starting the commissioning procedure with start at both boards, they fail pair to each other. Both devices state that they are leader. When I try the same with two SAMR21 devices, everything works. @jia200x any idea whats going wrong? [1] - 92e5b91 |
Hi Jonas. I sometimes had that problem when the packets where not being forwarded to OpenThread via otPlatRadioReceiveDone (in function Also, I added a NETOPT_RX_LISTENING function in the driver for turning of the receiver. It's required by OpenThread, since does the rx/tx synchronization with otPlatRadioIdle, otPlatRadioReceive and otPlatRadioTransmit. If the driver triggers a RX_COMPLETE event while OT is in idle, unexpected results my occur. Can you turn on OpenThread debug and post the logs? This is done in file Cheers |
e0be1fa
to
d525f20
Compare
tested last commit on two SAMR21-xpro, works for me 👍 |
@jia200x, it seems this one needs some rebase ;) |
@aabadie Heavy rebase actually. I'm working on it :) 2016-08-01 18:38 GMT+02:00 Alexandre Abadie notifications@github.com:
|
{ | ||
netopt_enable_t enable = true; | ||
|
||
_dev->driver->set(_dev, NETOPT_RX_LISTENING, &enable, sizeof(enable)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jia200x what is the reason to not using set_state(NETOPT_STATE_IDLE)
? This method bypasses the radio driver state handling and requires modification of each radio driver implementations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Jonas.
In the current pkg version of OpenThread there's a race condition between Idle state and packet arrival.
When the driver is in NETOPT_STATE_IDLE, is listening to packets.
When OpenThread sends packets, it calls otPlatRadioIdle first and then otPlatRadioTransmit. From the first call it expects the driver to be Idle and with receiver off. If there's a packet arrival between otPlatRadioIdle and otPlatRadioTransmit, otPlatRadioTransmit will throw kThreadError_Busy. This case shouldn't be possible in the OT implementation, so it executes an assert(false) and crashes. Although this could be fixed by simulating driver states (and dropping packets), I added this option for easily enabling/disabling the receiver and making it work properly.
The new implementation of OpenThread doesn't have this race condition (otPlatRadioIdle is not needed anymore), so it shouldn't be necessary to implement this RX_LISTENING option (I don't know if it's useful for other applications). I'm currently working in the pkg update to deal with this.
Best.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Jose, ah ok, thx for your explanation! Then I'll wait for the pkg update and give it an other try then.
From the first call it expects the driver to be Idle and with receiver off.
But isn't the "Idle" state (NETOPT_STATE_IDLE) in the current RIOT netdev2 interface to put the transceiver in RX mode? Idle state with receiver off would be called NETOPT_STATE_SLEEP.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi again.
I will try to get the new pkg working asap.
Concerning the SLEEP state, is not exactly the same as IDLE without RX. Although the result is very similar, in SLEEP the device is in a low power mode with the transceiver off. It can't send packets unless it goes again to an awake state (SLEEP -> IDLE -> TX).
In the enable/disable rx option you are still able to send packets. OpenThread puts the device to Idle (rx off), then sends a packet in that state.
Also OpenThread expects to have a SLEEP state as well, that matches with NETOPT_STATE_SLEEP.
Anyway, in the new version of OpenThread this RX_LISTENING option becomes unnecessary since there's no race condition in packet sending/arrival.
Best.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it maybe possible to wrap this behavior device-agnostic in the glue-code layer between OT and netdev2?
@jia200x @aabadie
Known bug:
|
Enable debug to show bug fram too long
@aabadie Roger. I proposed Baptiste to push his PR directly, so I can use this one for the core part. I will post another one with the sock adoption. Cheers |
Do you mean that @biboc will open a new PR here with the core part ? That would be a good since GitHub has some lag with this huge thread ;) |
I meant, the FTD and MTD part. But anyway, If it's easier, I can open another PR for the core and coordinate with @biboc. |
Openthread FTD, MTD and NCP
With #7082 next to being merged: is this PR still needed? |
No I think we can safely close |
The line count indicates, that there is some code here, that isn't in #7082. So I close as memo. |
Hi.
This is the WIP PR for the port of OpenThread.
Best regards.