<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Using TCP in CLI Example with nRF52840dk</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/90012/using-tcp-in-cli-example-with-nrf52840dk</link><description>I am using the Connect SDK v2.0.0 and attempting to use TCP in the stock CLI example to mimic the demo shown here . When I flash the v2.0.0 CLI sample on my nRF52840dk, &amp;quot;$ ot tcp init&amp;quot; is not a valid command. In fact, when I run &amp;quot;$ ot help&amp;quot; I do not see</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 15 Jul 2022 16:13:34 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/90012/using-tcp-in-cli-example-with-nrf52840dk" /><item><title>RE: Using TCP in CLI Example with nRF52840dk</title><link>https://devzone.nordicsemi.com/thread/377242?ContentTypeID=1</link><pubDate>Fri, 15 Jul 2022 16:13:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5b475264-2fed-47f6-a840-d252f1b8010a</guid><dc:creator>brown27</dc:creator><description>&lt;p&gt;Found the issue - I needed to set&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_OPENTHREAD_TCP_ENABLE=y
CONFIG_OPENTHREAD_CLI_TCP_ENABLE=y&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;in my prj.conf instead of&amp;nbsp;CONFIG_&lt;span&gt;OPENTHREAD_CONFIG_TCP_ENABLE and CONFIG_OPENTHREAD_CONFIG_CLI_TCP_ENABLE.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using TCP in CLI Example with nRF52840dk</title><link>https://devzone.nordicsemi.com/thread/377225?ContentTypeID=1</link><pubDate>Fri, 15 Jul 2022 13:39:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9b70816b-0c55-47c7-87f8-3e2343e69424</guid><dc:creator>brown27</dc:creator><description>&lt;p&gt;If I add CONFIG_OPENTHREAD_MBEDTLS_CHOICE=y to the prj.conf, I no longer get the&amp;nbsp;MBEDTLS_MAC_MD5_ENABLED warning/error and it compiles. However, I still cannot use the &amp;quot;tcp&amp;quot; subcommand. Here is my new prj.conf, although I should go back and comment out the irrelevant lines that I&amp;nbsp;added from other DevZone tickets related to Openthread and TCP.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#
# Copyright (c) 2020 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

# Network shell
CONFIG_SHELL=y
CONFIG_OPENTHREAD_SHELL=y
CONFIG_SHELL_ARGC_MAX=26
CONFIG_SHELL_CMD_BUFF_SIZE=416

# Enable OpenThread features set
CONFIG_OPENTHREAD_NORDIC_LIBRARY_MASTER=y

CONFIG_NET_L2_OPENTHREAD=y

# Generic networking options
CONFIG_NETWORKING=y

CONFIG_ASSERT=y
CONFIG_ASSERT_NO_COND_INFO=y
CONFIG_MBEDTLS_SHA1_C=n
CONFIG_FPU=y

CONFIG_GPIO_SHELL=y

CONFIG_OPENTHREAD_THREAD_VERSION_1_2=y
CONFIG_OPENTHREAD_MBEDTLS_CHOICE=y 

#CONFIG_MBEDTLS=y
#CONFIG_MBEDTLS_BUILTIN=y
#CONFIG_MBEDTLS_CFG_FILE=&amp;quot;config-tls-generic.h”
#CONFIG_NRF_SECURITY=n
#CONFIG_NORDIC_SECURITY_BACKEND=n

###################################################
#Following added per https://devzone.nordicsemi.com/f/nordic-q-a/89810/nrf-connect-mqtt-returns--22-invalid-argument

# Generic networking options
CONFIG_NETWORKING=y
CONFIG_NET_UDP=y
CONFIG_NET_TCP=y
CONFIG_NET_IPV6=y
CONFIG_NET_IPV4=n
CONFIG_NET_SOCKETS=y
CONFIG_NET_SOCKETS_SOCKOPT_TLS=y
CONFIG_NET_SOCKETS_POSIX_NAMES=y
CONFIG_NET_SOCKETS_POLL_MAX=4
# CONFIG_NET_CONNECTION_MANAGER=y

