Change openthread parameters using BLE

I'm working with NCS 2.2.0 and a nrf52840DK. The project base is this one and it is working in NCP mode.

I  enable multiprotocol with BLE and it's working but my next objetive is to change a parameter from OpenThreat network (channel for example).

What libraries do I have to include? I have been investigating and included this:

#include <openthread/instance.h>
#include <openthread/channel_manager.h>

So now I can create an instance of OT to change his channel:

static otInstance *instance_1;

otChannelManagerRequestChannelChange(instance_1, 20);

But why I need to create an instance if openthread is working before adding the code I attached here. How can I know the instance name that is working?

  • Hello,

    But why I need to create an instance if openthread is working before adding the code I attached here.

    I think this is the issue. The otInstance that you just tried to change the channel on is not an actual OpenThread Instance. Try something like this:

    otInstance *instance = openthread_get_default_instance();
    otChannelManagerRequestChannelChange(instance, 20)

    You can see this being used e.g. in coap_client_utils.c.

    Best regards,

    Edvin

Related