This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Problems with pre-configured Thread networks using dataset active

Hi All,
I am using nRF52833 to make a Thread end device, and encountered a problem with the Thread network configuration in NCS. I want the device to connect to the Thread network created by OTBR directly through the pre-set Thread dataset triggered by the external when it is produced and tested from the factory.
The method I used was to get the dataset of the OTBR via dataset active -x and then write it into the nrf52833 via otDatasetSetActiveTlvs. The Thread end device mode is MTD. My code is as follows.
char dataset[96] = {0x0e,0x08,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x03,0x00,0x00,0x0f,0x35,0x06,0x00,0x04,0x00,0x1f,0xff,0xe0,0x02,0x08,0xde,0xad,0x11,0x11,0xde,0xad,0x22,0x22,0x07,0x08,0xfd,0x57,0xf6,0x4f,0x4a,0x9c,0x89,0xe7,0x05,0x10,0x11,0x11,0x22,0x33,0x44,0x55,0x66,0x77,0x88,0x99,0xde,0xad,0x11,0x11,0xde,0xad,0x03,0x06,0x48,0x6f,0x6f,0x52,0x69,0x69,0x01,0x02,0xab,0xcd,0x04,0x10,0x49,0x67,0x41,0x73,0xac,0x27,0xf4,0xb2,0x66,0xe1,0x4c,0xd0,0x91,0xe4,0x96,0x79,0x0c,0x03,0x02,0xa0,0xff};

otThreadSetEnabled(a_ot_context->instance, false);
k_sleep(K_SECONDS(3));

memcpy(hoorii_aDataset.mTlvs, dataset, 96);
hoorii_aDataset.mLength = 96;
otDatasetSetActiveTlvs(a_ot_context->instance, &hoorii_aDataset);
k_sleep(K_SECONDS(1));

error = otThreadSetEnabled(a_ot_context->instance, true);
if (error != OT_ERROR_NONE) {
	NET_ERR("Failed to start the OpenThread network [%d]", error);
}
k_sleep(K_SECONDS(10));
Then if nrf52833 connect to the thread network of OTBR through this method, there is another problem, that is, 52833 will occasionally go back to the detached state, and then back to child state. If nrf52833 connect to the OTBR through normal commissioning, I don't have this problem, the connection is fast and the thread network is stable.
So I want to know why does the otDatasetSetActiveTlvs method take such a long time to connect and is not stable. Is there any other better way to connect to a preconfigured thread network?
Any guidance would be greatly appreciated. Thanks in advance.
Best,
Tao
Parents Reply Children
No Data
Related