Difficulty using nRF7002EK with nRF54L15PDK on SPI

Hello,

I am attempting to use the nRF7002EK shield with my nRF54L15PDK development kit.

I have custom code, but it's based on the wifi scan example provided by Nordic to scan nearby SSIDs.

My code builds successfully and runs, but when I enter "wifi scan" in my shell I hit an attribution unit violation.

Using a debugger, I tracked this down to  net_if_get_default(); returning NULL, which makes 

net_mgmt(NET_REQUEST_WIFI_SCAN, iface, &params, sizeof(struct wifi_scan_params)) attempt to dereference a NULL pointer.
 
So, I'm wondering what needs to be done to get the nRF7002EK to populate as a network interface (wlan0) for this development kit.
Below is the networking-related part of my prj.conf:
# WIFI
CONFIG_WIFI_SCAN_PROFILE_PASSIVE=y
CONFIG_NET_DEFAULT_IF_FIRST=y
CONFIG_WIFI_NRF70=y
CONFIG_WIFI=y
CONFIG_NET_L2_WIFI_MGMT=y
CONFIG_NET_MGMT_EVENT=y
CONFIG_HEAP_MEM_POOL_SIZE=25000
CONFIG_HEAP_MEM_POOL_IGNORE_MIN=y

CONFIG_NETWORKING=y
CONFIG_NET_BUF_RX_COUNT=1
CONFIG_NET_BUF_TX_COUNT=1
CONFIG_NET_NATIVE=n
CONFIG_NET_OFFLOAD=y

CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS=n
CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS_ONLY=n
CONFIG_WIFI_SCAN_DWELL_TIME_ACTIVE=50
CONFIG_WIFI_SCAN_DWELL_TIME_PASSIVE=130
And below is the fragment of my Devicetree overlay where I initialize my spi00 peripheral with the pins I have attached it to on my nRF54L15DK:
/ {
	chosen {
		ncs,dtm-uart = &uart20;
        zephyr,wifi = &wlan0;
	};
};


&spi00 {
	status = "okay";
    cs-gpios = <&gpio2 3 GPIO_ACTIVE_LOW>;
    compatible = "nordic,nrf-spim";
	pinctrl-0 = <&spi00_default>;
	pinctrl-1 = <&spi00_sleep>;
	pinctrl-names = "default", "sleep";
	nrf70: nrf7002-spi@0 {
        compatible = "nordic,nrf7002-spi";
		status = "okay";
		reg = <0>;
		spi-max-frequency = <DT_FREQ_M(8)>;

		// Pin assignments for nrf7002 chip
        iovdd-ctrl-gpios = <&gpio2 5 GPIO_PULL_DOWN>;
        bucken-gpios = <&gpio2 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>;
        host-irq-gpios = <&gpio2 8 GPIO_ACTIVE_HIGH>;
        // Short-range (SR) co-existence (disabled)
        //srrf-switch-gpios = <&gpio2 6 GPIO_ACTIVE_HIGH>;

        /* Maximum TX power limits for 2.4 GHz */
        wifi-max-tx-pwr-2g-dsss = <21>;
        wifi-max-tx-pwr-2g-mcs0 = <16>;
        wifi-max-tx-pwr-2g-mcs7 = <16>;

        /* List of interfaces */
        wlan0: wlan0 {
            compatible = "nordic,wlan";
        };

		wifi-max-tx-pwr-5g-low-mcs0 = <13>;
        wifi-max-tx-pwr-5g-low-mcs7 = <13>;
        wifi-max-tx-pwr-5g-mid-mcs0 = <13>;
        wifi-max-tx-pwr-5g-mid-mcs7 = <13>;
        wifi-max-tx-pwr-5g-high-mcs0 = <12>;
        wifi-max-tx-pwr-5g-high-mcs7 = <12>;
	};
};

