It has been said that Nordic SDK v4.1.0 for Thread is in maintenance mode. I was told that I should move new Thread development to nRF Connect SDK. I am trying to explore that.
I try to call the same OpenThread API functions that I used in the SDK for Thread such as
otDatasetIsCommissioned(openthread_get_default_instance())
and it crashes.
I stumbled upon OpenThread integration in the documentation. This long and complex description is of how Openthread is integrated into Zephyr OS into nRF Connect SDK. This is not at all equivalent. How is my application supposed to perform my own joining or handling of thread state changes?
On the above page, it says "From the architecture perspective, the L2 layer is using the nRF IEEE 802.15.4 radio driver, which is located underneath the L2 layer. It can also optionally use Zephyr’s IPv6 stack, which is located above it. The OpenThread API and IPv6 stack can be used directly, but by default, Zephyr’s IPv6 stack is used."
I cannot find anywhere in that huge description of how to 'disable' or 'enable' this optional feature. The openthread examples are of no help, they simply call
openthread_start(openthread_get_default_context());
which hides all the details.
I am confused about what is and is not possible / supported with the Openthread in the nRF Connect SDK.
EDIT:
Let me add... The crash I was experiencing appears to be due to stack size. The stack that was calling
otDatasetIsCommissioned() had a stack size of 1024, I needed to increase it to 2048.
I have made further progress, but am now stuck on another issue...
(CONFIG_OPENTHREAD_MANUAL_START=y is set)
I have a task which calls the following:
error = otIp6SetEnabled(ot_instance, true);
__ASSERT_NO_MSG(error == OT_ERROR_NONE);
// Must reset to 0xFFFF or it only tries to join default panid
error = otLinkSetPanId(ot_instance, 0xFFFF);
__ASSERT_NO_MSG(error == OT_ERROR_NONE);
error = otJoinerStart(ot_instance, "TEST1234", NULL, "VENDOR", "MODEL", "SWVER", NULL, joiner_callback, NULL);
__ASSERT_NO_MSG(error == OT_ERROR_NONE);
...
The joiner_callback is never invoked. And on the packet sniffer, I never see a discover sent.
However, if I call 'ot joiner start TEST1234" from the CLI, it works fine!
This code flow worked under SDK for Thread v4.1.0