The sta sample project is giving me a lot of errors, what should I do?

I am trying to run nRF7002DK, and when I connect to a WiFi network using the sta sample or the shell sample, I get a bunch of errors.
net_pkt: Data buffer (xxx) allocation failed

Someone asked the same question on DevZone, so I tried doubling the CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE as described there, but the error keeps occurring.
https://devzone.nordicsemi.com/f/nordic-q-a/97812/net_pkt-data-buffer-42-allocation-failed
How do I fix this?
Also, I don't know if this is related, but TCP socket communication doesn't work at all. where can I find samples of TCP and UDP communication?

Parents
  • Hi Yoshihiro,
    Could you share your prj.conf configuration so I might see if any configurations are missing!!

    Regards

    Lalith RJ

  • Hi,

    My prj.conf is the below. This project is an original project with necessary parts extracted from sta and shell.

    CONFIG_WIFI=y
    CONFIG_NET_L2_ETHERNET=y
    CONFIG_NET_IPV6=n
    CONFIG_HEAP_MEM_POOL_SIZE=163840
    CONFIG_MAIN_STACK_SIZE=4096
    CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096
    CONFIG_NET_PKT_RX_COUNT=8
    CONFIG_NET_PKT_TX_COUNT=8
    CONFIG_DK_LIBRARY=y
    CONFIG_WIFI_NRF700X=y
    CONFIG_NET_MGMT_EVENT_STACK_SIZE=2048
    CONFIG_WPA_SUPP=y
    CONFIG_USE_SEGGER_RTT=y
    CONFIG_NEWLIB_LIBC=y
    CONFIG_NEWLIB_LIBC_MIN_REQUIRED_HEAP_SIZE=2048
    CONFIG_DEBUG_THREAD_INFO=y
    CONFIG_LOG_PROCESS_THREAD_SLEEP_MS=100
    CONFIG_NETWORKING=y
    CONFIG_NET_IPV4=y
    CONFIG_NET_DHCPV4=y
    CONFIG_NET_TCP=y
    CONFIG_NET_TCP_WORKQ_STACK_SIZE=2048
    CONFIG_NET_MAX_CONTEXTS=2
    CONFIG_NET_BUF_RX_COUNT=8
    CONFIG_NET_BUF_TX_COUNT=8
    CONFIG_NET_TX_STACK_SIZE=8192
    CONFIG_NET_RX_STACK_SIZE=8192
    CONFIG_NET_LOG=y
    CONFIG_NET_CONN_LOG_LEVEL_INF=y
    CONFIG_NET_CONFIG_SETTINGS=y
    CONFIG_NET_CONFIG_MY_IPV4_NETMASK="255.255.254.0"
    CONFIG_NET_CONFIG_MY_IPV4_GW="10.0.4.1"
    CONFIG_NET_SOCKETS=y
    CONFIG_DEBUG_OPTIMIZATIONS=y
    

