Wi Fi ncs example gremlins ...

I am working through the ncs wi-fi samples on an nRF7002 DK board ...

I can get the shell example to work ... so I know that authentication with my access point (AP) and

DHCP  is working correctly.

When I build and try to run the sta (station) example it hangs at the scanning stage ...

Output from shell example (SSSID and password crossed out) ...

Wifi scan … output

uart:~$

[00:00:00.357,086] <inf> wifi_nrf: Firmware (v1.2.8.1) booted successfully

[00:00:00.516,204] <inf> fs_nvs: 6 Sectors of 4096 bytes

[00:00:00.516,235] <inf> fs_nvs: alloc wra: 0, fe8

[00:00:00.516,235] <inf> fs_nvs: data wra: 0, 0

*** Booting Zephyr OS build v3.3.99-ncs1-1 ***

Starting nrf7002dk_nrf7001_nrf5340_cpuapp with CPU frequency: 128 MHz

[00:00:00.516,662] <inf> wpa_supp: Successfully initialized wpa_supplicant

uart:~$

uart:~$ wifi connect xxxxxxxx yyyyyyyy

Connection requested

[00:05:39.711,303] <inf> wpa_supp: wlan0: CTRL-EVENT-DSCP-POLICY clear_all

[00:05:41.388,397] <inf> wpa_supp: wlan0: SME: Trying to authenticate with e8:ad:a6:e0:81:22 (SSID='xxxxxxxxx' freq=2462 MHz)

[00:05:41.391,326] <inf> wifi_nrf: wifi_nrf_wpa_supp_authenticate:Authentication request sent successfully

[00:05:41.652,191] <inf> wpa_supp: wlan0: Trying to associate with e8:ad:a6:e0:81:22 (SSID='BTBHub6-35MR' freq=2462 MHz)

[00:05:41.657,806] <inf> wifi_nrf: wifi_nrf_wpa_supp_associate: Association request sent successfully

[00:05:41.673,492] <inf> wpa_supp: wlan0: Associated with e8:ad:a6:e0:81:22

[00:05:41.673,553] <inf> wpa_supp: wlan0: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0

Connected

[00:05:42.694,183] <inf> wpa_supp: wlan0: WPA: Key negotiation completed with e8:ad:a6:e0:81:22 [PTK=CCMP GTK=CCMP]

[00:05:42.694,305] <inf> wpa_supp: wlan0: CTRL-EVENT-CONNECTED - Connection to e8:ad:a6:e0:81:22 completed [id=0 id_str=]

[00:05:49.830,993] <inf> net_dhcpv4: Received: 192.168.1.87

uart:~$ wifi status

Status: successful

==================

State: COMPLETED

Interface Mode: STATION

Link Mode: WIFI 4 (802.11n/HT)

SSID: xxxxxxxxxx

BSSID: yyyyyyyyyy

Band: 2.4GHz

Channel: 11

Security: WPA2-PSK

MFP: Optional

RSSI: -73

Beacon Interval: 100

DTIM: 3

TWT: Not supported

uart:~$ net ipv4

IPv4 support : enabled

IPv4 fragmentation support : disabled

Max number of IPv4 network interfaces in the system : 1

Max number of unicast IPv4 addresses per network interface : 1

Max number of multicast IPv4 addresses per network interface : 1

IPv4 addresses for interface 1 (0x200016a8) (Ethernet)

====================================================

Type State Lifetime (sec) Address

DHCP preferred 192.168.1.87/255.255.255.0

uart:~$

uart:~$ net dns google.com

Query for 'google.com' sent.

dns: 142.250.187.238

dns: All results received

uart:~$ net ping 142.250.187.238

PING 142.250.187.238

28 bytes from 142.250.187.238 to 192.168.1.87: icmp_seq=1 ttl=117 time=24 ms

28 bytes from 142.250.187.238 to 192.168.1.87: icmp_seq=2 ttl=117 time=16 ms

28 bytes from 142.250.187.238 to 192.168.1.87: icmp_seq=3 ttl=117 time=20 ms

uart:~$

To ping PC on WiFi network turn private firewall off (for testing purposes) … and then try to ping …

uart:~$ net ping 192.168.1.86

PING 192.168.1.86

28 bytes from 192.168.1.86 to 192.168.1.87: icmp_seq=1 ttl=128 time=14 ms

28 bytes from 192.168.1.86 to 192.168.1.87: icmp_seq=2 ttl=128 time=13 ms

28 bytes from 192.168.1.86 to 192.168.1.87: icmp_seq=3 ttl=128 time=14 ms

uart:~$

but, if private firewall is on …

uart:~$ net ping 192.168.1.86

PING 192.168.1.86

Ping timeout

uart:~$

Output from sta example

WiFi sta output :

OK

*** BooOK

OK

OK

OK

OK

OK

OK

OK

OK

ting nRF Connect SDK v2.5.0 ***

[00:00:00.560,333] K

m<inf> net_config: Initializing network

