这次要实现一下Thread的Commissioning(入网)操作,我这边是以ESP32外挂NRF52840(RCP)作为Thread网络的初始节点(leader),并在需要Commissioning的时候启用Commissioner角色,并添加一块NRF52840的子设备入网.

正常来说,Thread典型应用下,Thread的专员一般是一部手机或者服务器,也就是在Thread网络外,是外部专员,通过边界路由器与Thread网络做通讯.但是因为我这边暂时没有做边界路由的计划,所以专员也必须是在Thread网络内部了.好在ESP32是可以连接WIFI的,所以也就相当于ESP32做为服务器的代理,在Thread网络中担任专员的角色,而服务器通过控制ESP32也能做到类似外部专员的效果.

我们现在做的就是ESP32作为专员的部分.因为现在网络里初始只有ESP32这一个设备,所以这种形式属于专员是本地专员,且专员到Joiner(加入者)之间只有一个无线电跳(没有通过其他Router(路由器))来中继.当然,这样的话Joiner Router也是ESP32,这样ESP32在Commissioning 过程中就同时是 Joiner Router跟Commissioner两种角色了.

首先在ESP32端,跟Commissioner角色作用有关的API在这个文件里能找到(esp-idf\components\openthread\openthread\include\openthread)

比较重要的就3个函数:

/**
 * This function enables the Thread Commissioner role.
 *
 * @param[in]  aInstance         A pointer to an OpenThread instance.
 * @param[in]  aStateCallback    A pointer to a function that is called when the commissioner state changes.
 * @param[in]  aJoinerCallback   A pointer to a function that is called with a joiner event occurs.
 * @param[in]  aCallbackContext  A pointer to application-specific context.
 *
 * @retval OT_ERROR_NONE           Successfully started the Commissioner service.
 * @retval OT_ERROR_ALREADY        Commissioner is already started.
 * @retval OT_ERROR_INVALID_STATE  Device is not currently attached to a network.
 *
 */
otError otCommissionerStart(otInstance *                 aInstance,
                            otCommissionerStateCallback  aStateCallback,
                            otCommissionerJoinerCallback aJoinerCallback,
                            void *                       aCallbackContext);

/**
 * This function disables the Thread Commissioner role.
 *
 * @param[in]  aInstance         A pointer to an OpenThread instance.
 *
 * @retval OT_ERROR_NONE     Successfully stopped the Commissioner service.
 * @retval OT_ERROR_ALREADY  Commissioner is already stopped.
 *
 */
otError otCommissionerStop(otInstance *aInstance);

/**
 * This function adds a Joiner entry.
 *
 * @param[in]  aInstance          A pointer to an OpenThread instance.
 * @param[in]  aEui64             A pointer to the Joiner's IEEE EUI-64 or NULL for any Joiner.
 * @param[in]  aPskd              A pointer to the PSKd.
 * @param[in]  aTimeout           A time after which a Joiner is automatically removed, in seconds.
 *
 * @retval OT_ERROR_NONE          Successfully added the Joiner.
 * @retval OT_ERROR_NO_BUFS       No buffers available to add the Joiner.
 * @retval OT_ERROR_INVALID_ARGS  @p aEui64 or @p aPskd is invalid.
 * @retval OT_ERROR_INVALID_STATE The commissioner is not active.
 *
 * @note Only use this after successfully starting the Commissioner role with otCommissionerStart().
 *
 */
otError otCommissionerAddJoiner(otInstance *        aInstance,
                                const otExtAddress *aEui64,
                                const char *        aPskd,
                                uint32_t            aTimeout);

其中设备本身默认是没有 Commissioner 角色的(毕竟整个Thread网络中一个时间下活跃的专员就一个,其他就设备就算能成为专员也是在候选状态).

所以,在开始Commissioning操作的时候先要让本机成为专员.就是调用otCommissionerStart()函数,这个函数有两个回调,也有点用处,这个稍后再说.

另外成为了专员后需要告诉设备待添加的设备(Joiner)信息.就需要用到otCommissionerAddJoiner()函数,函数内的EUI64是可选的,可以填NULL,但是Pskd是必填的,如果不填EUI64的话,就是只要待添加的设备的Pskd对上了就能入网,这样的话多个待添加设备的Pskd可以是一样的,然后谁在待添加状态(Joiner角色)谁就能被添加,如果填了EUI64的话就必须EUI64与Pskd都对上了才能添加.

在这边我当初调试的时候有个失误,我当初是直接调用完otCommissionerStart()下一行就直接调用otCommissionerAddJoiner()来添加Joiner信息,然后会在待添加设备变为Joiner角色开头几秒在ESP32的log上输出一个警告:

<wrn> net_openthread: [WARN]-MLE-----: Failed to process Discovery Request: Security

这个问题当初我查了谷歌说是有两个可能:

一个是Thread网络没开启Commissioning功能,然后又在ESP32找了一通宏定义,发现没啥需要再开的了,能开的都开了(就是在make menuconfig里的Component config里的OpenThread里的Enable Commissioner这个勾要勾上).