Reply
  • Hi,

    My prj.conf is the below. This project is an original project with necessary parts extracted from sta and shell.

    CONFIG_WIFI=y
    CONFIG_NET_L2_ETHERNET=y
    CONFIG_NET_IPV6=n
    CONFIG_HEAP_MEM_POOL_SIZE=163840
    CONFIG_MAIN_STACK_SIZE=4096
    CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096
    CONFIG_NET_PKT_RX_COUNT=8
    CONFIG_NET_PKT_TX_COUNT=8
    CONFIG_DK_LIBRARY=y
    CONFIG_WIFI_NRF700X=y
    CONFIG_NET_MGMT_EVENT_STACK_SIZE=2048
    CONFIG_WPA_SUPP=y
    CONFIG_USE_SEGGER_RTT=y
    CONFIG_NEWLIB_LIBC=y
    CONFIG_NEWLIB_LIBC_MIN_REQUIRED_HEAP_SIZE=2048
    CONFIG_DEBUG_THREAD_INFO=y
    CONFIG_LOG_PROCESS_THREAD_SLEEP_MS=100
    CONFIG_NETWORKING=y
    CONFIG_NET_IPV4=y
    CONFIG_NET_DHCPV4=y
    CONFIG_NET_TCP=y
    CONFIG_NET_TCP_WORKQ_STACK_SIZE=2048
    CONFIG_NET_MAX_CONTEXTS=2
    CONFIG_NET_BUF_RX_COUNT=8
    CONFIG_NET_BUF_TX_COUNT=8
    CONFIG_NET_TX_STACK_SIZE=8192
    CONFIG_NET_RX_STACK_SIZE=8192
    CONFIG_NET_LOG=y
    CONFIG_NET_CONN_LOG_LEVEL_INF=y
    CONFIG_NET_CONFIG_SETTINGS=y
    CONFIG_NET_CONFIG_MY_IPV4_NETMASK="255.255.254.0"
    CONFIG_NET_CONFIG_MY_IPV4_GW="10.0.4.1"
    CONFIG_NET_SOCKETS=y
    CONFIG_DEBUG_OPTIMIZATIONS=y
    

