nRF54L15DK with nRF7002EK on SPI

Hi,

I am trying to get an nRF54L15DK working with an nRF7002EK using SPI (not QSPI) and I cannot get this working using the wifi-scan sample.

I am using nRF Connect SDK v3.1.0 and toolchain v3.1.0.

It seems that the build system is linking in files that expect to be using QSPI only and the log indicates that it is running functions that use QSPI.

Here is the debug output I get when it starts up:

*** Booting nRF Connect SDK v3.1.0-6c6e5b32496e ***
*** Using Zephyr OS v4.1.99-1612683d4010 ***
[00:00:00.004,598] <inf> wifi_nrf_bus: SPIM spi@c7000: freq = 1 MHz
[00:00:00.004,618] <inf> wifi_nrf_bus: SPIM spi@c7000: latency = 0
[00:00:00.016,551] <err> wifi_nrf_bus: RPU wakeup write ACK failed even after 10ms
[00:00:00.016,559] <err> wifi_nrf_bus: Error: RDSR2 failed
[00:00:00.016,578] <err> wifi_nrf: zep_shim_bus_qspi_dev_add: RPU enable failed with error -1
[00:00:00.016,622] <err> wifi_nrf: nrf_wifi_bus_qspi_dev_add: nrf_wifi_osal_bus_qspi_dev_add failed
[00:00:00.016,664] <err> wifi_nrf: nrf_wifi_bal_dev_add: Bus dev_add failed
[00:00:00.016,707] <err> wifi_nrf: nrf_wifi_sys_hal_dev_add: nrf_wifi_bal_dev_add failed
[00:00:00.016,780] <err> wifi_nrf: nrf_wifi_sys_fmac_dev_add: nrf_wifi_sys_hal_dev_add failed
[00:00:00.016,801] <err> wifi_nrf: nrf_wifi_fmac_dev_add_zep: nrf_wifi_fmac_dev_add failed
[00:00:00.016,824] <err> wifi_nrf: nrf_wifi_if_start_zep: nrf_wifi_fmac_dev_add_zep failed
Starting nrf54l15dk with CPU frequency: 128 MHz
[00:00:01.029,506] <err> wifi_nrf: nrf_wifi_if_stop_zep: rpu_ctx_zep is NULL
[00:00:01.031,958] <inf> wifi_nrf_bus: SPIM spi@c7000: freq = 1 MHz
[00:00:01.031,973] <inf> wifi_nrf_bus: SPIM spi@c7000: latency = 0
[00:00:01.043,911] <err> wifi_nrf_bus: RPU wakeup write ACK failed even after 10ms
[00:00:01.043,919] <err> wifi_nrf_bus: Error: RDSR2 failed
[00:00:01.043,937] <err> wifi_nrf: zep_shim_bus_qspi_dev_add: RPU enable failed with error -1
[00:00:01.043,980] <err> wifi_nrf: nrf_wifi_bus_qspi_dev_add: nrf_wifi_osal_bus_qspi_dev_add failed
[00:00:01.044,023] <err> wifi_nrf: nrf_wifi_bal_dev_add: Bus dev_add failed
[00:00:01.044,066] <err> wifi_nrf: nrf_wifi_sys_hal_dev_add: nrf_wifi_bal_dev_add failed
[00:00:01.044,141] <err> wifi_nrf: nrf_wifi_sys_fmac_dev_add: nrf_wifi_sys_hal_dev_add failed
[00:00:01.044,171] <err> wifi_nrf: nrf_wifi_fmac_dev_add_zep: nrf_wifi_fmac_dev_add failed
[00:00:01.044,185] <err> wifi_nrf: nrf_wifi_if_start_zep: nrf_wifi_fmac_dev_add_zep failed
[00:00:01.044,222] <inf> scan: OTP not programmed, proceeding with local MAC: F6:CE:36:00:00:01
[00:00:01.044,241] <err> wifi_nrf: nrf_wifi_disp_scan_zep: Interface not UP
[00:00:01.044,248] <err> scan: Scan request failed

I am not using "-DSHIELD=nrf7002ek" as recommended in https://docs.nordicsemi.com/bundle/ncs-2.6.2/page/nrf/device_guides/working_with_nrf/nrf70/nrf7002ek_gs.html because that expects to have "arduino_spi" defines and the nRF54L15DK board files do not define that. Instead I have copied and modified the setup from zephyr\boards\shields\nrf7002ek\nrf7002ek.overlay

Here is my overlay (which redefines the buttons and LEDs to free up button0 and led3 pins that I need for SPI20):

/*
 * Copyright (c) 2024 Nordic Semiconductor ASA
 *
 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
 */

#include <freq.h>

/ {
	chosen {
		zephyr,wifi = &wlan0;
	};

	aliases {
		/delete-property/ led3;
		/delete-property/ sw0;
	};

	buttons {
		/delete-property/ button0;
	};

	leds {
		/delete-property/ led3;
	};
};

&pinctrl {
	spi21_default: spi21_default {
		group1 {
			psels = <NRF_PSEL(SPIM_SCK, 1, 11)>,
				<NRF_PSEL(SPIM_MISO, 1, 12)>,
				<NRF_PSEL(SPIM_MOSI, 1, 13)>;
		};
	};

	spi21_sleep: spi21_sleep {
		group1 {
			psels = <NRF_PSEL(SPIM_SCK, 1, 11)>,
				<NRF_PSEL(SPIM_MISO, 1, 12)>,
				<NRF_PSEL(SPIM_MOSI, 1, 13)>;
			low-power-enable;
		};
	};
};

