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!

  • Hi Yimin,

     

    Yimin Tang said:
    I ported over the "sta" sample. However, I could not get valid wifi interface.   

    you shouldn't have to change the code at all; the only thing you need is to define the pin-out/connection towards the nRF7002.

    The sample intended to work for nRF52840DK + nRF7002EK.

     

    I assume you got a RPU error message on the console?

     

    I do not see any specific issue with your overlay:

    Yimin Tang said:

    &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";

    nrf70: nrf7002@0 {
    compatible = "nordic,nrf7002-spi";
    status = "okay";

    reg = <0>;
    spi-max-frequency = <DT_FREQ_M(8)>;

    bucken-gpios = <&gpio1 13 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>;  => not used. high always
    iovdd-ctrl-gpios = <&gpio1 14 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>;  => same as above
    host-irq-gpios = <&gpio1 1 GPIO_ACTIVE_HIGH>;
    //srrf-switch-gpios = <&gpio1 13 GPIO_ACTIVE_HIGH>;

     

    Are you testing on a DK or your own hardware? If using DK, P0.20 is connected to the external flash.

    What is the pins used for spi1_default?

    Yimin Tang said:
    bucken-gpios = <&gpio1 13 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>;  => not used. high always
    iovdd-ctrl-gpios = <&gpio1 14 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>;  => same as above

    The comments here, what do you mean by "not used, high always"?

     

    Kind regards,

    Håkon

  • Hi Hakon,

    I am testing on my our hardware. I do not have a DK board. Here is the SPI pin configuration:

    /* For new design: Need to add a WIFI SPI
    SCK 0, 6
    MISO 0, 7
    MOSI 0, 4 */
    spi1_default: spi1_default {
    group1 {
    psels = <NRF_PSEL(SPIM_SCK, 0, 6)>,
    <NRF_PSEL(SPIM_MISO, 0, 7)>,
    <NRF_PSEL(SPIM_MOSI, 0, 4)>;
    };
    };

    spi1_sleep: spi1_sleep {
    group1 {
    psels = <NRF_PSEL(SPIM_SCK, 0, 6)>,
    <NRF_PSEL(SPIM_MISO, 0, 7)>,
    <NRF_PSEL(SPIM_MOSI, 0, 4)>;
    low-power-enable;
    };
    };
    };

    The error I got is:

    struct net_if *iface = net_if_get_first_wifi();

    if (!iface)
    {
    LOG_ERR("Failed to get Wi-Fi interface");  ==> Got this....
    return -1;
    }

    We used a GPIO from an IOExpander for bucken-gpios.

    Is iovdd-ctrl-gpios the pin48 of NRF7002-QFAA-R? If so, we pulled it high. 

    Thanks, 

    Yimin

  • I also found that there are some debug/warning messages before the application starts. I believe they are from net intialization during  POST_KERNEL stage.

    Net MGMT initialized: queue of 5 entries, stack size of 4096
    [00:00:01.124,084] <dbg> net_if: net_if_init: (main):
    [00:00:01.124,603] <err> net_if: There is no network interface to work with!
    [00:00:01.125,091] <dbg> net_if: net_if_post_init: (main):
    *** Booting nRF Connect SDK v2.9.3-6961c01f95c2 ***
    *** Using Zephyr OS v3.7.99-aa34a5632971 ***
    [00:00:01.126,037] <wrn> net_config: No auto-started network interface - network-bound app initialization skipped.

    For some reasons, I see  STRUCT_SECTION_FOREACH(net_if, iface) never get run into because:

     the _net_if_list_start = 20001B70, _net_if_list_end 20001B70. They are the same.

  • Hi,

     

    Q1: Could you share the compiled zephyr.dts file, located in build/app-name/zephyr/zephyr.dts?

    Q2: have you setup your own board-files, or are you using "nrf52840dk/nrf52840" with an overlay? Please share as much info as possible here (not only snippets), so I can help determine where the problem might be.

    Q3: Have you scoped the pins to the nRF7002 to see if they are set/toggles as expected?

     

    Kind regards,

    Håkon

  • 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!

Reply
  • 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!

Children
No Data
Related