Buffer allocation failure on aws_iot_connect

Board: nRF7002DK

I extended the WiFi proviosing example of nRF7002 and added the aws part from aws_iot example. WiFi connection and IP allocation along with DNS resolution all working fine.
But during the TLS handshake there is buffer allocation failure resulting in TLS handshake failure. I am not able to find the exact root cause for this failure. 
Can anyone help me out to find what need to be fixed?


Following are the error codes I am facing
00> [00:00:16.697,143] <dbg> aws_iot: broker_init: IPv4 Address found 52.57.145.200
00> [00:00:16.697,296] <dbg> net_mqtt_sock_tls: mqtt_client_tls_connect: (0x2000bb20): Created socket 7
00> [00:00:17.098,937] <err> net_pkt: Data buffer (68) allocation failed.
00> [00:00:17.099,029] <err> net_sock_tls: TLS handshake error: -4e
00> [00:00:17.101,257] <err> aws_iot: mqtt_connect, error: -113
00> [00:00:17.101,257] <err> aws_iot: AWS broker connect failed -113

Following are the memory configs I have in my project

# Memories
CONFIG_MAIN_STACK_SIZE=8192
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096
CONFIG_NET_TX_STACK_SIZE=4096
CONFIG_NET_RX_STACK_SIZE=4096
CONFIG_NET_MGMT_EVENT_STACK_SIZE=8192
CONFIG_NET_TCP_WORKQ_STACK_SIZE=4096
CONFIG_NET_BUF_RX_COUNT=10
CONFIG_NET_BUF_TX_COUNT=10
CONFIG_NET_BUF_DATA_SIZE=128
CONFIG_HEAP_MEM_POOL_SIZE=153600
CONFIG_NET_TC_TX_COUNT=2
CONFIG_NET_PKT_RX_COUNT=20
CONFIG_NET_PKT_TX_COUNT=20
Parents
  • Hi

    Seems like you haven't set them to the exact values from the Github link I provided, so just to confirm, do you also see the same error message with the following values as well?

    CONFIG_NET_PKT_RX_COUNT=32
    CONFIG_NET_PKT_TX_COUNT=48
    CONFIG_NET_BUF_RX_COUNT=32
    CONFIG_NET_BUF_TX_COUNT=96
    CONFIG_HEAP_MEM_POOL_SIZE=170000
    CONFIG_NET_BUF_DATA_SIZE=1100

    You can also try to increase the size of CONFIG_NRF_MODEM_LIB_HEAP_SIZE to avoid this MQTT error. The ENOMEM error from mqtt_connect is usually seen when there are no sockets available for it, so can you show us the prj.conf and main.c files of your project if that doesn't help either?

    Best regards,

    Simon

Reply
  • Hi

    Seems like you haven't set them to the exact values from the Github link I provided, so just to confirm, do you also see the same error message with the following values as well?

    CONFIG_NET_PKT_RX_COUNT=32
    CONFIG_NET_PKT_TX_COUNT=48
    CONFIG_NET_BUF_RX_COUNT=32
    CONFIG_NET_BUF_TX_COUNT=96
    CONFIG_HEAP_MEM_POOL_SIZE=170000
    CONFIG_NET_BUF_DATA_SIZE=1100

    You can also try to increase the size of CONFIG_NRF_MODEM_LIB_HEAP_SIZE to avoid this MQTT error. The ENOMEM error from mqtt_connect is usually seen when there are no sockets available for it, so can you show us the prj.conf and main.c files of your project if that doesn't help either?

    Best regards,

    Simon

Children
No Data
Related