<?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>nRF7002-DK TCP: Data buffer allocation failed</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/124554/nrf7002-dk-tcp-data-buffer-allocation-failed</link><description>Hello, 
 I am solving a problem with nRF7002-DK, I am using TCP sockets for communication. MTU can have up to 6800 bytes, unfortunately, both in STA and AP mode, the connection is interrupted and the following message is displayed in the terminal: 
 </description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 06 Oct 2025 12:39:33 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/124554/nrf7002-dk-tcp-data-buffer-allocation-failed" /><item><title>RE: nRF7002-DK TCP: Data buffer allocation failed</title><link>https://devzone.nordicsemi.com/thread/550702?ContentTypeID=1</link><pubDate>Mon, 06 Oct 2025 12:39:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c2846fbc-f2c2-49e7-ba30-6b384db3405a</guid><dc:creator>Marte Myrvold</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;34000 can be too low for&amp;nbsp;CONFIG_HEAP_MEM_POOL_SIZE. I recommend trying to increase this and see if that helps.&amp;nbsp;&lt;br /&gt;If you have problems with RAM usage, I recommend looking at&amp;nbsp;&lt;a href="https://docs.nordicsemi.com/bundle/ncs-3.1.1/page/nrf/test_and_optimize/optimizing/memory.html"&gt;Memory footprint optimization&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://docs.nordicsemi.com/bundle/ncs-3.1.1/page/nrf/protocols/wifi/stack_configuration.html"&gt;Wi-Fi stack configuration and performance&lt;/a&gt;&amp;nbsp;to see how you can reduce your application&amp;#39;s memory usage.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Marte&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF7002-DK TCP: Data buffer allocation failed</title><link>https://devzone.nordicsemi.com/thread/550574?ContentTypeID=1</link><pubDate>Fri, 03 Oct 2025 10:02:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:223f49eb-ce70-49b9-a5e4-0df3b8313486</guid><dc:creator>iotdeveloper</dc:creator><description>&lt;p&gt;Hello, yes, I have also tried increasing&amp;nbsp;&lt;span&gt;CONFIG_HEAP_MEM_POOL_SIZE.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I am sending the complete prj. conf here, but I am mainly dealing with a lack of RAM&amp;mdash;if I increase some parameters, I can no longer compile the program; as it is, it is at the compilation limit (99.5% RAM used).&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;#
# Copyright (c) 2022 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

# General
CONFIG_LOG=y
CONFIG_ASSERT=y
CONFIG_MAIN_STACK_SIZE=2048
CONFIG_TEST_RANDOM_GENERATOR=y
CONFIG_RESET_ON_FATAL_ERROR=n

# UART Console
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
CONFIG_SERIAL=y


CONFIG_UART_ASYNC_API=y

# UART1 async
CONFIG_UART_INTERRUPT_DRIVEN=y

CONFIG_UART_1_ASYNC=y
CONFIG_UART_1_INTERRUPT_DRIVEN=n
CONFIG_UART_1_NRF_HW_ASYNC=y
CONFIG_UART_1_NRF_HW_ASYNC_TIMER=2
CONFIG_UART_1_NRF_ASYNC_LOW_POWER=y
CONFIG_NRFX_TIMER2=y

# Logging configuration
CONFIG_LOG_DEFAULT_LEVEL=3
CONFIG_LOG_MODE_IMMEDIATE=y


CONFIG_LOG_BUFFER_SIZE=2048

CONFIG_ZVFS_OPEN_MAX=32


# WiFi Configuration - STA MODE
CONFIG_WIFI=y
CONFIG_WIFI_NRF70=y

# WPA supplicant pro STA mode
CONFIG_WIFI_NM_WPA_SUPPLICANT=y
CONFIG_WIFI_READY_LIB=y

# Logging pro WiFi
CONFIG_WIFI_NM_WPA_SUPPLICANT_LOG_LEVEL_INF=y

# Networking
CONFIG_NETWORKING=y
CONFIG_NET_CONNECTION_MANAGER=y
CONFIG_NET_SOCKETS=y
CONFIG_NET_LOG=y
CONFIG_NET_IPV4=y
CONFIG_NET_UDP=y
CONFIG_NET_TCP=y

CONFIG_POSIX_API=y


CONFIG_NET_PKT_RX_COUNT=72
CONFIG_NET_PKT_TX_COUNT=78
CONFIG_NET_BUF_RX_COUNT=48
CONFIG_NET_BUF_TX_COUNT=38

CONFIG_NET_BUF_FIXED_DATA_SIZE=y
CONFIG_NET_BUF_DATA_SIZE=256

# Below section is the primary contributor to SRAM and is currently
# tuned for performance, but this will be revisited in the future.
CONFIG_NRF70_RX_NUM_BUFS=30

CONFIG_HEAP_MEM_POOL_SIZE=34000
CONFIG_HEAP_MEM_POOL_IGNORE_MIN=y
CONFIG_NRF_WIFI_CTRL_HEAP_SIZE=38000
CONFIG_NRF_WIFI_DATA_HEAP_SIZE=85000
CONFIG_NET_TC_TX_COUNT=1

