Using AP(softAP) and STA(client) simultaneously
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
Using AP(softAP) and STA(client) simultaneously
Several people have asked about using the WICED module as a SoftAP (AP) and a Client (STA) at the same time.
In this Blog, we will demonstrate this with the Console test App.
First, compile, download and run the Console Test App:
This can be done with the following "Make Target" test.console-BCM943362WCD4 download run
Next assure via the Serial port console window that the Console app is running
For more information on this Serial Port Communication to WICED Module
Typing 'help' will scroll a long list of commands.
> help
Console Commands:
help [<command> [<example_num>]]
- Print help message or command example.
loop <times> [ <semicolon_separated_commands_list> ]
- Loops the commands inside [ ] for specified number of times
antenna <0|1|3>
- Antenna selection. 3 = Auto
get_noise
- Get PHY noise after successful TX
get_ap_info
- Get AP information
get_access_category_parameters_sta
- Get access category parameters for STA
get_associated_sta_list
- Get list of associated clients
get_counters
- Get counters
get_country
- Get country.
get_rate
- Get current rate.
get_data_rate
- Get data rate.
get_mac_addr
- Get the device MAC address.
get_pmk <key>
- Get PMK
get_random
- Get a random number.
get_rssi
- Get the received signal strength of the AP (client mode only).
get_soft_ap_credentials
- Get SoftAP credentials
get_tx_power
- Gets the tx power in dBm.
join <ssid> <open|wep|wpa_aes|wpa_tkip|wpa2|wpa2_tkip> [key] [ip netmask gateway]
- Join an AP. DHCP assumed if no IP address provided
join_specific <ssid> <bssid> <channel> <open|wep|wpa_aes|wpa_tkip|wpa2|wpa2_tkip> [key] [ip netmask gateway]
- Join specified AP. DHCP assumed if no IP address provided
leave
- Leave an AP.
scan
- Scan all enabled channels and print a list of APs found.
set_legacy_rate <1|2|5.5|6|9|11|12|18|24|36|48|54>
- Set legacy (CCK/OFDM) rate on PHY
set_mcs_rate <MCS Index> <Override MCS only>
- Set MCS rate on PHY
disable_11n
- Disable 11n mode operation
enable_11n
- Enable 11n mode operation
set_data_rate <1|2|5.5|6|9|11|12|18|24|36|48|54>
- Set data rate.
set_ip <ip> <netmask> <gateway>
- Set a static IP.
set_listen_interval <listen interval> <time unit>
- Set listen interval in time unit 0 = Beacon Intervals. 1 = DTIM Intervals
wifi_powersave <mode> [delay]
- Enable/disable Wi-Fi powersave mode. 0 = disable. 1 = PS Poll. 2 = Wait [delay] ms before entering powersave
set_tx_power <0-31>
- Set the tx power in dBm.
start_ap <ssid> <open|wpa2|wpa2_aes> <key> <channel> <wps>
- Start AP mode.
status
- Print status of the Wi-Fi and network interfaces.
stop_ap
- Stop AP mode.
test_ap <ssid> <open|wpa2|wpa2_aes> <key> <channel> <wps> <iterations>
- Test AP mode.
test_join <ssid> <open|wep|wpa_aes|wpa_tkip|wpa2|wpa2_tkip> [key] [ip netmask gateway] <iterations>
- Test joining an AP. DHCP assumed if no IP address provided
test_join_specific <ssid> <bssid> <channel> <open|wep|wpa_aes|wpa_tkip|wpa2|wpa2_tkip> [key] [ip netmask gateway] <iterations>
- Test joining an AP. DHCP assumed if no IP address provided
test_cred <ssid> <bssid> <channel> <open|wep|wpa_aes|wpa_tkip|wpa2|wpa2_tkip> [key]
- Test joining an AP
ping <destination> [-i <interval in ms>] [-n <number>] [-l <length>]
- Pings the specified IP or Host.
force_alignment
- Force aligned memory accesses
join_wps <pbc|pin> [pin] [<ip> <netmask> <gateway>]
- Join an AP using WPS
join_wps_specific [pin] [<ip> <netmask> <gateway>]
- Join a specific WLAN using WPS PIN mode
scan_wps
- Scan for APs supporting WPS
start_registrar <pbc|pin> [pin]
- Start the WPS Registrar
stop_registrar
- Stop the WPS Registrar
p2p_connect <pin|pbc> [8 digit PIN]
- Connect to an existing Group Owner or negotiate to form a group
p2p_client_test <SSID> <8 digit PIN> [Iterations]
- Test P2P client connection to existing group owner
p2p_discovery_disable
- Disable P2P discovery mode
p2p_discovery_enable
- Enable P2P discovery mode
p2p_discovery_test [iterations]
- Test enable/disable of P2P discovery mode
p2p_go_start <p|n> [<ssid_suffix> <key> <operating channel>]
- Start P2P (p)ersistent or (n)on-persistent group
p2p_go_stop
- Stop P2P group owner
p2p_go_test <p|n> [iterations]
- Test start/stop of (p)ersistent or (n)on-persistent group
p2p_go_client_test_mode <enable=1|disable=0> <pin value>
- Allow test client to join using PIN value
p2p_leave
- Disassociate from P2P group owner
p2p_negotiation_test <8 digit PIN> [Iterations]
- Test P2P negotiation handshake
p2p_peer_list
- Print P2P peer list
p2p_registrar_start <pin|pbc> [8 digit PIN]
- Start P2P group owner's WPS registrar
p2p_registrar_stop
- Stop P2P group owner's WPS registrar
p2p_set_go_intent <intent value>
- Set P2P group owner intent (0..15 where 15 = must be GO)
p2p_set_go_pbc_mode_support <0|1>
- Set P2P group owner support for PBC mode (1 = allow, 0 = disallow)
p2p_set_listen_channel <channel>
- Set listen channel (1, 6 or 11)
p2p_set_operating_channel <channel>
- Set operating channel (1..11)
iperf
- Run iperf --help for usage.
iperf_test
- iperf_test [iterations] iperf command
malloc_info
- Print memory allocation information
thread_list
- [ThreadX only] Lists the current running threads
thread_kill <thread id>
- [ThreadX only] Kills the specified running thread
thread_spawn [priority] <cmds>
- [ThreadX only] Spawns a new thread for the specified command. Optionally run at a specific priority.
reboot
- Reboot the device
mcu_powersave <0|1>
- Enable/disable MCU powersave
traffic_stream_ipv4 [-c <destination ip>] [-p <port>] [-u (for udp)] [-l <length>] [-d <duration in seconds>] [-r <rate (pps)>] [-S <type of service>] [-i <interface>]
- Start a traffic stream.
>
In this demo we will use the following commands:
status
- Print status of the Wi-Fi and network interfaces.
scan
- Scan all enabled channels and print a list of APs found.
start_ap <ssid> <open|wpa2|wpa2_aes> <key> <channel> <wps>
- Start AP mode.
stop_ap
- Stop AP mode.
join <ssid> <open|wep|wpa_aes|wpa_tkip|wpa2|wpa2_tkip> [key] [ip netmask gateway]
- Join an AP. DHCP assumed if no IP address provided
leave
- Leave an AP.
First let's check the "status"
> status
WICED Version : 3.1.2
Platform : BCM943362WCD4
MAC Address : 44:39:C4:31:14:83
STA Interface : Down
AP Interface : Down
P2P Interface : Down
You can see from the output that the STA and AP interfaces are both down.
Next we can join an existing network:
Type 'scan' to see who is available:
> scan
Waiting for scan results...
# Type BSSID RSSI Rate Chan Security SSID
----------------------------------------------------------------------------------------------
0 Infra 00:16:01:A1:98:38 -68 144.4 1 Open Nidal-Out
1 Infra 00:90:4C:10:E2:20 -57 216.7 1 Open BSD-Android-Test
2 Infra B8:BE:BF:15:AF:B2 -38 144.4 1 WPA2 AES BRCMWiFi
3 Infra B8:BE:BF:15:AF:B1 -38 144.4 1 WPA2 AES brcmwpa
4 Infra 04:A1:51:38:63:AD -65 216.7 1 WPA2 AES NETGEAR24-BT
5 Infra B8:BE:BF:15:AF:B0 -36 54.0 1 WPA2 AES BRCMGUEST
End of scan results
Next we will join an AP, in this example "BRCMGUEST"
> join BRCMGUEST wpa2 <passphrase>
Joining : BRCMGUEST
Successfully joined : BRCMGUEST
Obtaining IPv4 address via DHCP
Setting IPv6 link-local address
IPv4 network ready IP: 10.16.101.9
Now check the status:
> status
WICED Version : 3.1.2
Platform : BCM943362WCD4
MAC Address : 44:39:C4:31:14:83
STA Interface
MAC Address : 44:39:C4:31:14:83
SSID : BRCMGUEST
IP Addr : 10.16.101.9
Gateway : 10.16.96.1
Netmask : 255.255.248.0
AP Interface : Down
P2P Interface : Down
You can see we have successfully joined the network and received an IP address via the DHCP server.
Next we start an AP:
If you type start_ap you will see the correct syntax:
> start_ap
Usage: start_ap <ssid> <open|wpa2|wpa2_aes> <key> <channel> <wps>
Let's start an AP with the SSID 'gangi' with WPA2 security and a passphrase of '12345678' on Channel 1
PLEASE NOTE: The AP and STATION need to be on the same channel! In this case it is 2.4GHz Channel 1.
> start_ap gangi wpa2 12345678 1
Setting IPv6 link-local address
IPv4 network ready IP: 192.168.0.1
Look at the Status again:
> status
WICED Version : 3.1.2
Platform : BCM943362WCD4
MAC Address : 44:39:C4:31:14:83
STA Interface
MAC Address : 44:39:C4:31:14:83
SSID : BRCMGUEST
IP Addr : 10.16.101.9
Gateway : 10.16.96.1
Netmask : 255.255.248.0
AP Interface
MAC Address : 44:39:C4:31:14:83
SSID : gangi
IP Addr : 192.168.0.1
Gateway : 192.168.0.1
Netmask : 255.255.255.0
P2P Interface : Down
Now you can see we have a AP interface and a STA Interface simultaneously running.
You can easily stop the soft AP using 'stop_ap' and leave the AP using the 'leave' command
> stop_ap
> status
WICED Version : 3.1.2
Platform : BCM943362WCD4
MAC Address : 44:39:C4:31:14:83
STA Interface
MAC Address : 44:39:C4:31:14:83
SSID : BRCMGUEST
IP Addr : 10.16.101.9
Gateway : 10.16.96.1
Netmask : 255.255.248.0
AP Interface : Down
P2P Interface : Down
> leave
> status
WICED Version : 3.1.2
Platform : BCM943362WCD4
MAC Address : 44:39:C4:31:14:83
STA Interface : Down
AP Interface : Down
P2P Interface : Down
Enjoy. Hope this helps!
Please direct questions and comments to:
- Subscribe to RSS Feed
- Mark Article as New
- Mark Article as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
very useful, thanks! !!!