openthread icon indicating copy to clipboard operation
openthread copied to clipboard

OpenThread cannot work after using link raw API

Open KaSroka opened this issue 6 years ago • 1 comments

When after using link raw API we want to start Thread network it won't work correctly as radio would be left in disabled state.

To reproduce (see comments inline):

otError error;

error = otThreadSetEnabled(thread_ot_instance_get(), false);
ASSERT(error == OT_ERROR_NONE);

error = otIp6SetEnabled(thread_ot_instance_get(), false);
ASSERT(error == OT_ERROR_NONE);

error = otLinkRawSetEnable(thread_ot_instance_get(), true); // This call will try to enable already enabled radio - on some implementations it may fail
ASSERT(error == OT_ERROR_NONE);

error = otLinkRawSetEnable(thread_ot_instance_get(), false); // Radio will be disabled after this call 
ASSERT(error == OT_ERROR_NONE);

error = otIp6SetEnabled(thread_ot_instance_get(), true);  // Radio is enabled only in Mac constructor so it will remain disabled
ASSERT(error == OT_ERROR_NONE);

error = otThreadSetEnabled(thread_ot_instance_get(), true);
ASSERT(error == OT_ERROR_NONE);

To make it work we need to add call to otPlatRadioEnable before we enable Ip6/Thread and this should be avoided.

KaSroka avatar Jun 15 '18 08:06 KaSroka

@KaSroka, thanks for pointing this out. Are you willing to submit a PR to address this issue?

jwhui avatar Jul 09 '18 20:07 jwhui

Closing stale issue.

jwhui avatar Jun 27 '23 22:06 jwhui