nRF7002DK and Zephyr networking samples

Hi,

I'm looking at trying out the new nRF7002DK and test out its capabilities. I'm interested in evaluating the different networking protocols available for Zephyr with this board. NCS only has one networking sample available for the nRF7002DK, MQTT, as far as I know. The broader Zephyr SDK has a lot more networking samples that in theory should work with any of the supported boards that have networking capabilities.

My question is how to make this samples work with the nRF7002DK? I've tried editing the KConfig file to enable the nRF7002DK specific configurations and have been able to build, flash and run them but I always get a runtime error down the road. I've seen any documentation on the Zephyr or NCS docs about making this work. Any help or guidance is appreciated! For reference this is the configuration I'm using for the samples that has gotten me the farthest so far:

# General config
CONFIG_NEWLIB_LIBC=y
CONFIG_NEWLIB_LIBC_NANO=n
CONFIG_DK_LIBRARY=y

# Memories
CONFIG_MAIN_STACK_SIZE=1536
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096
CONFIG_HEAP_MEM_POOL_SIZE=153600

# Networking config
# CONFIG_NET_L2_ETHERNET=y
CONFIG_NETWORKING=y
CONFIG_NET_IPV4=y
CONFIG_NET_IPV6=y
CONFIG_NET_TCP=y
CONFIG_NET_SOCKETS=y
CONFIG_NET_NATIVE=y
CONFIG_NET_MGMT_EVENT_STACK_SIZE=4096

# Enable WiFi Driver and Socket Offload
CONFIG_WIFI=y
CONFIG_WIFI_NRF700X=y
CONFIG_NET_SOCKETS_OFFLOAD=n

# Disable unneeded settings from the base prj.conf:
CONFIG_DNS_RESOLVER=n
CONFIG_DNS_SERVER_IP_ADDRESSES=n
CONFIG_DNS_SERVER1=""
CONFIG_TEST_RANDOM_GENERATOR=n
CONFIG_NET_CONFIG_SETTINGS=n
CONFIG_NET_CONFIG_MY_IPV4_ADDR=""
CONFIG_NET_CONFIG_MY_IPV4_GW=""
CONFIG_NET_CONFIG_PEER_IPV4_ADDR=""

# Network debug config
CONFIG_NET_LOG=y
  • The samples I've tried to run are the following:

    • zephyr/samples/net/sockets/http_client
    • zephyr/samples/net/sockets/http_get
    • zephyr/samples/net/sockets/echo_client
    • zephyr/samples/net/sockets/echo
  • Hi,

    Currently we have not tested any other samples then our own. So its a bit of "uncharted waters" type of situation for now. It should be possible to get them working bout a lot of tinkering might have to be done first. 

    Best place to start is the MQTT docs and work from there Sample description — nRF Connect SDK 2.3.99 documentation (nordicsemi.com).

    So looks like you are on the right path and i would suggest that you share any of the specific issues that you encounter both here on Devzone and also in the Zephyr community.  

    Regards,
    Jonathan

  • Thanks for the advice! I took a look at the example and found it hard to follow as it is multi-threaded and use Zbus which I'm not familiar with. I did find this other example of MQTT on the nRF7002DK that was a great starting point to make the examples work:

    MQTT Example without Zbus

    I got that first working well and then I replaced the MQTT client code with the sample code I wanted to try out and it worked out perfectly! Just for reference this is what I changed in main.c of the example:

    void main(void)
    {
    ....
    #if CONFIG_HTTP_GET_EXAMPLE
    	LOG_INF("HTTP GET request...");
    	http_get_example();
    #elif CONFIG_SOCKET_ECHO_EXAMPLE
    	LOG_INF("Socket echo example...");
    	socket_echo_example();
    #else
    	LOG_INF("Connecting to MQTT Broker...");
    	/* Connect to MQTT Broker */
    	connect_mqtt();
    #endif
    }

    http_get_example() and socket_echo_example() contain the sample code from the Zephyr networking samples (net/socket/http_get and net/socket/echo). I guess the reason the sample were not working was that the initial WiFi network configuration and connection for the nRF7002DK was missing. Glad to help others who might want to try this out.

Related