CONFIG_NET_IF_UNICAST_IPV4_ADDR_COUNT=1

CONFIG_NET_MAX_CONN=10
CONFIG_NET_MAX_CONTEXTS=64
CONFIG_NET_CONTEXT_SYNC_RECV=y

CONFIG_INIT_STACKS=y

CONFIG_NET_L2_ETHERNET=y

# Network configuration
CONFIG_NET_CONFIG_SETTINGS=y
CONFIG_NET_CONFIG_INIT_TIMEOUT=0
CONFIG_NET_DHCPV4=y

CONFIG_NET_SOCKETS_POLL_MAX=10

# Memories
CONFIG_MAIN_STACK_SIZE=4096
CONFIG_NET_TX_STACK_SIZE=4096
CONFIG_NET_RX_STACK_SIZE=4096
CONFIG_MBEDTLS_HEAP_SIZE=512

# Debugging
CONFIG_STACK_SENTINEL=y
CONFIG_DEBUG_COREDUMP=y
CONFIG_DEBUG_COREDUMP_BACKEND_LOGGING=y
CONFIG_DEBUG_COREDUMP_MEMORY_DUMP_MIN=y
CONFIG_SHELL_CMDS_RESIZE=n

# Kernel options
CONFIG_ENTROPY_GENERATOR=y

# Logging
CONFIG_LOG=y
CONFIG_LOG_BUFFER_SIZE=2048
CONFIG_POSIX_CLOCK=y

# printing of scan results puts pressure on queues in new locking
# design in net_mgmt. So, use a higher timeout for a crowded
# environment.
CONFIG_NET_MGMT_EVENT_QUEUE_TIMEOUT=5000


CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=6144
CONFIG_NET_TCP_WORKQ_STACK_SIZE=6144


#Memory stats
CONFIG_SYS_MEM_BLOCKS=y
CONFIG_THREAD_STACK_INFO=y
CONFIG_THREAD_RUNTIME_STATS=y
CONFIG_SYS_HEAP_RUNTIME_STATS=y


CONFIG_NET_BUF_POOL_USAGE=y
CONFIG_NET_DEBUG_NET_PKT_ALLOC=y
CONFIG_NET_STATISTICS=y
CONFIG_NET_SHELL=y

CONFIG_NET_STATISTICS_IPV4=y
CONFIG_NET_STATISTICS_TCP=y
CONFIG_NET_STATISTICS_WIFI=y
&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thank you&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF7002-DK TCP: Data buffer allocation failed</title><link>https://devzone.nordicsemi.com/thread/550560?ContentTypeID=1</link><pubDate>Fri, 03 Oct 2025 08:31:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:58f27443-e7f4-4820-bfb7-cd12f1001ac5</guid><dc:creator>Marte Myrvold</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;net mem&lt;/code&gt; command shows the total and available buffers for each pool. The &lt;code&gt;net allocs&lt;/code&gt; command helps you track which functions are allocating and freeing buffers. Lastly, the &lt;code&gt;net stats&lt;/code&gt; command provides drop and error counters.&lt;/p&gt;
[quote user="iotdeveloper"]I can see that there are many free buffers left, but despite that, I encountered an allocation error there.[/quote]
&lt;p&gt;It could be that other related resources (such as data buffers, packet buffers, or heap memory) are exhausted. Have you tried increasing&amp;nbsp;CONFIG_HEAP_MEM_POOL_SIZE?&lt;/p&gt;
&lt;p&gt;Can you share what you have configured these configs as?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_NET_PKT_TX_COUNT
CONFIG_NET_PKT_RX_COUNT
CONFIG_NET_BUF_TX_COUNT
CONFIG_NET_BUF_RX_COUNT
CONFIG_NET_BUF_DATA_SIZE
CONFIG_HEAP_MEM_POOL_SIZE&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Marte&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF7002-DK TCP: Data buffer allocation failed</title><link>https://devzone.nordicsemi.com/thread/550365?ContentTypeID=1</link><pubDate>Wed, 01 Oct 2025 13:15:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:27ae9642-62d0-40fe-a512-4d0adc12ea66</guid><dc:creator>iotdeveloper</dc:creator><description>&lt;p&gt;Okay, I added this a used the commands, but could you explain me the meaning of the printed output please? Can I somewhere observer the free memory for network buffer value?&lt;/p&gt;
&lt;p&gt;I can see that there are many free buffers left, but despite that, I encountered an allocation error there.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;uart:~$ net&amp;gt; net mem
 mem
Fragment length 256 bytes
Network buffer pools:
Address         Total   Avail   Name
0x20009178      30      25      RX
0x200091b8      20      15      TX
0x20009520      26      26      RX DATA (rx_bufs)
0x20009560      20      16      TX DATA (tx_bufs)
[00:01:00.855,224] &amp;lt;inf&amp;gt; tcp_server: Buffer status: KMB=0/3 free, MODBUS=2/2 free, Active: KMB=3 MODBUS=0
uart:~$ &amp;gt; net allocs
net allocs
Network memory allocations