一个是ESP32端这边没有活跃的网络数据(就是cil的时候dataset active打印的那个数据).这个检查比较简单,也很容易排除,后来在发现原来是如果刚调用otCommissionerStart()函数后马上调用otCommissionerAddJoiner()的话,因为专员不是马上能成为的,是得先成为候选专员,然后再成为专员,总之是有一个过程,在没成为专员之前,调用了otCommissionerAddJoiner()就会失败.所以需要做的是在otCommissionerStart()之后监听这个函数的aStateCallback回调函数,看其状态在什么时候变成了OT_COMMISSIONER_STATE_ACTIVE,然后再调用otCommissionerAddJoiner()添加你需要添加的Joiner信息就可以了.

然后是第二个坑,上面的事情做完后,再添加一次,这次的log是这样的:


  [0;32mI(30489) OPENTHREAD:[INFO]-MESH-CP-: sent petition
I(30489) OPENTHREAD:[INFO]-MESH-CP-: CommissionerState: disabled -> petition
E (30509) ot_utils: CommissionerStateCallback:OT_COMMISSIONER_STATE_PETITION


[16:12:49.287]收←◆I(30569) OPENTHREAD:[INFO]-MESH-CP-: received petition
I(30569) OPENTHREAD:[INFO]-MESH-CP-: sent petition response
I(30569) OPENTHREAD:[INFO]-MESH-CP-: received Leader Petition response

I(30579) OPENTHREAD:[INFO]-MESH-CP-: CommissionerState: petition -> active
E (30599) ot_utils: CommissionerStateCallback:OT_COMMISSIONER_STATE_ACTIVE
I(30599) OPENTHREAD:[INFO]-CORE----: Notifier: StateChanged (0x00800201) [Ip6+ NetData CommissionerState] 
I(30619) OPENTHREAD:[INFO]-MLE-----: Send Data Response (ff02:0:0:0:0:0:0:1)
I(30639) OPENTHREAD:[INFO]-MAC-----: Sent IPv6 UDP msg, len:103, chksum:abad, to:0xffff, sec:no, prio:net
I(30639) OPENTHREAD:[INFO]-MAC-----:     src:[fe80:0:0:0:cc9d:2902:4a06:11df]:19788
I(30659) OPENTHREAD:[INFO]-MAC-----:     dst:[ff02:0:0:0:0:0:0:1]:19788

[16:12:49.505]收←◆I (30789) ot_utils: otCommissionerAddJoiner
I(30789) OPENTHREAD:[INFO]-MESH-CP-: sent MGMT_COMMISSIONER_SET.req to leader
I(30789) OPENTHREAD:[INFO]-MESH-CP-: Added Joiner (any, 123456)

[16:12:50.287]收←◆I(31569) OPENTHREAD:[INFO]-MESH-CP-: sent commissioning dataset set response
I(31569) OPENTHREAD:[INFO]-MESH-CP-: received MGMT_COMMISSIONER_SET response
I(31579) OPENTHREAD:[INFO]-CORE----: Notifier: StateChanged (0x00000200) [NetData] 
I(31589) OPENTHREAD:[INFO]-MLE-----: Send Data Response (ff02:0:0:0:0:0:0:1)
I(31599) OPENTHREAD:[INFO]-IP6-----: Added unsecure port 1000
I(31599) OPENTHREAD:[INFO]-MESH-CP-: Joiner Router: start
I(31629) OPENTHREAD:[INFO]-MAC-----: Sent IPv6 UDP msg, len:103, chksum:de2a, to:0xffff, sec:no, prio:net
I(31629) OPENTHREAD:[INFO]-MAC-----:     src:[fe80:0:0:0:cc9d:2902:4a06:11df]:19788
I(31639) OPENTHREAD:[INFO]-MAC-----:     dst:[ff02:0:0:0:0:0:0:1]:19788

[16:12:54.022]收←◆I(35299) OPENTHREAD:[INFO]-MAC-----: Received IPv6 UDP msg, len:56, chksum:02fc, from:66a4b915aa38dba9, sec:no, prio:net, rss:-28.0
I(35299) OPENTHREAD:[INFO]-MAC-----:     src:[fe80:0:0:0:64a4:b915:aa38:dba9]:19788
I(35319) OPENTHREAD:[INFO]-MAC-----:     dst:[ff02:0:0:0:0:0:0:2]:19788
I(35329) OPENTHREAD:[INFO]-MLE-----: Receive Discovery Request (fe80:0:0:0:64a4:b915:aa38:dba9)
I(35329) OPENTHREAD:[INFO]-MLE-----: Delay Discovery Response (fe80:0:0:0:64a4:b915:aa38:dba9)

[16:12:54.291]收←◆I(35569) OPENTHREAD:[INFO]-MLE-----: Send delayed message (fe80:0:0:0:64a4:b915:aa38:dba9)
I(35599) OPENTHREAD:[INFO]-MAC-----: Sent IPv6 UDP msg, len:89, chksum:74c6, to:66a4b915aa38dba9, sec:no, prio:net
I(35599) OPENTHREAD:[INFO]-MAC-----:     src:[fe80:0:0:0:cc9d:2902:4a06:11df]:19788
I(35609) OPENTHREAD:[INFO]-MAC-----:     dst:[fe80:0:0:0:64a4:b915:aa38:dba9]:19788

[16:12:58.880]收←◆I(40159) OPENTHREAD:[INFO]-MAC-----: Received IPv6 UDP msg, len:63, chksum:db18, from:0b6655b658a1d991, sec:no, prio:normal, rss:-28.0
I(40159) OPENTHREAD:[INFO]-MAC-----:     src:[fe80:0:0:0:966:55b6:58a1:d991]:1000
I(40169) OPENTHREAD:[INFO]-MAC-----:     dst:[fe80:0:0:0:cc9d:2902:4a06:11df]:1000
I(40189) OPENTHREAD:[INFO]-MESH-CP-: JoinerRouter::HandleUdpReceive
I(40189) OPENTHREAD:[INFO]-MESH-CP-: Sent relay rx
I(40199) OPENTHREAD:[INFO]-MESH-CP-: Starting new session with Joiner (any, 123456)
E (40199) ot_utils: CommissionerJoinerCallback:OT_COMMISSIONER_JOINER_START
I(40219) OPENTHREAD:[INFO]-MESH-CP-: Received Relay Receive (096655b658a1d991, 0x6c00)
I(40219) OPENTHREAD:[INFO]-MESH-CP-: DTLS started
I(40219) OPENTHREAD:[INFO]-MESH-CP-: Received relay transmit
I(40259) OPENTHREAD:[INFO]-MAC-----: Sent IPv6 UDP msg, len:63, chksum:d916, to:0b6655b658a1d991, sec:no, prio:net
I(40259) OPENTHREAD:[INFO]-MAC-----:     src:[fe80:0:0:0:cc9d:2902:4a06:11df]:1000
I(40269) OPENTHREAD:[INFO]-MAC-----:     dst:[fe80:0:0:0:966:55b6:58a1:d991]:1000
I(40289) OPENTHREAD:[INFO]-MAC-----: Frame rx failed, error:Security, len:92, seqnum:174, type:Data, src:0b6655b658a1d991, dst:ce9d29024a0611df, sec:yes, ackreq:yes

[16:13:00.944]收←◆E (42219) ot_utils: CommissionerJoinerCallback:OT_COMMISSIONER_JOINER_END

上面这个 Frame rx failed, error:Security 的问题目前看目前看是NRF52840子设备的固件问题,我这边用回标准的cli例程去做Joiner是可以正常加入的,所以就看cli例程跟我的程序有啥区别了.

后来发现是.conf文件的问题.这里附一下我这边能join OK的.conf内容.


CONFIG_NCS_SAMPLES_DEFAULTS=y

CONFIG_NEWLIB_LIBC=y

# Enable floating point Hard ABI
CONFIG_FPU=y
CONFIG_FP_HARDABI=y

# Generic networking options
CONFIG_NETWORKING=y
CONFIG_NET_CONNECTION_MANAGER=y

# Kernel options
CONFIG_MAIN_STACK_SIZE=2048
CONFIG_INIT_STACKS=y

# Increase set for threads with meta-irq priority
CONFIG_NUM_METAIRQ_PRIORITIES=1

# Logging
CONFIG_NET_LOG=y
CONFIG_NET_STATISTICS=y

# Disable certain parts of Zephyr IPv6 stack
CONFIG_NET_IPV6_NBR_CACHE=n
CONFIG_NET_IPV6_MLD=n

# Stack sizes configuration
CONFIG_NET_TX_STACK_SIZE=1200
CONFIG_NET_RX_STACK_SIZE=1500

# Network buffers
CONFIG_NET_PKT_RX_COUNT=10
CONFIG_NET_PKT_TX_COUNT=16
CONFIG_NET_BUF_RX_COUNT=16
CONFIG_NET_BUF_TX_COUNT=16

# L2 OpenThread enabling
CONFIG_NET_L2_OPENTHREAD=y
CONFIG_OPENTHREAD_DEBUG=y
CONFIG_OPENTHREAD_L2_DEBUG=y
CONFIG_OPENTHREAD_L2_LOG_LEVEL_INF=y

# Disable OpenThread autostart
CONFIG_OPENTHREAD_MANUAL_START=y

CONFIG_OPENTHREAD_MBEDTLS=y

# Disable unneeded mbedtls modules
CONFIG_MBEDTLS_CIPHER_MODE_CBC=n
CONFIG_MBEDTLS_CIPHER_MODE_CTR=n
CONFIG_MBEDTLS_CIPHER_MODE_CFB=n
CONFIG_MBEDTLS_CIPHER_MODE_OFB=n
CONFIG_MBEDTLS_CIPHER_MODE_XTS=n
CONFIG_MBEDTLS_GCM_C=n
CONFIG_MBEDTLS_CHACHA20_C=n
CONFIG_MBEDTLS_POLY1305_C=n
CONFIG_MBEDTLS_CHACHAPOLY_C=n
CONFIG_MBEDTLS_DHM_C=n
CONFIG_MBEDTLS_RSA_C=n
CONFIG_MBEDTLS_SHA1_C=n
CONFIG_MBEDTLS_SHA512_C=n
CONFIG_MBEDTLS_HEAP_SIZE=10240


# nRF board library
CONFIG_DK_LIBRARY=y

# Enable CoAP utils and CoAP protocol
CONFIG_COAP_UTILS=y

# Network shell
CONFIG_NET_SHELL=y
CONFIG_SHELL_ARGC_MAX=26
CONFIG_SHELL_CMD_BUFF_SIZE=416

# Network sockets
CONFIG_NET_SOCKETS=y
CONFIG_NET_SOCKETS_POSIX_NAMES=y
CONFIG_NET_SOCKETS_POLL_MAX=4


CONFIG_OPENTHREAD_JOINER=y
CONFIG_OPENTHREAD_JOINER_AUTOSTART=y
CONFIG_OPENTHREAD_DIAG=y

CONFIG_OPENTHREAD_JOINER_PSKD="123456"

# Enable MTD Sleepy End Device
CONFIG_OPENTHREAD_MTD=y
CONFIG_OPENTHREAD_MTD_SED=y
CONFIG_OPENTHREAD_POLL_PERIOD=3000
CONFIG_RAM_POWER_DOWN_LIBRARY=y
CONFIG_DEVICE_POWER_MANAGEMENT=y

# This variant requires increased system workqueue stack size
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=1536

正常Join的ESP32端log:


[17:59:34.165]收←◆I(593291) OPENTHREAD:[INFO]-MESH-CP-: received petition
I(593291) OPENTHREAD:[INFO]-MESH-CP-: sent petition response
I(593291) OPENTHREAD:[INFO]-MESH-CP-: received Leader Petition response
I(593301) OPENTHREAD:[INFO]-MESH-CP-: CommissionerState: petition -> active
E (593301) ot_utils: CommissionerStateCallback:OT_COMMISSIONER_STATE_ACTIVE
I(593321) OPENTHREAD:[INFO]-CORE----: Notifier: StateChanged (0x00800201) [Ip6+ NetData CommissionerState] 
I(593331) OPENTHREAD:[INFO]-MLE-----: Send Data Response (ff02:0:0:0:0:0:0:1)
I(593361) OPENTHREAD:[INFO]-MAC-----: Sent IPv6 UDP msg, len:103, chksum:63df, to:0xffff, sec:no, prio:net
I(593361) OPENTHREAD:[INFO]-MAC-----:     src:[fe80:0:0:0:cc9d:2902:4a06:11df]:19788
I(593371) OPENTHREAD:[INFO]-MAC-----:     dst:[ff02:0:0:0:0:0:0:1]:19788

[17:59:34.843]收←◆I (593971) ot_utils: otCommissionerAddJoiner  PSKd:123456
I(593971) OPENTHREAD:[INFO]-MESH-CP-: sent MGMT_COMMISSIONER_SET.req to leader
I(593971) OPENTHREAD:[INFO]-MESH-CP-: Added Joiner (any, 123456)

[17:59:35.176]收←◆I(594301) OPENTHREAD:[INFO]-MESH-CP-: sent commissioning dataset set response
I(594301) OPENTHREAD:[INFO]-MESH-CP-: received MGMT_COMMISSIONER_SET response
I(594311) OPENTHREAD:[INFO]-CORE----: Notifier: StateChanged (0x00000200) [NetData] 
I(594321) OPENTHREAD:[INFO]-MLE-----: Send Data Response (ff02:0:0:0:0:0:0:1)
I(594331) OPENTHREAD:[INFO]-IP6-----: Added unsecure port 1000
I(594331) OPENTHREAD:[INFO]-MESH-CP-: Joiner Router: start
I(594361) OPENTHREAD:[INFO]-MAC-----: Sent IPv6 UDP msg, len:103, chksum:77ef, to:0xffff, sec:no, prio:net
I(594361) OPENTHREAD:[INFO]-MAC-----:     src:[fe80:0:0:0:cc9d:2902:4a06:11df]:19788
I(594371) OPENTHREAD:[INFO]-MAC-----:     dst:[ff02:0:0:0:0:0:0:1]:19788

[17:59:42.863]收←◆I(601981) OPENTHREAD:[INFO]-MLE-----: Send Advertisement (ff02:0:0:0:0:0:0:1)
I(602011) OPENTHREAD:[INFO]-MAC-----: Sent IPv6 UDP msg, len:90, chksum:245f, to:0xffff, sec:no, prio:net
I(602011) OPENTHREAD:[INFO]-MAC-----:     src
[17:59:42.941]收←◆:[fe80:0:0:0:cc9d:2902:4a06:11df]:19788
I(602021) OPENTHREAD:[INFO]-MAC-----:     dst:[ff02:0:0:0:0:0:0:1]:19788

[17:59:45.389]收←◆I (604511) MQTT_SER: mqtt_send_device_info_datapacket:{"id":3,"datapacket_type":0,"rssi":-61,"mac":"C44F33759B21","ssid":"EET","thread_state":4}
I (604521) MQTT_SER: g_MqttTxFIFO:{"id":3,"datapacket_type":0,"rssi":-61,"mac":"C44F3
[17:59:45.432]收←◆3759B21","ssid":"EET","thread_state":4}
I (604571) MQTT_SER: MQTT_EVENT_PUBLISHED, msg_id=1993

[17:59:50.407]收←◆I(609531) OPENTHREAD:[INFO]-MAC-----: Received IPv6 UDP msg, len:56, chksum:b2dd, from:4e57f18cd1abe42a, sec:no, prio:net, rss:-45.0
I(609531) OPENTHREAD:[INFO]-MAC-----:     src:[fe80:0:0:0:4c57:f18c:d1ab:e42a]:19788
I(609541) OPENTHREAD:[INFO]-MAC-----:     dst:[ff02:0:0:0:0:0:0:2]:19788
I(609551) OPENTHREAD:[INFO]-MLE-----: Receive Discovery Request (fe80:0:0:0:4c57:f18c:d1ab:e42a)
I(609561) OPENTHREAD:[INFO]-MLE-----: Delay Discovery Response (fe80:0:0:0:4c57:f18c:d1ab:e42a)
I(609571) OPENTHREAD:[INFO]-MLE-----: Send delayed message (fe80:0:0:0:4c57:f18c:d1ab:e42a)
I(609601) OPENTHREAD:[INFO]-MAC-----: Sent IPv6 UDP msg, len:89, chksum:24a8, to:4e57f18cd1abe42a, sec:no, prio:net
I(609611) OPENTHREAD:[INFO]-MAC-----:     src:[fe80:0:0:0:cc9d:2902:4a06:11df]:19788
I(609621) OPENTHREAD:[INFO]-MAC-----:     dst:[fe80:0:0:0:4c57:f18c:d1ab:e42a]:19788

[17:59:58.104]收←◆I(617221) OPENTHREAD:[INFO]-MAC-----: Received IPv6 UDP msg, len:467, chksum:2a06, from:0b6655b658a1d991, sec:no, prio:normal, rss:-45.125
I(617231) OPENTHREAD:[INFO]-MAC-----:     src:[fe80:0:0:0:966:55b6:58a1:d991]:1000
I(617241) OPENTHREAD:[INFO]-MAC-----:     dst:[fe80:0:0:0:cc9d:2902:4a06:11df]:1000
I(617251) OPENTHREAD:[INFO]-MESH-CP-: JoinerRouter::HandleUdpReceive
I(617261) OPENTHREAD:[INFO]-MESH-CP-: Sent relay rx
I(617261) OPENTHREAD:[INFO]-MESH-CP-: Starting new session with Joiner (any, 123456)
E (617271) ot_utils: CommissionerJoinerCa
[17:59:58.186]收←◆llback:OT_COMMISSIONER_JOINER_START
I(617281) OPENTHREAD:[INFO]-MESH-CP-: Received Relay Receive (096655b658a1d991, 0x6c00)
I(617291) OPENTHREAD:[INFO]-MESH-CP-: DTLS started

[18:00:00.004]收←◆I(619121) OPENTHREAD:[INFO]-MESH-CP-: Received relay transmit
I(619131) OPENTHREAD:[INFO]-MESH-CP-: sent keep alive
I(619131) OPENTHREAD:[INFO]-MESH-CP-: received keep alive
I(619141) OPENTHREAD:[INFO]-MESH-CP-: sent keep alive response
I(619141) OPENTHREAD:[INFO]-MESH-CP-: received Leader keep-alive response
I(61915
[18:00:00.058]收←◆1) OPENTHREAD:[INFO]-MAC-----: Sent IPv6 UDP msg, len:108, chksum:844f, to:0b6655b658a1d991, sec:no, prio:net
I(619161) OPENTHREAD:[INFO]-MAC-----:     src:[fe80:0:0:0:cc9d:2902:4a06:11df]:1000
I(619171) OPENTHREAD:[INFO]-MAC-----:     dst:[fe80:0:0:0:966:55b6:58a1:d991]:1000

[18:00:00.110]收←◆I(619231) OPENTHREAD:[INFO]-MAC-----: Received IPv6 UDP msg, len:499, chksum:58b9, from:0b6655b658a1d991, sec:no, prio:normal, rss:-45.125
I(619231) OPENTHREAD:[INFO]-MAC-----:     src:[fe80:0:0:0:966:55b6:58a1:d991]:1000
I(619241) OPENTHREAD:[INFO]-MAC-----:     dst:[fe80:0:0:0:cc9d:2902:4a06:11df]:1000
I(619261) OPENTHREAD:[INFO]-MESH-CP-: JoinerRouter::HandleUdpReceive
I(619261) OPENTHREAD:[INFO]-MESH-CP-: Sent relay rx
I(619271) OPENTHREAD:[INFO]-MESH-CP-: Received Relay Receiv
[18:00:00.180]收←◆e (096655b658a1d991, 0x6c00)

[18:00:03.811]收←◆I(622931) OPENTHREAD:[INFO]-MESH-CP-: Received relay transmit
I(622941) OPENTHREAD:[INFO]-MAC-----: Frame rx failed, error:Security, len:92, seqnum:125, type:Data, src:0b6655b658a1d991, dst:ce9d29024a0611df, sec:yes, ackreq:yes

[18:00:04.026]收←◆I(623141) OPENTHREAD:[INFO]-MAC-----: Sent IPv6 UDP msg, len:708, chksum:9822, to:0b6655b658a1d991, sec:no, prio:net
I(623151) OPENTHREAD:[INFO]-MAC-----:     src:[fe80:0:0:0:cc9d:2902:4a06:11df]:1000
I(623161) OPENTHREAD:[INFO]-MAC-----:     dst:[fe80:0:0:0:966:55b6:58a1:d991]:1000

[18:00:10.638]收←◆W (629761) wifi:<ba-del>idx
W (629761) wifi:<ba-add>idx:0 (ifx:0, 4c:ed:fb:a7:18:18), tid:0, ssn:160, winSize:64

[18:00:11.225]收←◆
[18:00:11.243]收←◆[0;32mI(630341) OPENTHREAD:[INFO]-MAC-----: Received IPv6 UDP msg, len:305, chksum:9256, from:0b6655b658a1d991, sec:no, prio:normal, rss:-45.25
I(630351) OPENTHREAD:[INFO]-MAC-----:     src:[fe80:0:0:0:966:55b6:58a1:d991]:1000
I(630361) OPENTHREAD:[INFO]-MAC-----:     dst:[fe80:0:0:0:cc9d:2902:4a06:11df]:1000
I(630371) OPENTHREAD:[INFO]-MESH-CP-: JoinerRouter::HandleUdpReceive
I(630371) OPENTHREAD:[INFO]-MESH-CP-: Sent relay rx
I(630391) OPENTHREAD:[INFO]-MESH-CP-: Received Relay Receive (096655b658a1d991, 0x6c00)

[18:00:13.468]收←◆E (632591) ot_utils: CommissionerJoinerCallback:OT_COMMISSIONER_JOINER_CONNECTED
I(632591) OPENTHREAD:[INFO]-MESH-CP-: Received relay transmit
I(632591) OPENTHREAD:[INFO]-MAC-----: Frame rx failed, error:Security, len:92, seqnum:129, type:Data, src:0b6655b658a1d991, dst:ce9d29024a0611df, sec:yes, ackreq:yes
I(632631) OPENTHREAD:[INFO]-MAC-----: Sent IPv6 UDP msg, len:115, chksum:2c46, to:0b6655b658a1d991, sec:no, prio:net
I(632641) OPENTHREAD:[INFO]-MAC-----:     src:[fe80:0:0:0:
[18:00:13.557]收←◆cc9d:2902:4a06:11df]:1000
I(632651) OPENTHREAD:[INFO]-MAC-----:     dst:[fe80:0:0:0:966:55b6:58a1:d991]:1000
I(632671) OPENTHREAD:[INFO]-MAC-----: Received IPv6 UDP msg, len:122, chksum:6948, from:0b6655b658a1d991, sec:no, prio:normal, rss:-46.0
I(632671) OPENTHREAD:[INFO]-MAC-----:     src:[fe80:0:0:0:966:55b6:58a1:d991]:1000
I(632681) OPENTHREAD:[INFO]-MAC-----:     dst:[fe80:0:0:0:cc9d:2902:4a06:11df]:1000
I(632691) OPENTHREAD:[INFO]-MESH-CP-: JoinerRouter::HandleUdpReceive
I(632691) OPENTHREAD:[INFO]-MESH-CP-: Sent relay rx
I(632711) OPENTHREAD:[INFO]-MESH-CP-: Received Relay Receive (096655b658a1d991, 0x6c00)
I(632711) OPENTHREAD:[INFO]-MESH-CP-: received joiner finalize
E (632721) ot_utils: CommissionerJoinerCallback:OT_COMMISSIONER_JOINER_FINALIZE
I(632731) OPENTHREAD:[INFO]-MESH-CP-: sent joiner finalize response
I(632731) OPENTHREAD:[INFO]-MAC-----: Frame rx failed, error:Security, len:92, seqnum:131, type:Data, src:0b6655b658a1d991, dst:ce9d29024a0611df, sec:yes, ackreq:yes
I(632751) OPENTHREAD:[INFO]-MESH-CP-: Received relay transmit
I(632751) OPENTHREAD:[INFO]-MESH-CP-: Received ke
[18:00:13.669]收←◆k
I(632791) OPENTHREAD:[INFO]-MAC-----: Sent IPv6 UDP msg, len:85, chksum:9ea2, to:0b6655b658a1d991, sec:no, prio:net
I(632791) OPENTHREAD:[INFO]-MAC-----:     src:[fe80:0:0:0:cc9d:2902:4a06:11df]:1000
I(632801) OPENTHREAD:[INFO]-MAC-----:     dst:[fe80:0:0:0:966:55b6:58a1:d991]:1000
I(632821) OPENTHREAD:[INFO]-MESH-CP-: Sending JOIN_ENT.ntf
I(632821)
[18:00:13.731]收←◆ OPENTHREAD:[INFO]-MESH-CP-: Sent joiner entrust length = 155
I(632831) OPENTHREAD:[INFO]-MAC-----: Received IPv6 UDP msg, len:79, chksum:bbaa, from:0b6655b658a1d991, sec:no, prio:normal, rss:-45.0
I(632841) OPENTHREAD:[INFO]-MAC-----:     src:[fe80:0:0:0:966:55b6:58a1:d991]:1000
I(632841) OPENTHREAD:[INFO]-MAC-----:     dst:[fe80:0:0:0:cc9d:2902:4a06:11df]:1000
I(632861) OPENTHREAD:[INFO]-MESH-CP-: JoinerRouter::HandleUdpReceive
I(632871) OPENTHREAD:[INFO]-MESH-CP-: Sent relay rx
I(632871) OPENTHREAD:[INFO]-MAC-----: Frame rx failed, error:Security, len:92, seqnum:133, type:Data, src:0b6655b658a1d991, dst:ce9d29024a0611df, sec:yes, ackreq:yes[0
[18:00:13.799]收←◆m
I(632891) OPENTHREAD:[INFO]-MESH-CP-: Received Relay Receive (096655b658a1d991, 0x6c00)
I(632891) OPENTHREAD:[INFO]-MESH-CP-: Received relay transmit
I(632901) OPENTHREAD:[INFO]-MESH-CP-: Received relay transmit

[18:00:13.842]收←◆I(632961) OPENTHREAD:[INFO]-MAC-----: Sent IPv6 UDP msg, len:155, chksum:79e1, to:0b6655b658a1d991, sec:yes, prio:net
I(632961) OPENTHREAD:[INFO]-MAC-----:     src:[fe80:0:0:0:cc9d:2902:4a06:11df]:61631
I(632971) OPENTHREAD:[INFO]-MAC-----:     dst:[fe80:0:0:0:966:55b6:58a1:d991]:61631
I(633011) OPENTHREAD:[INFO]-MAC-----: Sent IPv6 UDP msg, len:79, chksum:5eda, to:0b6655b658a1d991, sec:no, prio:net
I(633011) OPENTHREAD:[INFO]-MAC-----:     src:[fe80:0:0:0:cc9d:2902:4a06:11df]:1000
I(633021) OPENTHREAD:[INFO]-MAC-----:     dst:[fe80:0:0:0:966:55b6:58a1:d991]:1000

[18:00:13.951]收←◆I(633061) OPENTHREAD:[INFO]-MAC-----: Sent IPv6 UDP msg, len:79, chksum:2e7f, to:0b6655b658a1d991, sec:no, prio:net
I(633061) OPENTHREAD:[INFO]-MAC-----:     src:[fe80:0:0:0:cc9d:2902:4a06:11df]:1000
I(633071) OPENTHREAD:[INFO]-MAC-----:     dst:[fe80:0:0:0:966:55b6:58a1:d991]:1000

[18:00:14.023]收←◆
[18:00:14.045]收←◆[0;32mI(633141) OPENTHREAD:[INFO]-MAC-----: Received IPv6 UDP msg, len:52, chksum:6f26, from:0b6655b658a1d991, sec:yes, prio:net, rss:-46.0
I(633141) OPENTHREAD:[INFO]-MAC-----:     src:[fe80:0:0:0:966:55b6:58a1:d991]:61631
I(633161) OPENTHREAD:[INFO]-MAC-----:     dst:[fe80:0:0:0:cc9d:2902:4a06:11df]:61631
I(633171) OPENTHREAD:[INFO]-MESH-CP-: Receive joiner entrust response


[18:00:14.722]收←◆
[18:00:14.748]收←◆[0;32mI(633841) OPENTHREAD:[INFO]-MAC-----: Received IPv6 UDP msg, len:84, chksum:3855, from:0e29a358cb1d1294, sec:no, prio:net, rss:-45.0
I(633841) OPENTHREAD:[INFO]-MAC-----:     src:[fe80:0:0:0:c29:a358:cb1d:1294]:19788
I(633851) OPENTHREAD:[INFO]-MAC-----:     dst:[ff02:0:0:0:0:0:0:2]:19788
I(633871) OPENTHREAD:[INFO]-MLE-----: Receive Parent Request (fe80:0:0:0:c29:a358:cb1d:1294)
I(633871) OPENTHREAD:[INFO]-MLE-----: Delay Parent Response (fe80:0:0:0:c29:a358:cb1d:1294)

[18:00:14.949]收←◆I(634071) OPENTHREAD:[INFO]-MLE-----: Send delayed message (fe80:0:0:0:c29:a358:cb1d:1294)
I(634101) OPENTHREAD:[INFO]-MAC-----: Sent IPv6 UDP msg, len:129, chksum:b14d, to:0e29a358cb1d1294, sec:no, prio:net
I(634101) OPENTHREAD:[INFO]-MAC-----:     src:[fe80:0:0:0:cc9d:2902:4a06:11df]:19788
I(634111) OPENTHREAD:[INFO]-MAC-----:     dst:[fe80:0:0:0:c29:a358:cb1d:1294]:19788

[18:00:15.476]收←◆
[18:00:15.497]收←◆[0;32mI(634591) OPENTHREAD:[INFO]-MAC-----: Received IPv6 UDP msg, len:114, chksum:e610, from:0e29a358cb1d1294, sec:no, prio:net, rss:-46.0
I(634601) OPENTHREAD:[INFO]-MAC-----:     src:[fe80:0:0:0:c29:a358:cb1d:1294]:19788
I(634611) OPENTHREAD:[INFO]-MAC-----:     dst:[fe80:0:0:0:cc9d:2902:4a06:11df]:19788
I(634621) OPENTHREAD:[INFO]-MLE-----: Receive Child ID Request (fe80:0:0:0:c29:a358:cb1d:1294)
I(634631) OPENTHREAD:[INFO]-MLE-----: Child 0x0000 IPv6 address[1]=fdde:ad00:beef:0:110a:cb38:4eb4:cd40
I(634641) OPENTHREAD:[INFO]-MLE-----: Child 0x0000 has 1 registered IPv6 address, 1 address stored
I(634671) OPENTHREAD:[INFO]-C
[18:00:15.572]收←◆ORE----: Non-volatile: Added ChildInfo {rloc:0x6c01, extaddr:0e29a358cb1d1294, timeout:240, mode:0x04, version:2}
I(634681) OPENTHREAD:[INFO]-MLE-----: Send Child ID Response (fe80:0:0:0:c29:a358:cb1d:1294,0x6c01)
I(634681) OPENTHREAD:[INFO]-CORE----: Notifier: StateChanged (0x00000400) [Child+] 
I(634701) OPENTHREAD:[INFO]-UTIL----: Starting Child Supervision
I(634711) OPENTHREAD:[INFO]-MAC-----: Prepping indir tx IPv6 UDP msg, len:188, chksum:5035, to:0e29a358cb1d1294, sec:no, prio:net
I(634711) OPENTHREAD:[INFO]-MAC-----: Rx data poll, src:0x6c01, qed_msgs:1, rss:-46, ack-fp:0

[18:00:15.671]收←◆I(634791) OPENTHREAD:[INFO]-MAC-----: Rx data poll, src:0x6c01, qed_msgs:1, rss:-46, ack-fp:1
I(634831) OPENTHREAD:[INFO]-MAC-----: Rx data poll, src:0x6c01, qed_msgs:1, rss:-46, ack-fp:1

[18:00:15.748]收←◆I(634861) OPENTHREAD:[INFO]-MAC-----: Sent IPv6 UDP msg, len:188, chksum:5035, to:0e29a358cb1d1294, sec:yes, prio:net
I(634871) OPENTHREAD:[INFO]-MAC-----:     src:[fe80:0:0:0:cc9d:2902:4a06:11df]:19788
I(634881) OPENTHREAD:[INFO]-MAC-----:     dst:[fe80:0:0:0:c29:a358:cb1d:1294]:19788
E (634891) ot_utils: CommissionerJoinerCallback:OT_COMMISSIONER_JOINER_END

nrf52840子设备端的状态变化log:

[17:59:58.026]收←◆I: State changed! Flags: 0x0800c00b Current role: 0

[18:00:13.515]收←◆I: State changed! Flags: 0x08000000 Current role: 0

[18:00:13.667]收←◆I: State changed! Flags: 0x08000000 Current role: 0

[18:00:14.005]收←◆I: State changed! Flags: 0x18040100 Current role: 0

[18:00:14.101]收←◆Join success
I: State changed! Flags: 0x1800101f Current role: 1

[18:00:16.032]收←◆I: State changed! Flags: 0x301002a4 Current role: 2

[18:00:41.878]收←◆I: State changed! Flags: 0x00000280 Current role: 2