&pinctrl {
	spi00_default: spi00_default {
		group1 {
			psels = <NRF_PSEL(SPIM_SCK, 2, 1)>,
                    <NRF_PSEL(SPIM_MOSI, 2, 2)>,
                    <NRF_PSEL(SPIM_MISO, 2, 4)>;
		};
	};

	spi00_sleep: spi00_sleep {
		group1 {
			psels = <NRF_PSEL(SPIM_SCK, 2, 1)>,
                    <NRF_PSEL(SPIM_MOSI, 2, 2)>,
                    <NRF_PSEL(SPIM_MISO, 2, 4)>;
			low-power-enable;
		};
	};
};
Please let me know if I've made an error in setting up this network companion chip, or if the nRF7002EK shield isn't compatible with the DK I'm using for some reason.
I can try to provide additional details if necessary. Thank you.
  • Hi, 

    Which build command did you use?

    Can you show your full device tree overlay?

    Best regards,
    Dejan

  • My build command is:

    west build . --build-dir build/full --board project-full/nrf54l15/cpuapp/ns
    -DNCS_TOOLCHAIN_VERSION=NONE -DBOARD_ROOT=$(ROOT_DIR)

    My full overlay is:
    #include <freq.h>
    
    / {
    	chosen {
    		ncs,dtm-uart = &uart20;
            zephyr,wifi = &wlan0;
    	};
    };
    
    &pinctrl {
        i2c21_default: i2c21_default {
            group1 {
                psels = <NRF_PSEL(TWIM_SDA, 1, 11)>,
                        <NRF_PSEL(TWIM_SCL, 1, 12)>;
                };
        };
    
        i2c21_sleep: i2c21_sleep {
            group1 {
                psels = <NRF_PSEL(TWIM_SDA, 1, 11)>,
                        <NRF_PSEL(TWIM_SCL, 1, 12)>;
                low-power-enable;
            };
        };
    };
    
    &i2c21 {
        status = "okay";
    
        pinctrl-0 = <&i2c21_default>;
        pinctrl-1 = <&i2c21_sleep>;
        pinctrl-names = "default", "sleep";
    
        imu: icm42370@68 {
                 compatible = "invensense,icm42370";
                 status = "ok";
                 reg = <0x68>;
                 accel-hz = <800>;
                 accel-fs = <16>;
        };
    };
    
    &timer10 {
        status = "disabled";
    };
    
    &uart20 {
    	status = "okay";
    	current-speed = <115200>;
    };
    
    &radio {
    	status = "okay";
    	/* This is a number of antennas that are available on antenna matrix
    	 * designed by Nordic. For more information see README.rst.
    	 */
    	dfe-antenna-num = <12>;
    	/* This is a setting that enables antenna 12 (in antenna matrix designed
    	 * by Nordic) for PDU. For more information see README.rst.
    	 */
    	dfe-pdu-antenna = <0x0>;
    
    	/* These are GPIO pin numbers that are provided to
    	 * Radio peripheral. The pins will be acquired by Radio to
    	 * drive antenna switching.
    	 * Pin numbers are selected to drive switches on antenna matrix
    	 * desinged by Nordic. For more information see README.rst.
    	 */
    	dfegpio0-gpios = <&gpio0 4 0>;
    	dfegpio1-gpios = <&gpio0 5 0>;
    	dfegpio2-gpios = <&gpio0 6 0>;
    	dfegpio3-gpios = <&gpio0 7 0>;
    };
    
    &spi00 {
    	status = "okay";
        cs-gpios = <&gpio2 3 GPIO_ACTIVE_LOW>;
        compatible = "nordic,nrf-spim";
    	pinctrl-0 = <&spi00_default>;
    	pinctrl-1 = <&spi00_sleep>;
    	pinctrl-names = "default", "sleep";
    	nrf70: nrf7002-spi@0 {
            compatible = "nordic,nrf7002-spi";
    		status = "okay";
    		reg = <0>;
    		spi-max-frequency = <DT_FREQ_M(8)>;
    
    		// Pin assignments for nrf7002 chip
            iovdd-ctrl-gpios = <&gpio2 5 GPIO_PULL_DOWN>;
            bucken-gpios = <&gpio2 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>;
            host-irq-gpios = <&gpio2 8 GPIO_ACTIVE_HIGH>;
            // Short-range (SR) co-existence (disabled)
            //srrf-switch-gpios = <&gpio2 6 GPIO_ACTIVE_HIGH>;
    
            /* Maximum TX power limits for 2.4 GHz */
            wifi-max-tx-pwr-2g-dsss = <21>;
            wifi-max-tx-pwr-2g-mcs0 = <16>;
            wifi-max-tx-pwr-2g-mcs7 = <16>;
    
            /* List of interfaces */
            wlan0: wlan0 {
                compatible = "nordic,wlan";
            };
    
    		wifi-max-tx-pwr-5g-low-mcs0 = <13>;
            wifi-max-tx-pwr-5g-low-mcs7 = <13>;
            wifi-max-tx-pwr-5g-mid-mcs0 = <13>;
            wifi-max-tx-pwr-5g-mid-mcs7 = <13>;
            wifi-max-tx-pwr-5g-high-mcs0 = <12>;
            wifi-max-tx-pwr-5g-high-mcs7 = <12>;
    	};
    };
    
    &pinctrl {
    	spi00_default: spi00_default {
    		group1 {
    			psels = <NRF_PSEL(SPIM_SCK, 2, 1)>,
                        <NRF_PSEL(SPIM_MOSI, 2, 2)>,
                        <NRF_PSEL(SPIM_MISO, 2, 4)>;
    		};
    	};
    
    	spi00_sleep: spi00_sleep {
    		group1 {
    			psels = <NRF_PSEL(SPIM_SCK, 2, 1)>,
                        <NRF_PSEL(SPIM_MOSI, 2, 2)>,
                        <NRF_PSEL(SPIM_MISO, 2, 4)>;
    			low-power-enable;
    		};
    	};
    };
    It seems that despite setting CONFIG_WIFI_NRF70=y in the prj.conf, the build process doesn't accept this config, and in the final build it's not set. 
    Let me know if you need any other info! Thank you.
  • Hi,

    Can you send your complete project (zipped) including build folder? 

    Best regards,
    Dejan

  • Hi,

    Unfortunately I can't post it publicly here, there is too much identifying information tied up in the filenames and code.

    Please let me know if there's some other way I could provide specific information, or if there's a way to send that .zip privately.

    Here's my CMakeLists.txt, if it helps:

    cmake_minimum_required(VERSION 3.20.0)
    find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
    project(myproject)
    
    target_include_directories(app PRIVATE ./src)
    target_include_directories(app PRIVATE ./src/dtm)
    
    target_sources_ifndef(CONFIG_DTM_TRANSPORT_HCI app PRIVATE
      src/dtm/transport/dtm_uart_twowire.c
      src/dtm/transport/dtm_uart_wait.c
    )
    
    zephyr_include_directories(drivers)
    target_include_directories(app PUBLIC ${ZEPHYR_BASE}/subsys/net/ip)
    
    target_sources(app PRIVATE
                       src/main.c
                       src/cli_wifi.c
                       )

    Best,

    Clyde

  • # Nordic Wi-Fi driver for nRF70 series SoCs
    #
    # Copyright (c) 2024 Nordic Semiconductor
    #
    # SPDX-License-Identifier: Apache-2.0
    #
    
    menuconfig WIFI_NRF70
            bool "nRF70 driver"
            select NET_L2_WIFI_MGMT if NETWORKING
            select NET_L2_ETHERNET_MGMT if NETWORKING && NET_L2_ETHERNET
            select WIFI_USE_NATIVE_NETWORKING if NETWORKING
            select EXPERIMENTAL if !SOC_SERIES_NRF53X && !SOC_SERIES_NRF91X
            default y
            depends on \
                    DT_HAS_NORDIC_NRF7002_SPI_ENABLED || DT_HAS_NORDIC_NRF7002_QSPI_ENABLED || \
                    DT_HAS_NORDIC_NRF7001_SPI_ENABLED || DT_HAS_NORDIC_NRF7001_QSPI_ENABLED || \
                    DT_HAS_NORDIC_NRF7000_SPI_ENABLED || DT_HAS_NORDIC_NRF7000_QSPI_ENABLED
            help
              Nordic Wi-Fi Driver

    An additional note - I believe my issue is related directly to the DT_HAS_NORDIC_NRF7002_SPI_ENABLED flag, which is not getting enabled during build, despite my Devicetree .overlay specifying a nrf7002-spi peripheral.

    Perhaps it is an issue with my .overlay file (posted above), but I tried my best to use the working Scan sample as reference, and am able to build successfully, although CONFIG_WIFI_NRF70 ends up not getting enabled.


    I appreciate you taking the time to help me solve this!

Related