&spi21 {
	compatible = "nordic,nrf-spim";
	status = "okay";
	cs-gpios = < &gpio1 14 GPIO_ACTIVE_LOW >;
	pinctrl-0 = < &spi21_default >;
	pinctrl-1 = < &spi21_sleep >;
	pinctrl-names = "default", "sleep";
	nrf70: nrf7002@0 {
		compatible = "nordic,nrf7002-spi";
		status = "okay";
		reg = <0>;
		label = "nrf7002_wlan";
		spi-max-frequency = <DT_FREQ_M(1)>;

		iovdd-ctrl-gpios = <&gpio2 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>;
		bucken-gpios = <&gpio2 10 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>;
		host-irq-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>;
		/* Maximum TX power limits for 5 GHz */
		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>;

        wlan0: wlan0 {
            compatible = "nordic,wlan";
        };
	};
};

And here is my prj.conf

#
# Copyright (c) 2022 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#
CONFIG_SPI=y
CONFIG_WIFI=y
CONFIG_WIFI_NRF70=y
CONFIG_NET_L2_WIFI_MGMT=y
CONFIG_NRFX_SPIM21=y

# System settings
CONFIG_ASSERT=y

# Networking
CONFIG_NETWORKING=y
CONFIG_NET_BUF_RX_COUNT=1
CONFIG_NET_BUF_TX_COUNT=1
CONFIG_NET_L2_ETHERNET=y
CONFIG_NET_NATIVE=n
CONFIG_NET_OFFLOAD=y

CONFIG_INIT_STACKS=y

# Memories
CONFIG_MAIN_STACK_SIZE=5200

# Debugging
CONFIG_STACK_SENTINEL=y
CONFIG_DEBUG_COREDUMP=y
CONFIG_DEBUG_COREDUMP_BACKEND_LOGGING=y
CONFIG_DEBUG_COREDUMP_MEMORY_DUMP_MIN=y

# Logging
CONFIG_LOG=y
CONFIG_PRINTK=y
# If below config is enabled, printk logs are
# buffered. For unbuffered messages, disable this.
CONFIG_LOG_PRINTK=n

# 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

# Raw scan Options
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

My debug log shows that nrf_wifi_bus_qspi_dev_add() fails, but this is in modules\lib\nrf_wifi\bus_if\bus\qspi\src\qspi.c and I would expect it to be using modules\lib\nrf_wifi\bus_if\bus\spi\src\spi.c. But modules\lib\nrf_wifi\CMakeLists.txt seems to only use qspi.c.

Am I missing some config, or does nRF Connect SDK not support this configuration?

regards,

Charles

Parents
  • Hi,

    It seems that the build system is linking in files that expect to be using QSPI only and the log indicates that it is running functions that use QSPI.

    It will run on SPI, as indicated by the first lines:

    [00:00:00.004,598] <inf> wifi_nrf_bus: SPIM spi@c7000: freq = 1 MHz
    [00:00:00.004,618] <inf> wifi_nrf_bus: SPIM spi@c7000: latency = 0

    The remainder is due to common file for both transports.

     

    This pin needs to be changed:

    host-irq-gpios = <&gpio2 6 GPIO_ACTIVE_HIGH>;

    as P2 does not have a GPIOTE instance.

    Could you try this and report back?

     

    Kind regards,

    Håkon

  • Thanks Håkon, that was part of the problem and it is working now.

    I also had MISO and MOSI mixed up, even after checking my wiring several times!

    For anyone interested, here is the working overlay:

    /*
     * Copyright (c) 2024 Nordic Semiconductor ASA
     *
     * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
     */
    
    #include <freq.h>
    
    / {
    	chosen {
    		zephyr,wifi = &wlan0;
    	};
    
    	aliases {
    		/delete-property/ led1;
    		/delete-property/ led3;
    		/delete-property/ sw0;
    		/delete-property/ sw1;
    	};
    
    	buttons {
    		/delete-property/ button0;
    		/delete-property/ button1;
    	};
    
    	leds {
    		/delete-property/ led3;
    	};
    };
    
    &pinctrl {
    	spi21_default: spi21_default {
    		group1 {
    			psels = <NRF_PSEL(SPIM_SCK, 1, 11)>,
    				<NRF_PSEL(SPIM_MISO, 1, 13)>,
    				<NRF_PSEL(SPIM_MOSI, 1, 12)>;
    		};
    	};
    
    	spi21_sleep: spi21_sleep {
    		group1 {
    			psels = <NRF_PSEL(SPIM_SCK, 1, 11)>,
    				<NRF_PSEL(SPIM_MISO, 1, 13)>,
    				<NRF_PSEL(SPIM_MOSI, 1, 12)>;
    			low-power-enable;
    		};
    	};
    };
    
    &spi21 {
    	compatible = "nordic,nrf-spim";
    	status = "okay";
    	cs-gpios = < &gpio1 14 GPIO_ACTIVE_LOW >;
    	pinctrl-0 = < &spi21_default >;
    	pinctrl-1 = < &spi21_sleep >;
    	pinctrl-names = "default", "sleep";
    	nrf70: nrf7002@0 {
    		compatible = "nordic,nrf7002-spi";
    		status = "okay";
    		reg = <0>;
    		label = "nrf7002_wlan";
    		spi-max-frequency = <DT_FREQ_M(1)>;
    
    		iovdd-ctrl-gpios = <&gpio2 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>;
    		bucken-gpios = <&gpio2 10 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>;
    		host-irq-gpios = <&gpio1 9 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>;
    		/* Maximum TX power limits for 5 GHz */
    		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>;
    
            wlan0: wlan0 {
                compatible = "nordic,wlan";
            };
    	};
    };
    
    

  • Hi,

     

    I am glad to hear that you found the root cause of your problems, and thank you for posting an answer with the details on how you fixed the problem!

     

    Hope you have a wonderful day!

     

    Kind regards,

    Håkon

Reply Children
Related