# Kernel options
CONFIG_MAIN_STACK_SIZE=2048
CONFIG_ENTROPY_GENERATOR=y
CONFIG_TEST_RANDOM_GENERATOR=y
CONFIG_INIT_STACKS=y

# Logging
CONFIG_NET_LOG=y
CONFIG_LOG=y
CONFIG_NET_STATISTICS=y
CONFIG_PRINTK=y

# Network buffers
CONFIG_NET_PKT_RX_COUNT=16
CONFIG_NET_PKT_TX_COUNT=16
CONFIG_NET_BUF_RX_COUNT=80
CONFIG_NET_BUF_TX_COUNT=80
CONFIG_NET_CONTEXT_NET_PKT_POOL=y

# IP address options
CONFIG_NET_IF_UNICAST_IPV6_ADDR_COUNT=3
CONFIG_NET_IF_MCAST_IPV6_ADDR_COUNT=4
CONFIG_NET_MAX_CONTEXTS=10

# Network shell
CONFIG_NET_SHELL=y

# The addresses are selected so that qemu&amp;lt;-&amp;gt;qemu connectivity works ok.
# For linux&amp;lt;-&amp;gt;qemu connectivity, create a new conf file and swap the
# addresses (so that peer address is ending to 2).
CONFIG_NET_CONFIG_SETTINGS=y
CONFIG_NET_CONFIG_NEED_IPV6=y
CONFIG_NET_CONFIG_NEED_IPV4=n
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048

# DNS Settings
CONFIG_DNS_RESOLVER=y
CONFIG_DNS_SERVER_IP_ADDRESSES=y
CONFIG_DNS_SERVER1=&amp;quot;FDAA:BB:1::2&amp;quot;
CONFIG_OPENTHREAD_DNS_CLIENT=y

# disable external crystal
CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL=n
# enable synth crystal for powered devices
CONFIG_CLOCK_CONTROL_NRF_K32SRC_SYNTH=y
# enable RC crystal for battery devices
# CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC is not set

# NEWLIB C
CONFIG_NEWLIB_LIBC=y

# Enable MQTT Lib support
CONFIG_MQTT_LIB=y
CONFIG_MQTT_LIB_TLS=y
# MQTT - Maximum MQTT keepalive timeout specified by Azure IoT Hub
CONFIG_MQTT_KEEPALIVE=1767

# Heap and stacks
CONFIG_HEAP_MEM_POOL_SIZE=4096
#4096

# cJSON
CONFIG_CJSON_LIB=y

#
# overlay-log.conf
#
CONFIG_LOG=y
# CONFIG_LOG_MODE_IMMEDIATE=y
CONFIG_LOG_BACKEND_SHOW_COLOR=n

CONFIG_LOG_BUFFER_SIZE=2048

CONFIG_LOG_MODE_MINIMAL=n
CONFIG_LOG_MODE_DEFERRED=y
# fix str dup alloc failures
CONFIG_LOG_STRDUP_MAX_STRING=150
CONFIG_LOG_STRDUP_BUF_COUNT=48

CONFIG_NET_LOG=y

CONFIG_NET_SOCKETS_LOG_LEVEL_DBG=y
CONFIG_NET_CONN_LOG_LEVEL_DBG=y
CONFIG_NET_CONTEXT_LOG_LEVEL_DBG=y

#
#overlay-ot.conf
#
CONFIG_NEWLIB_LIBC=y

# Disable TCP and IPv4 (TCP disabled to avoid heavy traffic)
CONFIG_NET_TCP=y
CONFIG_NET_IPV4=n

CONFIG_NET_IPV6_NBR_CACHE=n
CONFIG_NET_IPV6_MLD=n
CONFIG_NET_CONFIG_NEED_IPV4=n
CONFIG_NET_CONFIG_MY_IPV4_ADDR=&amp;quot;&amp;quot;
CONFIG_NET_CONFIG_PEER_IPV4_ADDR=&amp;quot;&amp;quot;

CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048

# Enable OpenThread shell
CONFIG_SHELL=y
CONFIG_OPENTHREAD_SHELL=y
CONFIG_SHELL_STACK_SIZE=3072

CONFIG_NET_L2_OPENTHREAD=y

