How to correctly minimise Ram usage and enable Wifi Scan, WPA2 PSK connection, ping on nRF7002

Hi,

We are using the nRF7002-DK board. I am using Zephyr samples/net/wifi/shell with no other external connection other than the j2 micro-usb connection to PC and with the following in the prj.conf:

 

CONFIG_EARLY_CONSOLE=y

 

CONFIG_NETWORKING=y

CONFIG_TEST_RANDOM_GENERATOR=y

 

CONFIG_MAIN_STACK_SIZE=5200

CONFIG_SHELL_STACK_SIZE=5200

CONFIG_NET_TX_STACK_SIZE=2048

CONFIG_NET_RX_STACK_SIZE=2048

 

CONFIG_NET_PKT_RX_COUNT=10

CONFIG_NET_PKT_TX_COUNT=10

CONFIG_NET_BUF_RX_COUNT=20

CONFIG_NET_BUF_TX_COUNT=20

CONFIG_NET_MAX_CONTEXTS=10

CONFIG_NET_DHCPV4=y

 

CONFIG_NET_IPV4=y

CONFIG_NET_IPV6=n

 

CONFIG_NET_TCP=y

 

CONFIG_NET_LOG=y

CONFIG_INIT_STACKS=y

 

CONFIG_NET_SHELL=y

 

CONFIG_NET_STATISTICS=y

CONFIG_NET_STATISTICS_PERIODIC_OUTPUT=n

 

CONFIG_WIFI=y

CONFIG_WIFI_LOG_LEVEL_ERR=y

CONFIG_NET_L2_WIFI_SHELL=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_NET_MGMT_EVENT_QUEUE_SIZE=16

 

CONFIG_NET_SHELL_IP_SUPPORTED=y

 

      I was able to run the following: 

            wifi scan

            wifi connect      

            net iface

             net ping

Then, it compiled using : west build -p always -b nrf7002dk/nrf5340/cpuapp/nrf7001 samples/net/wifi/shell

Steps: 

cd /Users/seb/ncs

 

rm -rf build/wifi_shell

 

west build -p always \

  -b nrf7002dk/nrf5340/cpuapp \

  -d build/wifi_shell \

  nrf/samples/wifi/shell

 

...

 

[12/597] Generating include/generated/zephyr/version.h

-- Zephyr version: 4.2.99 (/Users/seb/ncs/zephyr), build: ncs-v3.2.1

[597/597] Linking C executable zephyr/zephyr.elf

Memory region         Used Size  Region Size  %age Used

           FLASH:      769656 B      1008 KB     74.57%

             RAM:      352560 B       448 KB     76.85%

        IDT_LIST:          0 GB        32 KB      0.00%

 

west flash -d build/wifi_shell

By reducing the stack sizes for Wifi and constantly checking the scan, connect, ping functions, I was able to reduce the RAM used to about 253000 B will some acceptable weird behaviours.

I have also disabled debug

Please advise how can I safely reduce the RAM usage further and yet still be able to perform the 4 mentioned acttivities without issues.

Thank you

Parents Reply Children
Related