Children
  • Hi,

    I have successfully tested wi-fi sta sample in NCS v2.4.2 using your prj.conf file with the addition of security method, SSID and password.

    CONFIG_STA_KEY_MGMT_WPA2=y
    CONFIG_STA_SAMPLE_SSID="<your_SSID>"
    CONFIG_STA_SAMPLE_PASSWORD="<your_password>"


    Best regards,
    Dejan

  • Hi,

    My apologies, my explanation was insufficient. Of course, I have the SSID, password, and encryption settings, but that is private information, so I did not post it.
    I am able to connect to the WiFi router with the sta project. The problem is that after a while of connecting, errors occur frequently. Of course I have not done anything other than connecting.

    [00:00:00.505,065] <inf> wifi_nrf: Firmware (v1.2.8.1) booted successfully
    
    *** Booting Zephyr OS build v3.3.99-ncs1-1 ***
    [00:00:00.675,598] <inf> net_config: Initializing network
    [00:00:00.675,598] <inf> net_config: Waiting interface 1 (0x20000c98) to be up...
    [00:00:00.677,612] <inf> net_config: IPv4 address: 10.0.5.250
    [00:00:00.677,642] <inf> net_config: Running dhcpv4 client...
    [00:00:06.390,289] <inf> sta: Starting nrf7002dk_nrf5340_cpuapp with CPU frequency: 64 MHz
    [00:00:07.390,350] <inf> sta: QSPI Encryption disabled
    [00:00:07.390,411] <inf> sta: Static IP address (overridable): 10.0.5.250/255.255.240.0 -> 10.0.4.1
    [00:00:08.962,066] <inf> sta: Connection requested
    [00:00:09.262,207] <inf> sta: ==================
    [00:00:09.262,237] <inf> sta: State: SCANNING
    [00:00:09.562,377] <inf> sta: ==================
    [00:00:09.562,408] <inf> sta: State: SCANNING
    [00:00:09.862,518] <inf> sta: ==================
    [00:00:09.862,548] <inf> sta: State: SCANNING
    [00:00:10.162,658] <inf> sta: ==================
    [00:00:10.162,689] <inf> sta: State: SCANNING
    [00:00:10.462,799] <inf> sta: ==================
    [00:00:10.462,829] <inf> sta: State: SCANNING
    [00:00:10.762,969] <inf> sta: ==================
    [00:00:10.763,000] <inf> sta: State: SCANNING
    [00:00:11.063,110] <inf> sta: ==================
    [00:00:11.063,140] <inf> sta: State: SCANNING
    [00:00:11.363,250] <inf> sta: ==================
    [00:00:11.363,281] <inf> sta: State: SCANNING
    [00:00:11.663,391] <inf> sta: ==================
    [00:00:11.663,421] <inf> sta: State: SCANNING
    [00:00:11.963,562] <inf> sta: ==================
    [00:00:11.963,592] <inf> sta: State: SCANNING
    [00:00:12.263,732] <inf> sta: ==================
    [00:00:12.263,763] <inf> sta: State: SCANNING
    [00:00:12.563,873] <inf> sta: ==================
    [00:00:12.563,903] <inf> sta: State: SCANNING
    [00:00:12.864,013] <inf> sta: ==================
    [00:00:12.864,044] <inf> sta: State: SCANNING
    [00:00:13.164,184] <inf> sta: ==================
    [00:00:13.164,215] <inf> sta: State: SCANNING
    [00:00:13.367,187] <inf> wifi_nrf: wifi_nrf_wpa_supp_authenticate:Authentication request sent successfully
    
    [00:00:13.464,324] <inf> sta: ==================
    [00:00:13.464,355] <inf> sta: State: AUTHENTICATING
    [00:00:13.730,712] <inf> wifi_nrf: wifi_nrf_wpa_supp_associate: Association request sent successfully
    
    [00:00:13.777,252] <inf> sta: ==================
    [00:00:13.777,282] <inf> sta: State: 4WAY_HANDSHAKE
    [00:00:13.777,282] <inf> sta: Interface Mode: STATION
    [00:00:13.777,313] <inf> sta: Link Mode: WIFI 5 (802.11ac/VHT)
    [00:00:13.777,343] <inf> sta: SSID: ************
    [00:00:13.777,404] <inf> sta: BSSID: 00:11:32:96:70:A9
    [00:00:13.777,404] <inf> sta: Band: 5GHz
    [00:00:13.777,435] <inf> sta: Channel: 36
    [00:00:13.777,465] <inf> sta: Security: WPA2-PSK
    [00:00:13.777,465] <inf> sta: MFP: Optional
    [00:00:13.777,496] <inf> sta: RSSI: -55
    [00:00:13.809,844] <inf> sta: Connected
    [00:00:14.092,590] <inf> sta: ==================
    [00:00:14.092,620] <inf> sta: State: COMPLETED
    [00:00:14.092,651] <inf> sta: Interface Mode: STATION
    [00:00:14.092,681] <inf> sta: Link Mode: WIFI 5 (802.11ac/VHT)
    [00:00:14.092,712] <inf> sta: SSID: ************
    [00:00:14.092,742] <inf> sta: BSSID: 00:11:32:96:70:A9
    [00:00:14.092,773] <inf> sta: Band: 5GHz
    [00:00:14.092,773] <inf> sta: Channel: 36
    [00:00:14.092,803] <inf> sta: Security: WPA2-PSK
    [00:00:14.092,834] <inf> sta: MFP: Optional
    [00:00:14.092,834] <inf> sta: RSSI: -55
    [00:00:27.293,121] <inf> net_dhcpv4: Received: 10.0.4.69
    [00:00:27.293,273] <inf> net_config: IPv4 address: 10.0.4.69
    [00:00:27.293,304] <inf> net_config: Lease time: 86400 seconds
    [00:00:27.293,334] <inf> net_config: Subnet: 255.255.240.0
    [00:00:27.293,365] <inf> net_config: Router: 10.0.4.1
    [00:00:27.295,349] <inf> sta: DHCP IP address: 10.0.4.69
    [00:03:54.677,856] <err> net_pkt: Data buffer (1500) allocation failed.
    [00:03:54.677,886] <wrn> net_conn: pkt cloning failed, pkt 0x20034dac dropped
    [00:03:54.781,616] <err> net_pkt: Data buffer (1496) allocation failed.
    [00:03:54.781,616] <wrn> net_conn: pkt cloning failed, pkt 0x20034dac dropped
    [00:03:54.885,284] <err> net_pkt: Data buffer (1172) allocation failed.
    [00:03:54.885,314] <wrn> net_conn: pkt cloning failed, pkt 0x20034dac dropped
    [00:03:54.985,931] <err> net_pkt: Data buffer (1192) allocation failed.
    [00:03:54.985,961] <wrn> net_conn: pkt cloning failed, pkt 0x20034d68 dropped
    [00:03:55.086,517] <err> net_pkt: Data buffer (1500) allocation failed.
    [00:03:55.086,517] <wrn> net_conn: pkt cloning failed, pkt 0x20034df0 dropped
    [00:03:55.190,216] <err> net_pkt: Data buffer (1496) allocation failed.
    [00:03:55.190,246] <wrn> net_conn: pkt cloning failed, pkt 0x20034df0 dropped
    [00:03:55.296,905] <err> net_pkt: Data buffer (1058) allocation failed.
    [00:03:55.296,936] <wrn> net_conn: pkt cloning failed, pkt 0x20034df0 dropped
    [00:03:55.397,491] <err> net_pkt: Data buffer (1078) allocation failed.
    [00:03:55.397,521] <wrn> net_conn: pkt cloning failed, pkt 0x20034dac dropped
    [00:03:55.500,640] <err> net_pkt: Data buffer (1022) allocation failed.
    [00:03:55.500,671] <wrn> net_conn: pkt cloning failed, pkt 0x20034d68 dropped
    [00:03:55.601,257] <err> net_pkt: Data buffer (1042) allocation failed.
    [00:03:55.601,287] <wrn> net_conn: pkt cloning failed, pkt 0x20034df0 dropped
    [00:03:55.888,244] <err> net_pkt: Data buffer (1168) allocation failed.
    [00:03:55.888,275] <wrn> net_conn: pkt cloning failed, pkt 0x20034dac dropped
    [00:03:55.988,891] <err> net_pkt: Data buffer (1188) allocation failed.
    [00:03:55.988,922] <wrn> net_conn: pkt cloning failed, pkt 0x20034d68 dropped
    [00:03:57.111,755] <err> net_pkt: Data buffer (1015) allocation failed.
    [00:03:57.111,785] <wrn> net_conn: pkt cloning failed, pkt 0x20034d68 dropped
    [00:03:58.787,200] <err> net_pkt: Data buffer (1152) allocation failed.
    [00:03:58.787,231] <wrn> net_conn: pkt cloning failed, pkt 0x20034dac dropped
    [00:03:58.887,847] <err> net_pkt: Data buffer (1172) allocation failed.
    [00:03:58.887,878] <wrn> net_conn: pkt cloning failed, pkt 0x20034df0 dropped
    [00:03:59.171,142] <err> net_pkt: Data buffer (1015) allocation failed.
    [00:03:59.171,173] <wrn> net_conn: pkt cloning failed, pkt 0x20034df0 dropped
    [00:03:59.979,675] <err> net_pkt: Data buffer (1058) allocation failed.
    [00:03:59.979,705] <wrn> net_conn: pkt cloning failed, pkt 0x20034dac dropped
    [00:04:00.080,261] <err> net_pkt: Data buffer (1078) allocation failed.
    [00:04:00.080,291] <wrn> net_conn: pkt cloning failed, pkt 0x20034d68 dropped
    [00:04:01.616,577] <err> net_pkt: Data buffer (1149) allocation failed.
    [00:04:01.616,607] <wrn> net_conn: pkt cloning failed, pkt 0x20034d68 dropped
    [00:04:02.433,380] <err> net_pkt: Data buffer (1465) allocation failed.
    [00:04:02.433,410] <wrn> net_conn: pkt cloning failed, pkt 0x20034dac dropped
    [00:04:02.534,118] <err> net_pkt: Data buffer (1485) allocation failed.
    [00:04:02.534,149] <wrn> net_conn: pkt cloning failed, pkt 0x20034df0 dropped
    

    Best Regards,

    Yoshihiro Goto

  • Errors continue to occur, but I think that is enough information, so I will stop at this point.

    [00:04:34.790,771] <err> net_pkt: Data buffer (1116) allocation failed.
    [00:04:34.790,802] <wrn> net_conn: pkt cloning failed, pkt 0x20034df0 dropped
    [00:04:34.891,418] <err> net_pkt: Data buffer (1136) allocation failed.
    [00:04:34.891,448] <wrn> net_conn: pkt cloning failed, pkt 0x20034d68 dropped
    [00:10:02.492,950] <err> net_pkt: Data buffer (1140) allocation failed.
    [00:10:02.492,980] <wrn> net_conn: pkt cloning failed, pkt 0x20034df0 dropped
    [00:10:02.593,475] <err> net_pkt: Data buffer (1103) allocation failed.
    [00:10:02.593,505] <wrn> net_conn: pkt cloning failed, pkt 0x20034dac dropped
    [00:10:02.697,753] <err> net_pkt: Data buffer (1103) allocation failed.
    [00:10:02.697,784] <wrn> net_conn: pkt cloning failed, pkt 0x20034dac dropped
    [00:10:02.901,031] <err> net_pkt: Data buffer (1103) allocation failed.
    [00:10:02.901,062] <wrn> net_conn: pkt cloning failed, pkt 0x20034dac dropped
    [00:10:03.001,678] <err> net_pkt: Data buffer (1140) allocation failed.
    [00:10:03.001,708] <wrn> net_conn: pkt cloning failed, pkt 0x20034d68 dropped
    [00:10:03.717,620] <err> net_pkt: Data buffer (1140) allocation failed.
    [00:10:03.717,651] <wrn> net_conn: pkt cloning failed, pkt 0x20034df0 dropped
    [00:10:03.818,145] <err> net_pkt: Data buffer (1103) allocation failed.
    [00:10:03.818,176] <wrn> net_conn: pkt cloning failed, pkt 0x20034dac dropped
    [00:10:05.405,548] <err> net_pkt: Data buffer (1140) allocation failed.
    [00:10:05.405,578] <wrn> net_conn: pkt cloning failed, pkt 0x20034dac dropped
    [00:10:05.506,134] <err> net_pkt: Data buffer (1103) allocation failed.
    [00:10:05.506,164] <wrn> net_conn: pkt cloning failed, pkt 0x20034df0 dropped
    [00:10:05.609,649] <err> net_pkt: Data buffer (1103) allocation failed.
    [00:10:05.609,680] <wrn> net_conn: pkt cloning failed, pkt 0x20034df0 dropped
    [00:10:05.713,043] <err> net_pkt: Data buffer (1140) allocation failed.
    [00:10:05.713,073] <wrn> net_conn: pkt cloning failed, pkt 0x20034df0 dropped
    [00:10:05.813,537] <err> net_pkt: Data buffer (1103) allocation failed.
    [00:10:05.813,568] <wrn> net_conn: pkt cloning failed, pkt 0x20034d68 dropped
    [00:10:06.184,143] <err> net_pkt: Data buffer (1140) allocation failed.
    [00:10:06.184,173] <wrn> net_conn: pkt cloning failed, pkt 0x20034d68 dropped
    [00:10:06.284,667] <err> net_pkt: Data buffer (1103) allocation failed.
    [00:10:06.284,698] <wrn> net_conn: pkt cloning failed, pkt 0x20034df0 dropped
    [00:10:06.403,625] <err> net_pkt: Data buffer (1140) allocation failed.
    [00:10:06.403,656] <wrn> net_conn: pkt cloning failed, pkt 0x20034dac dropped
    [00:10:22.576,934] <err> net_pkt: Data buffer (1430) allocation failed.
    [00:10:22.576,965] <wrn> net_conn: pkt cloning failed, pkt 0x20034dac dropped
    [00:10:22.677,703] <err> net_pkt: Data buffer (1450) allocation failed.
    [00:10:22.677,734] <wrn> net_conn: pkt cloning failed, pkt 0x20034d68 dropped
    [00:11:46.992,004] <err> net_pkt: Data buffer (1141) allocation failed.
    [00:11:46.992,034] <wrn> net_conn: pkt cloning failed, pkt 0x20034d68 dropped
    [00:11:47.092,498] <err> net_pkt: Data buffer (1104) allocation failed.
    [00:11:47.092,529] <wrn> net_conn: pkt cloning failed, pkt 0x20034dac dropped
    [00:11:47.365,203] <err> net_pkt: Data buffer (1141) allocation failed.
    [00:11:47.365,234] <wrn> net_conn: pkt cloning failed, pkt 0x20034df0 dropped
    [00:11:47.515,136] <err> net_pkt: Data buffer (1104) allocation failed.
    [00:11:47.515,167] <wrn> net_conn: pkt cloning failed, pkt 0x20034df0 dropped
    [00:11:47.782,409] <err> net_pkt: Data buffer (1141) allocation failed.
    [00:11:47.782,440] <wrn> net_conn: pkt cloning failed, pkt 0x20034dac dropped
    [00:11:47.913,482] <err> net_pkt: Data buffer (1104) allocation failed.
    [00:11:47.913,513] <wrn> net_conn: pkt cloning failed, pkt 0x20034d68 dropped
    [00:11:48.215,179] <err> net_pkt: Data buffer (1141) allocation failed.
    [00:11:48.215,209] <wrn> net_conn: pkt cloning failed, pkt 0x20034df0 dropped
    [00:11:53.124,664] <err> net_pkt: Data buffer (1141) allocation failed.
    [00:11:53.124,694] <wrn> net_conn: pkt cloning failed, pkt 0x20034dac dropped
    [00:11:53.225,158] <err> net_pkt: Data buffer (1104) allocation failed.
    [00:11:53.225,189] <wrn> net_conn: pkt cloning failed, pkt 0x20034d68 dropped
    [00:11:53.544,952] <err> net_pkt: Data buffer (1104) allocation failed.
    [00:11:53.544,982] <wrn> net_conn: pkt cloning failed, pkt 0x20034d68 dropped
    [00:11:53.645,629] <err> net_pkt: Data buffer (1141) allocation failed.
    [00:11:53.645,660] <wrn> net_conn: pkt cloning failed, pkt 0x20034df0 dropped
    [00:11:53.916,870] <err> net_pkt: Data buffer (1104) allocation failed.
    [00:11:53.916,900] <wrn> net_conn: pkt cloning failed, pkt 0x20034dac dropped
    [00:11:54.017,517] <err> net_pkt: Data buffer (1141) allocation failed.
    [00:11:54.017,547] <wrn> net_conn: pkt cloning failed, pkt 0x20034d68 dropped
    [00:11:54.317,291] <err> net_pkt: Data buffer (1104) allocation failed.
    [00:11:54.317,321] <wrn> net_conn: pkt cloning failed, pkt 0x20034d68 dropped
    [00:11:54.417,938] <err> net_pkt: Data buffer (1141) allocation failed.
    [00:11:54.417,968] <wrn> net_conn: pkt cloning failed, pkt 0x20034df0 dropped
    

  • Hi,

    Yoshihiro Goto said:
    The problem is that after a while of connecting, errors occur frequently. Of course I have not done anything other than connecting.

    How often do you see this error? Does it happen regularly or intermittently? Can you reproduce the error each time after you connect?

    Best regards,
    Dejan

  • Hi,

    How often do you see this error? Does it happen regularly or intermittently? Can you reproduce the error each time after you connect?

    Whenever I connect to my WiFi router, I get an error. Sometimes the error occurs immediately, sometimes after a few minutes.

    Best Regards,

    Yoshihiro Goto

Related