Could not allocate rx buffer error with Ethernet samples using ENC424J600 with nRF52840

Hi,

I've got a custom board with an ENC424J600 connected to an nRF52840. I started with nRF Connect v2.0.0 but I've since upgraded to the latest (v2.3.0-rc1) to see if it fixed my problem - which it didn't.

I made a custom zephyr "board" based on the nRF52840 devkit files and modified it as needed to add a the enc424j600 to SPI0. I got the http_client demo to connect to a simple unsecure server running on my PC (the TCPIP_Demo.jar app from Microchip) - so the hardware and the basics of adding the mac/phy to my project seems to be good.

My next step is to get it working with something out in the real world - like doing an http get from google or bouncing something off the tcpbin.com echo server. The problem is that when I try to do a DNS lookup with getaddrinfo() I get a "Could not allocate rx buffer" error. I've tried the http_get and the http_client examples with the same result. Fulll RTT output below:

00> [00:00:00.314,422] <inf> ethdrv: Link down
00> [00:00:00.314,483] <inf> ethdrv: ENC424J600 Initialized
00> [00:00:00.314,758] <inf> ethdrv: Not suspended
00> *** Booting Zephyr OS build v3.2.99-ncs2-rc1 ***
00> [00:00:00.315,032] <inf> net_config: Initializing network
00> [00:00:00.315,063] <inf> net_config: Waiting interface 1 (0x20001338) to be up...
00> [00:00:01.838,989] <inf> ethdrv: Link up
00> [00:00:01.839,233] <inf> ethdrv: 100Mbps
00> [00:00:01.839,233] <inf> ethdrv: full duplex
00> [00:00:01.840,179] <inf> net_config: Interface 1 (0x20001338) coming up
00> [00:00:01.846,527] <inf> net_config: IPv4 address: 192.168.137.2
00> [00:00:07.770,538] <err> ethdrv: Could not allocate rx buffer

It seems like the error is coming from a memory allocation attempt in mem_slab.c.

I've been trying to increase all of the memory sizes I can but either I haven't found the right one to increase, or maybe I'm just not setting them high enough. Here's what I've added so far - with no change in results:

CONFIG_ETH_ENC424J600_RX_THREAD_STACK_SIZE=1536
CONFIG_MEM_SLAB_TRACE_MAX_UTILIZATION=y
CONFIG_HEAP_MEM_POOL_SIZE=1024
CONFIG_MAIN_STACK_SIZE=1536
Please help! This is quite urgent as we need to determine if this hardware solution is solid before we fully commit to this path for manufacturing.
Thanks,
Glen
Parents
  • I think adding CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE might have fixed that memory allocation issue - but I am still having failures with getaddrinfo (returning error code -2), so I decided to try the dns_resolve sample project. This one makes it look like it's sending out a request, but then it always comes back as canceled. See log below.

    Could this be a hardware issue? Any ideas why my dns request is being canceled?

    00> [00:00:00.315,856] <inf> ethdrv: Link down
    00> [00:00:00.315,887] <inf> ethdrv: ENC424J600 Initialized
    00> [00:00:00.316,436] <inf> ethdrv: Not suspended
    00> *** Booting Zephyr OS build v3.2.99-ncs2-rc1 ***
    00> [00:00:00.317,169] <inf> net_config: Initializing network
    00> [00:00:00.317,169] <inf> net_config: Waiting interface 1 (0x20001114) to be up...
    00> [00:00:08.753,601] <inf> ethdrv: Link up
    00> [00:00:08.753,814] <inf> ethdrv: 100Mbps
    00> [00:00:08.753,845] <inf> ethdrv: full duplex
    00> [00:00:08.754,760] <inf> net_config: Interface 1 (0x20001114) coming up
    00> [00:00:08.761,077] <inf> net_config: IPv4 address: 192.0.2.1
    00> [00:00:08.864,624] <inf> net_config: IPv6 address: 2001:db8::1
    00> [00:00:08.864,685] <inf> net_dns_resolve_client_sample: Starting DNS resolve sample
    00> [00:00:08.865,142] <err> net_arp: Gateway not set for iface 0x20001114
    00> [00:00:08.865,173] <dbg> net_dns_resolve_client_sample: do_ipv4_lookup: DNS id 24221
    00> [00:00:08.865,203] <dbg> net_dns_resolve_client_sample: do_mdns_ipv4_lookup: Doing mDNS IPv4 query
    00> [00:00:08.867,156] <dbg> net_dns_resolve_client_sample: do_mdns_ipv4_lookup: mDNS v4 query sent
    00> [00:00:10.865,020] <inf> net_dns_resolve_client_sample: DNS query was canceled
    00> [00:00:10.865,509] <inf> net_dns_resolve_client_sample: mDNS query was canceled

    Thanks,

    Glen

Reply
  • I think adding CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE might have fixed that memory allocation issue - but I am still having failures with getaddrinfo (returning error code -2), so I decided to try the dns_resolve sample project. This one makes it look like it's sending out a request, but then it always comes back as canceled. See log below.

    Could this be a hardware issue? Any ideas why my dns request is being canceled?

    00> [00:00:00.315,856] <inf> ethdrv: Link down
    00> [00:00:00.315,887] <inf> ethdrv: ENC424J600 Initialized
    00> [00:00:00.316,436] <inf> ethdrv: Not suspended
    00> *** Booting Zephyr OS build v3.2.99-ncs2-rc1 ***
    00> [00:00:00.317,169] <inf> net_config: Initializing network
    00> [00:00:00.317,169] <inf> net_config: Waiting interface 1 (0x20001114) to be up...
    00> [00:00:08.753,601] <inf> ethdrv: Link up
    00> [00:00:08.753,814] <inf> ethdrv: 100Mbps
    00> [00:00:08.753,845] <inf> ethdrv: full duplex
    00> [00:00:08.754,760] <inf> net_config: Interface 1 (0x20001114) coming up
    00> [00:00:08.761,077] <inf> net_config: IPv4 address: 192.0.2.1
    00> [00:00:08.864,624] <inf> net_config: IPv6 address: 2001:db8::1
    00> [00:00:08.864,685] <inf> net_dns_resolve_client_sample: Starting DNS resolve sample
    00> [00:00:08.865,142] <err> net_arp: Gateway not set for iface 0x20001114
    00> [00:00:08.865,173] <dbg> net_dns_resolve_client_sample: do_ipv4_lookup: DNS id 24221
    00> [00:00:08.865,203] <dbg> net_dns_resolve_client_sample: do_mdns_ipv4_lookup: Doing mDNS IPv4 query
    00> [00:00:08.867,156] <dbg> net_dns_resolve_client_sample: do_mdns_ipv4_lookup: mDNS v4 query sent
    00> [00:00:10.865,020] <inf> net_dns_resolve_client_sample: DNS query was canceled
    00> [00:00:10.865,509] <inf> net_dns_resolve_client_sample: mDNS query was canceled

    Thanks,

    Glen

Children
No Data
Related