Configure and Connect nRF7002 to nRF52840 on SDK 2.2.2

I am using nRF52840 as host processor. Now I need to connect to nRF7002 for WiFi usage. I am using ncs 2.2.2 SDK. I have a few questions?
1. Does nRF7002 work on v2.2.2? I created the nRF7002 device on the device tree with "nordic,nrf7002-spi" compatible . However, I cannot link to it. The CONFIG_NRF700X_SPI=y is not supported.

error: undefined reference to `__device_dts_ord_133'

2. Can you provide an example of configure and link nRF7002 to nRF52840 on v2.2.2 SDK?

3. If I have to move to higher version of SDK, what is the steps to do the upgrade?

My device tree:

&spi1 {
compatible = "nordic,nrf-spim";
status = "okay";
cs-gpios = <&gpio0 20 GPIO_ACTIVE_LOW>;
pinctrl-0 = <&spi1_default>;
pinctrl-1 = <&spi1_sleep>;
pinctrl-names = "default", "sleep";

nrf7002: nrf7002@0 {
compatible = "nordic,nrf7002-spi";
status = "okay";
reg = <0>; /* SPI chip select index */
spi-max-frequency = <8000000>; /* 8 MHz */
/*duplex = "full";*/ /* required for SPI_CONFIG_DT */
/*frame-format = "motorola";*/ /* required for SPI_CONFIG_DT */
label = "nrf7002";

/* GPIOs for control signals */
iovdd-ctrl-gpios = <&gpio0 10 GPIO_ACTIVE_HIGH>;
bucken-gpios = <&gpio0 11 GPIO_ACTIVE_HIGH>;
host-irq-gpios = <&gpio1 1 GPIO_ACTIVE_HIGH>;

/* Optional: COEX interface */
coex {
compatible = "nordic,nrf700x-coex";
grant-gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>;
req-gpios = <&gpio1 3 GPIO_ACTIVE_HIGH>;
/*prio-gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>;*/


status0-gpios = <&gpio1 5 GPIO_ACTIVE_HIGH>;
/*status1-gpios = <&gpio1 4 GPIO_ACTIVE_HIGH>;*/
};
};
};

My code:
const struct device *nrf7002_dev = DEVICE_DT_GET(DT_NODELABEL(nrf7002));

if (!device_is_ready(nrf7002_dev))
{
LOG_ERR("SPI device not ready\n");
return -1;
}
else
{
LOG_INF("SPI device READY\n");
}

Thank you.

Parents
  • Hi,

     

    I am using nRF52840 as host processor. Now I need to connect to nRF7002 for WiFi usage. I am using ncs 2.2.2 SDK. I have a few questions?
    1. Does nRF7002 work on v2.2.2? I created the nRF7002 device on the device tree with "nordic,nrf7002-spi" compatible . However, I cannot link to it. The CONFIG_NRF700X_SPI=y is not supported.

    I assume you mean ncs v3.2.2?

    nRF7002 shall be supported in this version.

    In your device tree, try to add these sections (taken from the nrf7002eb device tree files):

    /*
     * Copyright (c) 2024 Nordic Semiconductor ASA
     *
     * SPDX-License-Identifier: Apache-2.0
     */
    
    #include <freq.h>
    
    / {
    	chosen {
    		zephyr,wifi = &wlan0;
    	};
    };
    
    &spi1 {
    	status = "okay";
    
    	nrf70: nrf7002@0 {
    		compatible = "nordic,nrf7002-spi";
    		status = "okay";
    
    		wlan0: wlan0 {
    			compatible = "nordic,wlan";
    		};
    
    		wlan1: wlan1 {
    			compatible = "nordic,wlan";
    		};
    
    		wifi-max-tx-pwr-2g-dsss = <21>;
    		wifi-max-tx-pwr-2g-mcs0 = <16>;
    		wifi-max-tx-pwr-2g-mcs7 = <16>;
    		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>;
    		...rest of your configuration..
    	};
    };

     

    I suspect that the issue is the chosen "zephyr,wifi = &wlan0" is missing from your overlay.

    Could you check if this works as intended?

     

    Kind regards,

    Håkon

  • Sorry, I am using nRF Connect S?DK v2.2.0. I am still seeing the same issue. Where can I find the complete example of nRF7002 used in nRF52840?

    Thanks!

  • A1: Attached here (zephyr.dts, same from mcuboot and app):

    1488.zephyr.dts

    A2. I am set up my own board. 1537.boards.zip82823.prj.conf

    A3. I measured Vbat = 4.2V. IOVDD=1.8V. DIGVDD=1.1V. BUCKEN=1.8V, BUCKOUT=1.48V.

    As said before, we do not use a direct GPIO pin from nRF52840 for bucken-gpios. We use a GPIO from IOexpander. I assigned a unused gpio in dts, similar as iovdd-ctrl-gpios. 


    A few things I noticed:

    1. I do not see any SPI activity on nRF7002 when I boot up the system;

    2. I confirmed when manually read/write that SPI bus, the activity showed up on the bus. This is true before and after net_if_init(0 is called.  I send 

    { 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }

    I got

    {0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42,  0x42}

    I have a few questions:

    Q1. Do you have a more detailed document than the nRF7002 specification? All I wanted is just connecting the nRF7002 chip, scanning the near router(s) and reading their SSID. I wonder I can achieve that by simply doing manual SPI reading and writing without involving all your WiFI package. That is also for the sake of nRF52840 memory limitation. 

    Q2. Can you share me your email address? If so, I can send you the whole code I am testing without broadcasting them to the website.

    Thank you!

  • One more question, if I want to read chip id information using manual SPI transfer, what is command to do that. For example, 

    INFO.PART: 0x0B, 0x00, 0x00, 0xC0  0x00?

    INFO.VARIANT: 0x0B, 0x00, 0x00, 0xC4, 0x00?

    INFO.UUID: 0x0B, 0x00, 0x00, 0xD0, 0x00?

    INFO.PACKAGE: 0x0B, 0x00, 0x00, 0xDE8, 0x00?

  • Hi,

     

    There is nothing inconsistent with the board files, but I do want to know more about how you setup the GPIOs on the expander.

      

    The nRF7002 has a strict power sequencing requirement, as described in the PS:

    https://docs.nordicsemi.com/r/bundle/ps_nrf7002/page/chapters/hw_layout/doc/hw_layout.html

    The various supplies and BUCKEN need to be sequenced in order with delay requirements.
    
    The power up sequence and requirements are:
    
    Supply VBAT/BUCKVBAT/BUCKVBATS/AFEVBAT
    Wait ≥ 6 ms
    Assert BUCKEN
    Wait ≥ 1 ms
    Supply IOVDD

     

    This is why I am asking about gpio sequencing / logic analyser traces from you, to ensure that these requirements are met.

     

    When you are setting IOVDD/BUCKEN via an gpio expander, it is very important that you setup those prior to the initialisation of nRF7002. This means that you will either have to setup a board specific driver to boot up those pins, or that you delay the initialisation of nRF7002 by setting CONFIG_NRF_WIFI_IF_AUTO_START=n, and manually initialising as done in the wifi/shutdown sample:

    https://github.com/nrfconnect/sdk-nrf/blob/v2.9.3/samples/wifi/shutdown/src/main.c#L201-L203

     

    Kind regards,

    Håkon

  • Thanks Hakon,

    I found the issue. I missed the "SB_CONFIG_WIFI_NRF70=y" in sysbuild.conf.

    Now I can scan the nearby WiFi routers. My next task is reduce the memory usage for scan only application.

    Yimin

  • Hi Yimin,

     

    Great to hear that you got it working!

     

    Kind regards,

    Håkon

Reply Children
No Data
Related