CoAP Block-wise Transfer over OpenThread (tested via OT-CLI)

I’m trying to transmit a payload of up to 2,450 bytes using CoAP over OpenThread. Before jumping into firmware development, I want to evaluate the feasibility of transmitting large payloads using the OT-CLI sample.

As a starting point, let me clarify that my CoAP server is up and running. To obtain the synthesized IPv6 address from the OTBR, I run:

$ ot dns resolve4 <CoAP server IPv4>

1) Standard transmission (non-block-wise transmission)

When I transmit short payloads using:

$ ot coap put <synthesized IPv6 address> <uri> con {"test":123} 

I can see the data arriving at the CoAP server, and I also receive the corresponding ACK on my OpenThread device running the OT-CLI sample.

To evaluate the transmission of a payload of up to 2,450 bytes, I used the OT-CLI sample with the following command:

$ ot coap put <synthesized IPv6 address> <uri> con <payload> 

where <payload> is a 2,450-byte JSON payload. However, I noticed that the command input appears to be limited to approximately 415 bytes.

I then inspected the OT-CLI sample and found that there is a Kconfig parameter in the prj.conf file that limits the maximum length of shell commands. I increased this limit and rebuilt the sample:

CONFIG_SHELL_ARGC_MAX=26
CONFIG_SHELL_CMD_BUFF_SIZE=2600

After this change, the entire command appears to be accepted, but I now get the following error:

Error 6: Parse 

What does this error mean? Is it actually possible to use the OT-CLI command with payloads of this size?

2) Block-wise transmission 

To further evaluate the feasibility of transmitting large payloads over CoAP with OpenThread, I looked into the block-wise transfer implementation, since this is the recommended approach for large payloads to avoid IPv6 fragmentation due to the small MTU size of IEEE 802.15.4. Since I need to send a payload of up to 2,450 bytes, using a block size of 64 bytes would require transmitting approximately 40 blocks.

To test this, I used the following command:

$ ot coap put <synthesized IPv6 address> <uri> block-64 40

From the documentation, this command will transmit 40 data blocks of 64 bytes each to the CoAP server. However, no payload ever arrives at my CoAP server. From the Graylog logs, it appears that the server is trying to parse the value 40 as the payload, even though in this command 40 is intended to represent the number of blocks to send, with the actual payload consisting of random bytes. Is the block-wise implementation in OT-CLI working as expected?

The documentation also states:

“The block- type requires OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE to be set.”

Do I need to enable this configuration? If so, can I do it in the prj.conf file like this?

CONFIG_OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE=y
Parents
  • Hi, 

    You do not set OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE directly in your prj.conf as this is not a Kconfig symbol. It is part of OpenThread’s CMake feature flags.

    Try setting CONFIG_OPENTHREAD_COAP_BLOCK=y instead.

    Regards,
    Benjamin

  • I’ve added the suggested configuration to my prj.conf, but the behavior of the ot-cli sample when using the block-wise command remains the same. 

    #
    # Copyright (c) 2020 Nordic Semiconductor
    #
    # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
    #
    
    # Enable OpenThread
    CONFIG_OPENTHREAD=y
    # Enable OpenThread features 
    CONFIG_OPENTHREAD_NORDIC_LIBRARY_MASTER=y
    CONFIG_OPENTHREAD_COAP_BLOCK=y
    
    # Network shell
    CONFIG_SHELL=y
    CONFIG_OPENTHREAD_SHELL=y
    CONFIG_SHELL_ARGC_MAX=26
    CONFIG_SHELL_CMD_BUFF_SIZE=2510
    CONFIG_GPIO_SHELL=y
    
    # Increase Settings storage size
    CONFIG_PM_PARTITION_SIZE_SETTINGS_STORAGE=0x8000
    

    Below are the steps I’m following.

    1. From the ot-cli sample (running on the nRF54L15 DK), obtain the synthesized IPv6 address:

    uart:~$  ot dns resolve4 coap.me
    DNS response for coap.me. - fd84:eb3c:3ceb:2:0:0:8666:da12 TTL:300 
    Done

    2. Send a block-wise CoAP request:

    uart:~$ ot coap post fd84:eb3c:3ceb:2:0:0:8666:da12 large-create block-64 20
    Done

    Based on the coap.me web interface, the server appears to receive only the value 20, rather than 20 blocks of random data as described in the documentation.

    Have you tested this on your side? How can block-wise transfer be enabled in the ot-cli sample?

  • Hi,

    I have not tested it yet, but I will try to reproduce.

    What are you using as your Border Router?
    Could you share your build log and the exact shell commands you run, step by step?

    If available, an 802.15.4 sniffer trace would also be very helpful.

    Regards,
    Benjamin

  • Sorry for the late response. Regarding the specific Border Router I’m currently using, I’m running a prebuilt Docker container with a working Border Router from the official page on an RPi CM4 + nRF52840 Dongle. As far as I understand, each CoAP Block-Wise transfer is treated as an independent CoAP message. Therefore, if all normal CoAP messages transmitted by my SED device are reaching the CoAP server, I assume the issue is not related to the OTBR. Have you already run any tests on your side?

    Another question you have been ignored in my different post: I need to send CoAP payloads larger than 2.5 KB over OpenThread (nRF54L15DK) and noticed that both the Zephyr CoAP API and the OpenThread CoAP API support block-wise transfers. For this use case, which should be preferred? Should I use the Zephyr CoAP API or rely directly on the OpenThread CoAP API for block-wise payloads over OpenThread, and what are the main pros and cons of each approach?

  • Hi,

    Thank you for your response and for your patience. We have not had the opportunity to review your ticket yet, but we hope to provide an update before the end of the week.

    Best regards,
    Benjamin

  • Hi Benjamin,

    Are there any updates on this? I’m still unable to determine whether it’s possible to test CoAP Block-Wise transfers over OpenThread using the ot-cli sample or directly through the OpenThread APIs in the nRF Connect SDK.

    Even after enabling the relevant Kconfig parameters, the feature does not work as expected:

    # Enable OpenThread
    CONFIG_OPENTHREAD=y
    # Enable OpenThread features 
    CONFIG_OPENTHREAD_NORDIC_LIBRARY_MASTER=y
    CONFIG_OPENTHREAD_COAP_BLOCK=y

Reply
  • Hi Benjamin,

    Are there any updates on this? I’m still unable to determine whether it’s possible to test CoAP Block-Wise transfers over OpenThread using the ot-cli sample or directly through the OpenThread APIs in the nRF Connect SDK.

    Even after enabling the relevant Kconfig parameters, the feature does not work as expected:

    # Enable OpenThread
    CONFIG_OPENTHREAD=y
    # Enable OpenThread features 
    CONFIG_OPENTHREAD_NORDIC_LIBRARY_MASTER=y
    CONFIG_OPENTHREAD_COAP_BLOCK=y

Children
No Data
Related