[00:00:00.560,333] <inf> net_config: Waiting interface 1 (0x20001478) to be up...

[00:00:00.560,455] <inf> net_config: IPv4 address: 192.168.1.99

[00:00:00.560,516] <inf> net_config: Running dhcpv4 client...

[00:00:00.560,791] <inf> sta: Starting nrf7002dk_nrf5340_cpuapp with CPU frequency: 64 MHz

[00:00:01.560,882] <inf> sta: QSPI Encryption disabled

[00:00:01.560,943] <inf> sta: Static IP address (overridable): 192.168.1.99/255.255.255.0 -> 192.168.1.1

[00:00:03.115,997] <inf> sta: Connection requested

[00:00:03.116,027] <inf> sta: ==================

[00:00:03.116,058] <inf> sta: State: SCANNING

[00:00:03.416,198] <inf> sta: ==================

[00:00:03.416,229] <inf> sta: State: SCANNING

[00:00:03.716,369] <inf> sta: ==================

[00:00:03.716,400] <inf> sta: State: SCANNING

[00:00:04.016,510] <inf> sta: ==================

[00:00:04.016,540] <inf> sta: State: SCANNING

[00:00:04.316,650] <inf> sta: ==================

[00:00:04.316,680] <inf> sta: State: SCANNING

[00:00:04.616,790] <inf> sta: ==================

[00:00:04.616,821] <inf> sta: State: SCANNING

[00:00:04.916,931] <inf> sta: ==================

[00:00:04.916,961] <inf> sta: State: SCANNING

[00:00:05.217,071] <inf> sta: ==================

[00:00:05.217,102] <inf> sta: State: SCANNING

[00:00:05.517,211] <inf> sta: ==================

[00:00:05.517,242] <inf> sta: State: SCANNING

Help and suggestions would be much appreciated, especially some

guidelines and advice on how to troubleshoot this problem.

  • Hi

    Have you set up the IP address, SSID and password correctly in the prj.conf file of your STA project? You need to set the CONFIG_STA_SAMPLE_SSID to whatever SSID you want to connect to, as well as set the security to what level your AP uses with either of the security levels below, and change the CONFIG_STA_SAMPLE_PASSWORD if applicable.

    # Below configs need to be modified based on security
    # CONFIG_STA_KEY_MGMT_NONE=y
    # CONFIG_STA_KEY_MGMT_WPA2=y
    # CONFIG_STA_KEY_MGMT_WPA2_256=y
    # CONFIG_STA_KEY_MGMT_WPA3=y
    CONFIG_STA_SAMPLE_SSID="Myssid"
    CONFIG_STA_SAMPLE_PASSWORD="Mypassword"

    The prj.conf file is also where you change your IP address if you would like a custom IP address to be set statically.

    Best regards,

    Simon

  • I double checked the proj.conf settings ...

    The wifi shell example says that the CPU clock is running at 128 MHz

    in above wifi example output have the line Starting nrf7002dk_nrf7001_nrf5340_cpuapp with CPU frequency: 128 MHz

    How can I set this frequency in the STA example - to see if this is causing the problem I observe.

    Thanks in advance.

  • Hi

    By default the system clock in this sample should be set to 64MHz. You can see in the STA sample, that the clock frequency is set by SystemCoreClock / MHZ(1). The SystemCoreClock is set to __SYSTEM_CLOCK_DEFAULT (set to 64MHz) by default in the MDK (system_nrf53400_application.c). There must be something in your project calling a SystemCoreClockUpdate or similar that sets the SystemCoreClock til __SYSTEM_CLOCK_MAX (128MHz) instead, but that's not part of the STA sample from what I cans see.

    Best regards,

    Simon

  • Hi Simon, ... the wifi shell example was compiled as is and the same for the sta example ..

    The code that set the cpu clock rateto  128 Mhz in the wifi shell example was...

    #if defined(CLOCK_FEATURE_HFCLK_DIVIDE_PRESENT) || NRF_CLOCK_HAS_HFCLK192M
        /* For now hardcode to 128MHz */
        nrfx_clock_divider_set(NRF_CLOCK_DOMAIN_HFCLK,
                       NRF_CLOCK_HFCLK_DIV_1);
    #endif
        printk("Starting %s with CPU frequency: %d MHz\n", CONFIG_BOARD, SystemCoreClock/MHZ(1));

    Where can I find out more about how to configure and check the SystemCoreClock settings .. searching the Zephyr documentation for the function SystemCoreClock or SystemCoreClockUpdate does not bring up any helpful documentation ... also when looking for __SYSTEM_CLOCK_MAX nothing turned up when searching the documentation either ...

    Is there a function I can call that will display the cpu core frequency ?

    Is there a way of forcing the clock frequency to be 128 MHz ...

    Thanks

  • Hi

    Check out the clock control API in Zephyr here. Sorry, but I didn't have time for a more in-depth answer today. I'll get back to you next week if you're still having trouble then.

    Best regards,
    Simon

Related