memory          Status  Pool    Function alloc -&amp;gt; freed
0x20065d50/1     used      RX   tcp_conn_alloc():2106
0x200658cc/1     used      TX   tcp_conn_alloc():2114
0x20065d94/1     used      RX   tcp_conn_alloc():2106
0x20065888/1     used      TX   tcp_conn_alloc():2114
0x20063a80/1     used   TDATA   ethernet_fill_header():584
0x20065e1c/1     used      RX   tcp_conn_alloc():2106
0x20065844/1     used      TX   tcp_conn_alloc():2114
0x20065e60/1     used      RX   tcp_conn_alloc():2106
0x20065954/1     used      TX   tcp_conn_alloc():2114
0x20065dd8/1     used      RX   tcp_conn_alloc():2106
0x20065800/1     used      TX   tcp_conn_alloc():2114
0x20063a80       free   TDATA   ethernet_fill_header():584 -&amp;gt; ethernet_send():809
0x20065aa8       free      TX   tcp_out_ext():1551 -&amp;gt; ethernet_send():809
0x20065aa8       free      TX   tcp_out_ext():1551 -&amp;gt; ethernet_send():809
0x20065a20       free      TX   tcp_out_ext():1551 -&amp;gt; ethernet_send():809
0x20065910       free      TX   tcp_out_ext():1551 -&amp;gt; ethernet_send():809
0x20065ee8       free      RX   net_pkt_from_nbuf():490 -&amp;gt; zsock_recv_stream_immediate():1299
0x20065a20       free      TX   tcp_out_ext():1551 -&amp;gt; ethernet_send():809
0x20065a20       free      TX   tcp_out_ext():1551 -&amp;gt; ethernet_send():809


uart:~$ &amp;gt; net stats
net stats

Interface 0x200095a0 (WiFi) [1]
===============================
IPv6 recv      0        sent    6       drop    0       forwarded       0
IPv6 ND recv   0        sent    4       drop    0
IPv6 MLD recv  0        sent    2       drop    0
IPv4 recv      4206     sent    7546    drop    84      forwarded       0
IP vhlerr      6        hblener 0       lblener 0
IP fragerr     0        chkerr  0       protoer 6
ICMP recv      0        sent    6       drop    79
ICMP typeer    0        chkerr  0
IGMP recv      1        sent    0       drop    0
UDP recv       2        sent    3       drop    84
UDP chkerr     0
TCP bytes recv 58089    sent    1764688 resent  2170
TCP seg recv   10243    sent    5001    drop    0
TCP seg resent 3        chkerr  0       ackerr  0
TCP seg rsterr 0        rst     0
TCP conn drop  0        connrst 0
TCP pkt drop   0
Bytes received 302020
Bytes sent     2174242
Processing err 17
uart:~$&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thank you&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF7002-DK TCP: Data buffer allocation failed</title><link>https://devzone.nordicsemi.com/thread/550183?ContentTypeID=1</link><pubDate>Tue, 30 Sep 2025 12:51:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0248b8c1-1a3c-49d7-b895-61810ddc4ed8</guid><dc:creator>Marte Myrvold</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;You can use Zephyr shell to get runtime statistics and debug information, which lets you see buffer usage.&lt;/p&gt;
&lt;p&gt;Add these in prj.conf to enable this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_NET_BUF_POOL_USAGE=y
CONFIG_NET_DEBUG_NET_PKT_ALLOC=y
CONFIG_NET_STATISTICS=y
CONFIG_NET_SHELL=y&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Then you can use the &lt;code&gt;net stats&lt;/code&gt; and &lt;code&gt;net mem&lt;/code&gt; commands to get statistics about network packets, buffers, and memory usage.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Marte&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF7002-DK TCP: Data buffer allocation failed</title><link>https://devzone.nordicsemi.com/thread/550045?ContentTypeID=1</link><pubDate>Mon, 29 Sep 2025 13:54:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ddcd8228-eff4-4444-bd64-a78cee69ada9</guid><dc:creator>iotdeveloper</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I was trying to increase the parameters values but still I get sometimes the TCP buffer allocation errors. Is there any way to print to console how much space is used/free by network buffers for solution-debugging?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF7002-DK TCP: Data buffer allocation failed</title><link>https://devzone.nordicsemi.com/thread/549677?ContentTypeID=1</link><pubDate>Wed, 24 Sep 2025 12:27:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a6777ec7-9504-4ff7-8015-5645d36d6cd1</guid><dc:creator>Marte Myrvold</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Please try increasing the following in prj.conf:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_NET_PKT_TX_COUNT
CONFIG_NET_PKT_RX_COUNT
CONFIG_NET_BUF_TX_COUNT
CONFIG_NET_BUF_RX_COUNT
CONFIG_NET_BUF_DATA_SIZE
CONFIG_HEAP_MEM_POOL_SIZE&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Marte&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>