CONFIG_OPENTHREAD_DEBUG=y
CONFIG_OPENTHREAD_L2_DEBUG=y
CONFIG_OPENTHREAD_L2_LOG_LEVEL_INF=y

CONFIG_MAIN_STACK_SIZE=4096
CONFIG_NET_BUF_RX_COUNT=100
CONFIG_NET_BUF_TX_COUNT=100

# mbedTLS tweaks
# CONFIG_MBEDTLS_SSL_MAX_CONTENT_LEN=768
CONFIG_MBEDTLS_DEBUG_C=y
CONFIG_MBEDTLS_DEBUG=y
CONFIG_MBEDTLS_DEBUG_LEVEL=4


# TLS configuration
CONFIG_MBEDTLS=y
CONFIG_MBEDTLS_BUILTIN=y
CONFIG_MBEDTLS_ENABLE_HEAP=y
CONFIG_MBEDTLS_HEAP_SIZE=90000
#100000
CONFIG_MBEDTLS_SSL_MAX_CONTENT_LEN=10240
CONFIG_MBEDTLS_PEM_CERTIFICATE_FORMAT=y

CONFIG_NET_SOCKETS_SOCKOPT_TLS=y
CONFIG_NET_SOCKETS_TLS_MAX_CONTEXTS=4
CONFIG_NET_SOCKETS_ENABLE_DTLS=y
CONFIG_POSIX_MAX_FDS=8

###################################################

CONFIG_NET_MGMT_EVENT_INFO=y
#^needed per https://github.com/zephyrproject-rtos/zephyr/issues/46594

CONFIG_MBEDTLS=y
CONFIG_MBEDTLS_BUILTIN=y
CONFIG_MBEDTLS_TLS_VERSION_1_2=y
CONFIG_MBEDTLS_KEY_EXCHANGE_PSK_ENABLED=y
CONFIG_MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED=y
CONFIG_MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED=y
#^added per https://devzone.nordicsemi.com/f/nordic-q-a/86632/openthread-and-mqtt-over-tls-is-single-program&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I also notice that &amp;quot;tcp&amp;quot; is included in the OpenThread CLI full commands list at the &lt;a href="https://github.com/openthread/openthread/blob/master/src/cli/README.md"&gt;link &lt;/a&gt;below.&amp;nbsp;There must be a reason that it didn&amp;#39;t&amp;nbsp;get carried over into this commands list in the Connect SDK? Maybe I would have luck after recompiling the OpenThread library?&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1657892194960v1.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1657892238337v2.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:158px;max-width:148px;" alt=" " height="158" src="https://devzone.nordicsemi.com/resized-image/__size/296x316/__key/communityserver-discussions-components-files/4/pastedimage1657892258016v3.png" width="148" /&gt;&lt;/p&gt;
&lt;p&gt;------------&lt;/p&gt;
&lt;p&gt;EDIT: I think it has something to do with the fact that&amp;nbsp;OPENTHREAD_CONFIG_TCP_ENABLE and OPENTHREAD_CONFIG_CLI_TCP_ENABLE are not defined. If you look at cli.cpp, cli.hpp, and cli_tcp.cpp in the OpenThread CLI repository (linked&amp;nbsp;further up in this reply), they all have the same IF statement containing some TCP-enabling code (two examples from cli.cpp shown below).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;However, I still do not see &amp;quot;tcp&amp;quot; as a subcommand if I create these two variables in a Kconfig file and set them =y in the prj.conf.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;pre class="ui-code" data-mode="text"&gt;#if OPENTHREAD_CONFIG_TCP_ENABLE &amp;amp;&amp;amp; OPENTHREAD_CONFIG_CLI_TCP_ENABLE
    template &amp;lt;&amp;gt; otError Interpreter::Process&amp;lt;Cmd(&amp;quot;tcp&amp;quot;)&amp;gt;(Arg aArgs[])
    {
         return mTcp.Process(aArgs);
    }
#endif 

...

#if OPENTHREAD_CONFIG_TCP_ENABLE &amp;amp;&amp;amp; OPENTHREAD_CONFIG_CLI_TCP_ENABLE
        CmdEntry(&amp;quot;tcp&amp;quot;),
#endif&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>