# Configure

Source: [https://docs.qualcomm.com/doc/80-70017-14/topic/Set_up_and_configure_WLAN_connection.html](https://docs.qualcomm.com/doc/80-70017-14/topic/Set_up_and_configure_WLAN_connection.html)

This information describes the setup and configuration procedures required to establish a
            Wi-Fi connection.

## Start Wi-Fi subsystem

Source: [https://docs.qualcomm.com/doc/80-70017-14/topic/Set_up_and_configure_WLAN_connection.html](https://docs.qualcomm.com/doc/80-70017-14/topic/Set_up_and_configure_WLAN_connection.html)

### About this task

If the device is initiated in the STA mode, Wi-Fi is activated by default, that is,
                the Wi-Fi host driver and wpa\_supplicant are launched during the boot process of the
                device.

### Procedure

1. Ensure that the device is connected to the host over UART by performing the
                    steps listed in [Connect to a UART shell](https://docs.qualcomm.com/bundle/publicresource/topics/80-70017-254/how_to.html#connect-to-a-uart-shell).
2. To confirm if the Wi-Fi host driver is loaded, run the following command on the
                    debug UART console:
                
iw devCopy to clipboard
3. Search for the `wlan0` interface in the output:
                
**Sample output**

root@qcm6490:~# iw dev
        phy#0
        Interface wlan0
        ifindex 5
        wdev 0x1
        addr 12:78:04:00:ae:15
        type managed
        channel 60 (5300 MHz), width: 80 MHz, center1: 5290 MHz
        txpower 20.00 dBm
        multicast TXQ:
        qsz-byt qsz-pkt flows drops marks overlmt hashcol tx-bytes   tx-packets
         0       0       0     0     0     0       0        0         0
        Copy to clipboard
4. To verify if wpa\_supplicant is active, run the following command: 
                
ps -ef | grep wpa_supplicantCopy to clipboard

The following output indicates that the wpa\_supplicant has been successfully
                    enabled:

        root        1415       1  0 00:00 ?        00:00:00 wpa_supplicant -Dnl80211 -iwlan0 -ddd -c /etc/wpa_supplicant.conf -f /tmp/wpa_supplicant-log.txtCopy to clipboard

## Scan Wi-Fi

Source: [https://docs.qualcomm.com/doc/80-70017-14/topic/Set_up_and_configure_WLAN_connection.html](https://docs.qualcomm.com/doc/80-70017-14/topic/Set_up_and_configure_WLAN_connection.html)

### About this task

A Wi-Fi scan finds the APs listed in the vicinity that can be initiated through the
                    `nmcli` command line tool.

### Procedure

To initiate a Wi-Fi scan via `nmcli` run the following
                    command:
                
nmcli dev wifi list 2>&1 | less Copy to clipboard

**Sample output**

IN-USE  BSSID              SSID           MODE   CHAN  RATE        SIGNAL  BARS SECURITY
            20:DB:AB:98:57:EE  JioPrivateNet  Infra  9     130 Mbit/s  89          ****             WPA2 802.1X
            20:DB:AB:98:57:EF  JioNet         Infra  9     130 Mbit/s  89          ****              --
            20:DB:AB:98:57:E1  JioPrivateNet  Infra  44    270 Mbit/s  80          ***              WPA2 802.1X
            20:DB:AB:98:57:E0  JioNet         Infra  44    270 Mbit/s  77          ***               --
            F0:61:C0:FB:96:A1  QGuest         Infra  11    260 Mbit/s  75          ***               --
            F0:61:C0:FB:96:A0  Hydra          Infra  11    260 Mbit/s  75          ***              WPA2
            20:DB:AB:9E:CA:CF  JioNet         Infra  5     130 Mbit/s  72          ***			 --
            F0:61:C0:FB:96:B0  Hydra          Infra  140   540 Mbit/s  72          ***              WPA2
            F0:61:C0:FB:96:B1  Pandora        Infra  140   540 Mbit/s  72          ***              WPA2 802.1X
            F0:61:C0:FB:96:B2  QGuest         Infra  140   540 Mbit/s  72          ***               --
            20:DB:AB:9E:CA:CE  JioPrivateNet  Infra  5     130 Mbit/s  69          ***
    Copy to clipboard

Note: To exit from the standard input shell, press
                            CTRL+C.

## Set up Wi-Fi station

Source: [https://docs.qualcomm.com/doc/80-70017-14/topic/Set_up_and_configure_WLAN_connection.html](https://docs.qualcomm.com/doc/80-70017-14/topic/Set_up_and_configure_WLAN_connection.html)

### About this task

In the STA mode, the RB3 Gen 2 device operates as a client and it can connect to a
                wireless hotspot or router.

A wireless connection can be established through the `nmcli` command
                line tool.

To set up the Wi-Fi in STA mode, perform the following steps:

### Procedure

1. Ensure that the device is connected to the host over UART by performing the
                    steps listed in [Connect to a UART shell](https://docs.qualcomm.com/bundle/publicresource/topics/80-70017-254/how_to.html#connect-to-a-uart-shell).
2. To establish a connection to an AP, run the following command: 
                
nmcli dev wifi connect <WiFi-SSID> password <WiFi-password>Copy to clipboard

For example, run the
                    command

        root@qcs6490-rb3gen2-vision-kit:~# nmcli dev wifi connect QualcommWiFi password 1234567890Copy to clipboard

                    where, the Wi-Fi SSID is `QualcommWiFi` and the Wi-Fi password is
                        `1234567890`. 
**Sample                        output**

        Device 'wlan0' successfully activated with 'df4250eb-45f6-4ce2-bd90-a2513e016536'Copy to clipboard

Note: If you see a network error message while running the
                        command, then run one of the following commands to trigger the Wi-Fi scan
                        and verify the intended AP.

        nmcli dev wifi listCopy to clipboard

        iw dev wlan0 scanCopy to clipboard
3. To verify the connection state, run the following command:
                
root@qcs6490-rb3gen2-vision-kit:~# nmcli general statusCopy to clipboard

**Sample output**

        STATE  CONNECTIVITY  WIFI-HW  WIFI    WWAN-HW  WWAN
        connected  full     enabled  enabled  enabled  enabled
        Copy to clipboard
4. To verify the connection status, perform the following steps:
    1. To view the device status, run the following command:
                        
root@qcs6490-rb3gen2-vision-kit:~# nmcli dev statusCopy to clipboard

**Sample output**

            DEVICE  TYPE      STATE        CONNECTION
            wlan0   wifi      connected    QualcommWiFi
            eth0    ethernet  unavailable  --
            eth1    ethernet  unavailable  --
            can0    can       unmanaged    --
            lo      loopback  unmanaged    --
            Copy to clipboard
    2. To view the additional connection information, run the following
                            command:
                        
nmcli device show wlan0Copy to clipboard

**Sample output**

            GENERAL.DEVICE:                         wlan0
            GENERAL.TYPE:                           wifi
            GENERAL.HWADDR:                         00:03:7F:12:F7:F7
            GENERAL.MTU:                            1500
            GENERAL.STATE:                          100 (connected)
            GENERAL.CONNECTION:                     QualcommWiFi
            GENERAL.CON-PATH:                       /org/freedesktop/NetworkManager/ActiveConnection/5
            IP4.ADDRESS[1]:                         192.168.117.130/24
            IP4.ADDRESS[2]:                         192.168.117.131/24
            IP4.GATEWAY:                            192.168.117.126
            IP4.ROUTE[1]:                           dst = 192.168.117.0/24, nh = 0.0.0.0, mt = 3005
            IP4.ROUTE[2]:                           dst = 192.168.117.0/24, nh = 0.0.0.0, mt = 600
            IP4.ROUTE[3]:                           dst = 0.0.0.0/0, nh = 192.168.117.126, mt = 3005
            IP4.DNS[1]:                             192.168.117.126
            IP6.ADDRESS[1]:                         2401:4900:658c:d8b0:3a86:b071:fd59:7ade/64
            IP6.ADDRESS[2]:                         2401:4900:658c:d8b0:37d5:d37f:675c:3313/64
            IP6.ADDRESS[3]:                         fe80::c930:1be0:3ac0:496c/64
            IP6.ADDRESS[4]:                         fe80::28a6:3dc0:f535:75f1/64
            IP6.GATEWAY:                            fe80::14c1:74ff:feef:f40f
            IP6.ROUTE[1]:                           dst = fe80::/64, nh = ::, mt = 256
            IP6.ROUTE[2]:                           dst = fe80::/64, nh = ::, mt = 1024
            IP6.ROUTE[3]:                           dst = 2401:4900:658c:d8b0::/64, nh = ::, mt = 3005
            IP6.ROUTE[4]:                           dst = ::/0, nh = fe80::14c1:74ff:feef:f40f, mt = 3005
            IP6.DNS[1]:                             2401:4900:658c:d8b0::dc
            standard input
            Copy to clipboard
    3. Verify if the IP address is assigned on the
                            `wlan0`interface by running the
                                `ifconfigwlan0` command in the UART console.
                        
root@qcs6490-rb3gen2-vision-kit:~# ifconfig wlan0Copy to clipboard

**Sample output**

            wlan0     Link encap:Ethernet  HWaddr 00:03:7F:12:F7:F7
            inet addr:192.168.117.131  Bcast:192.168.117.255  Mask:255.255.255.0
            inet6 addr: 2401:4900:658c:d8b0:3a86:b071:fd59:7ade/64 Scope:Global
            inet6 addr: fe80::c930:1be0:3ac0:496c/64 Scope:Link
            inet6 addr: fe80::28a6:3dc0:f535:75f1/64 Scope:Link
            inet6 addr: 2401:4900:658c:d8b0:37d5:d37f:675c:3313/64 Scope:Global
            UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
            RX packets:1365 errors:0 dropped:0 overruns:0 frame:0
            TX packets:1141 errors:0 dropped:0 overruns:0 carrier:0
            collisions:0 txqueuelen:1000
            RX bytes:127462 (124.4 KiB)  TX bytes:160302 (156.5 KiB)
            Copy to clipboard
    4. Verify if the AP or router is connected to the Internet by pinging the
                            following public DNS IP:
                        
root@qcs6490-rb3gen2-vision-kit:~# ping 8.8.8.8Copy to clipboard

**Sample output**

            PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
            64 bytes from 8.8.8.8: icmp_seq=1 ttl=55 time=174 ms
            64 bytes from 8.8.8.8: icmp_seq=2 ttl=55 time=96.9 ms
            64 bytes from 8.8.8.8: icmp_seq=3 ttl=55 time=84.8 ms
            ^C
            --- 8.8.8.8 ping statistics ---
            3 packets transmitted, 3 received, 0% packet loss, time 2003ms
            rtt min/avg/max/mdev = 84.809/118.472/173.684/39.352 ms
            Copy to clipboard

Note: If you are connected to one network, but
                                want to use a different connection, you can disconnect by switching
                                the connection to down by specifying the SSID `nmcli con down
                                    ssid/uuid`. Alternatively, if you have multiple
                                connections with the same SSID, use the UUID.

Note: To connect to another saved connection,
                                simply pass the up option in         the `nmcli`
                                command line tool by running the following
                                command.

            nmcli con up ssid/uuidCopy to clipboard

Ensure that you specify the SSID or UUID of the new network that you
                                want         to connect to.

Note: To exit from the standard input shell, press
                            CTRL+C.

For more information on `nmcli`, see  [https://www.linux.org/docs/man1/nmcli.html](https://www.linux.org/docs/man1/nmcli.html) and [https://networkmanager.dev/docs/api/latest/nmcli.html](https://networkmanager.dev/docs/api/latest/nmcli.html).

## Set up Wi-Fi hotspot 

Source: [https://docs.qualcomm.com/doc/80-70017-14/topic/Set_up_and_configure_WLAN_connection.html](https://docs.qualcomm.com/doc/80-70017-14/topic/Set_up_and_configure_WLAN_connection.html)

### About this task

Ensure that you enable SSH by following the steps listed in [Log in using SSH](https://docs.qualcomm.com/bundle/publicresource/topics/80-70017-254/how_to.html#use-ssh).

Set up a Wi-Fi hotspot in SoftAP mode by performing the following steps:

Run the SSH using the following
                command:

    ssh root@<device_IP_address>Copy to clipboard

For example, if the IP address of the device is `192.168.1.22`, run
                the following
                    command:

    ssh root@192.168.1.22Copy to clipboard

Note:  If there is a WCN6750 chipset, ensure that the Wi-Fi
                    SoftAP operating channel configured on the Qualcomm RB3 Gen 2 Development Kit is
                    the same as the one on the Wi-Fi STA operating channel (excluding the DFS
                    channel).

Note: Use either STA or SAP with a DFS
                    channel because STA+SAP SCC DFS concurrency is currently unavailable.

By default the `hostapd.conf` file is located at `/etc`
                location. This file configures the RB3 Gen 2 device as a Wi-Fi SoftAP operational
                mode with SSID as `QSoftAP` and password as
                    `1234567890.`

### Procedure

1. Add the Wi-Fi SoftAP operational mode interface by running the following
                    command:
                
iw dev wlan0 interface add wlan1 type managedCopy to clipboard
2. Reconfigure Wi-Fi SoftAP operational mode by performing the following
                    steps:
    1. Open a new command prompt/terminal.
    2. Pull the default hostapd.conf file from the device
                            by running the following command:
                        
scp -r root@<IP_address>:<source_file_path> <destination_file_path>Copy to clipboard

To pull a file to the current file path, enter the
                                `<destination_file_path>` as `.` in
                            the command.

For example, the IP address of the device is
                                `192.168.1.22`, to pull `hostapd.conf`
                            from `/etc`, run the following
                            command:

            scp -r root@192.168.1.22:/etc/hostapd.conf .Copy to clipboard
    3. Update the hostapd.conf file with the required
                            SSID, password, and relevant hostapd configurations.
                        
Note: Ensure `hw_mode` is updated
                                correctly while modifying the Wi-Fi channel. For more information on
                                hostapd configuration, see [https://w1.fi/cgit/hostap/plain/hostapd/README](https://w1.fi/cgit/hostap/plain/hostapd/README).
    4. Push the file to the device by running the following command:
                        
scp -r hostapd.conf root@192.168.1.22:/etcCopy to clipboard
    5. To verify that the configuration parameters are updated, run the
                            following command in the device for the
                                hostapd.conf file:
                        
<cat /etc/hostapd.conf>Copy to clipboard
3. Set a MAC address for `wlan1` on the Qualcomm RB3 Gen 2
                    Development Kit that has a WCN6750 Wi-Fi chipset. The following example can be
                    used as a reference while setting up a MAC address. 
                
ifconfig wlan1 hw ether 00:03:7F:12:B5:B6Copy to clipboard
4. To set up the SoftAP, run the following command in the `ssh
                        shell`:
                
hostapd -B /etc/hostapd.confCopy to clipboard

The following output indicates that the AP is set up: 
U:\>ssh root@192.168.1.22
        The authenticity of host '192.168.1.22 (192.168.1.22)' can't be established. 
        ED25519 key fingerprint is SHA256: FikBVhxqv9RX0rCP8FP3x0Fr1zGWhgaNhLtD5/7xAJA.
        This key is not known by any other names
        Are you sure you want to continue connecting (yes/no/[fingerprint])? yes 
        Warning: Permanently added '192.168.1.22' (ED25519) to the list of known hosts. 
        Last login: Sun Jan 6 00:06:18 1980
        root@qcm6490:~#
        root@qcm6490:~#
        root@qcm6490:~# iw dev wlane interface add wlanl type managed
        root@qcm6490:~# hostapd -B /etc/hostapd.conf
        wlanl: interface state UNINITIALIZED->COUNTRY_UPDATE
        wlanl: interface state COUNTRY_UPDATE->HT_SCAN
        root@qcm6490:~# ps -ef | grep hostapd
        root   1726       1   0  00:14 ?      00:00:00 hostapd -B /etc/hostapd.conf 
        root   1762    1674   0  00:15 pts/0  00:00:00 grep hostapd
        root@qcm6490:~# |Copy to clipboard
5. To start the Dynamic Host Configuration Protocol (DHCP) server on the Wi-Fi
                    hotspot interface, run the following commands:
                
brctl addbr br0Copy to clipboard

        brctl addif br0 wlan1Copy to clipboard

        ifconfig br0 192.168.225.1 netmask 255.255.255.0 upCopy to clipboard

        killall dnsmasqCopy to clipboard

        dnsmasq --conf-file=/etc/dnsmasq.conf --dhcp-leasefile=/var/run/dnsmasq.leases --addn-hosts=/data/hosts --pid-file=/var/run/dnsmasq.pid -i br0 -I lo -z --dhcp-range=br0,192.168.225.20,192.168.225.60,255.255.255.0,43200 --dhcp-hostsfile=/data/dhcp_hosts --dhcp-option-force=6,192.168.225.1 --dhcp-script=/bin/dnsmasq_script.shCopy to clipboard
6. To establish a connection with the `hostapd_cli`, run the
                    following command in SSH:
                
hostapd_cli -i wlan1 -p /var/run/hostapdCopy to clipboard

Monitor the `hostapd_cli` console for the Wi-Fi STA connection
                        notifications such as `AP-STA-CONNECTED`,
                            `EAPOL-4WAY-HS-COMPLETED`.

**Sample output**

        root@qcm6490:~# hostapd_cli -i wlanl -p /var/run/hostapd
        hostapd_cli v2.11-devel
        Copyright (c) 2004-2022, Jouni Malinen <j@wl.fi> and contributors
        This software may be distributed under the terms of the BSD License. 
        See README for more details.
        
        Interactive mode
        > <3>AP-STA-CONNECTED aa: a4: fd: 8b: ec: 90
        <3>EAPOL-4WAY-HS-COMPLETED aa: a4: fd: 8b:ec:90
        
        > list_sta
        aa: a4: fd: 8b:ec:90Copy to clipboard
7. To verify the connection status, connect to SoftAP from other devices. 
                
For example, connect to SoftAP from a mobile device by performing the
                        following steps:
    1. On the mobile device, navigate to the Wi-Fi settings.
    2. Wait for the Wi-Fi STA to detect SoftAP (with the SSID
                                    QSoftAP).
    3. Select SoftAP and enter the corresponding
                                    `wpa_passphrase` that was configured for SoftAP
                                on the RB3 Gen 2 device, then connect. 
**Sample                                    output**

            > status
            state=ENABLED
            phy=phyR freq=2412
            num_sta_non_erp=0
            num_sta_no_short_slot_time=0
            num_sta_no_short_preamble=0
            olbc=0
            num_sta_ht_no_gf=0 num_sta_no_ht=0
            num_sta_ht_20_mhz=0
            num_sta_ht40_intolerant=0
            olbc_ht=0
            ht_op_mode=0x0
            hw_mode=g
            country_code=US
            country3=0x20
            cac_time_seconds=0
            cac_time_left_seconds=N/A
            channel=1
            edmg_enable=0 edmg_channel=0
            secondary_channel=0
            ieee80211n=1
            ieee80211ac=0
            ieee80211ax=0
            ieee80211be=0
            beacon_int=100
            dtim_period=2
            ht_caps_info=000c
            ht_mcs_bitmask=ffff0000000000000000
            supported_rates-02 04 0b 16 Oc 12 18 24 30 48 60 6c
            max_txpower=30
            bss[0]=wlan1
            bssid[0]=00:03:7f:95:8e:8e
            ssid [0]=QSoftAP
            num_sta[0]=1
            > |Copy to clipboard
    4. To verify the connection, ping the IP address of the mobile from
                                    the RB3 Gen 2 device in the `ssh shell`.

        The following output indicates that the Wi-Fi connection has been
                                    established successfully and the data transfer has begun:

sh-5.1# ping 192.168.1.42
            PING 192.168.1.42 (192.168.1.42): 56 data bytes
            64 bytes from 192.168.1.42: seq=0 ttl=64 time-11.175 ms
            64 bytes from 192.168.1.42: seq=1 ttl=64 time=14.528 ms
            64 bytes from 192.168.1.42: seq=2 ttl=64 time=29.735 ms
            64 bytes from 192.168.1.42: seq=3 ttl=64 time=223.822 ms
            64 bytes from 192.168.1.42: seq-4 ttl=64 time-23.675 ms
            ^C
            192.168.1.42 ping statistics ---
            7 packets transmitted, 5 packets received, 28% packet loss
            round-trip min/avg/max = 11.175/60.587/223.822 ms
            sh-5.1#Copy to clipboard

Alternatively, you can verify the Wi-Fi connection status in the
                                        Settingsof the connected device. For
                                    example, to get the IP address of a mobile device connected to
                                    the RB3 Gen 2 SoftAP, perform the following steps:
        1. Navigate to Settings &gt;
                                                Wi-Fi.
        2. Verify the SSID of the AP.

Note: Any change to this
                        procedure due to software updates will be addressed in the future versions
                        of the document.

## Stop Wi-Fi hotspot

Source: [https://docs.qualcomm.com/doc/80-70017-14/topic/Set_up_and_configure_WLAN_connection.html](https://docs.qualcomm.com/doc/80-70017-14/topic/Set_up_and_configure_WLAN_connection.html)

### About this task

Note: Ensure that the Wi-Fi hotspot has been set up.

To
                stop the hotspot, do the following in SSH:

### Procedure

1. Stop the hostapd by performing the following steps:
    1. To stop the hostapd process, run the following command:
                        
killall hostapdCopy to clipboard
    2. To disable the interface, run the following command:
                        
ifconfig wlan1 downCopy to clipboard
2. To delete `ctrl_interface`, run the following command:
                
rm -rf /var/run/hostapd/wlan1Copy to clipboard

The Wi-Fi hotspot stops successfully.

Last Published: Dec 17, 2024

[Previous Topic
Software](https://docs.qualcomm.com/bundle/publicresource/80-70017-14/topics/Check_WLAN_host_and_SS_platform_driver_source_codes.md) [Next Topic
Debug](https://docs.qualcomm.com/bundle/publicresource/80-70017-14/topics/report_a_w_fi_issue_to_qualcomm.md)