Network Profile AT Commands#

This section describes AT commands for configuring Wi-Fi client profiles.

Commands#

net-sta-cred#

Configure SSID, credentials, security, and encryption for connecting to an Access Point.

Command Format#

at+net-sta-cred=<profile-id>,<ssid>,<credential-id>,<security>,<encryption>

Related SDK API#

Pre-conditions#

  • oper_mode=0 (Wi-Fi Client)

Parameters#

profile-id#

A unique networking profile identifier. Contains a numeric value that corresponds to one of the values of the enum sl_net_profile_id_t.

ssid#

A string containing the SSID of the Access Point to connect to. Can optionally be enclosed in double quotes. Must be enclosed in double quotes (") if it contains commas.

credential-id#

A unique Wi-Fi credential set identifier which was previously configured using the net-set-credential command.

security#

Optional. The type of Wi-Fi authentication used by the Access Point (for example, WPA3). Contains a numeric value that corresponds to one of the values of the enum sl_wifi_security_t in sl_wifi_constants.h. Note some values are not currently supported, as indicated in the linked enum declaration. If no protocol is specified, WPA2 is used by default (e.g., instead of WPA3).

encryption#

Optional. The type of Wi-Fi encryption used by the Access Point. Contains a numeric value that corresponds to one of the values of the enum sl_wifi_encryption_t in sl_wifi_constants.h. This is set to 0 (default encryption) if not specified.

Response#

  • OK on success

  • ERROR <error code> in case of failure. Possible error codes are the same as those returned by the sl_net_set_profile API.

Notes#

  • When this command or any command beginning with at-net-sta- is sent for the first time for a given profile-id value, the SiWx91x device will:

    1. Initialize an sl_net_wifi_client_profile_t structure instance (from sl_net_wifi_types.h) for the given profile-id value, with the initial values denoted by the macro DEFAULT_WIFI_CLIENT_PROFILE (from sl_net_default_values.h).

    2. Overwrite the specific structure members for the given profile-id value, based on the parameters passed in this command.

    3. Invoke the sl_net_set_profile API to save the profile information under the given profile-id.

  • When any subsequent command beginning with at+net-sta- is sent for the same profile-id, the SiWx91x device will perform the second and third steps given above (that is, overwrite specific structure members and save the profile).

Examples#

// SSID set to "Silabs AP" and Credential ID to 1 with WPA3 authentication and default encryption
at+net-sta-cred=0,"Silabs AP",1,7,0

net-sta-chan#

Configure the channel for connecting to the Access Point.

Command Format#

at+net-sta-chan=<profile-id>,<channel>,<band>,<bandwidth>

Related SDK API#

Pre-conditions#

  • oper_mode=0 (Wi-Fi Client)

Parameters#

profile-id#

A unique networking profile identifier. Contains a numeric value that corresponds to one of the values of the enum sl_net_profile_id_t.

channel#
  • To connect over a specific channel, set this to the desired channel number.

  • To connect over any available channel, set channel to auto (0) with auto band and bandwidth (i.e., set channel=0, band=0, and bandwidth=0).

band#

Optional. The Wi-Fi frequency band from which the channel is selected (for example, 2.4GHz). Contains a numeric value that corresponds to one of the values of the enum sl_wifi_band_t in sl_wifi_constants.h. Note some values are not currently supported, as indicated in the linked enum declaration.

bandwidth#

Optional. The width of the channel (for example, 20MHz). Contains a numeric value that corresponds to one of the values of the enum sl_wifi_bandwidth_t in sl_wifi_constants.h. Note some values are not currently supported, as indicated in the linked enum declaration.

Response#

  • OK on success

  • ERROR <error code> in case of failure. Possible error codes are the same as those returned by the sl_net_set_profile API.

Notes#

  • When this command or any command beginning with at+net-sta- is sent for the first time for a given profile-id value, the SiWx91x device will:

    1. Initialize an sl_net_wifi_client_profile_t structure instance (from sl_net_wifi_types.h) for the given profile-id value, with the initial values denoted by the macro DEFAULT_WIFI_CLIENT_PROFILE (from sl_net_default_values.h).

    2. Overwrite the specific structure members for the given profile-id value, based on the parameters passed in this command.

    3. Invoke the sl_net_set_profile API to save the profile information under the given profile-id.

  • When any subsequent command beginning with at+net-sta- is sent for the same profile-id, the SiWx91x device will perform the second and third steps given above i.e. just overwrite specific structure members and save the profile.

Examples#

// Connect over channel 1 with automatic selection of band and bandwidth
at+net-sta-chan=0,1,0,0

net-sta-bss#

Configure the Basic Service Set Identifier (BSSID) for connecting to the Access Point.

Command Format#

at+net-sta-bss=<profile-id>,<bssid>,<bss-type>

Related SDK API#

Pre-conditions#

  • oper_mode=0 (Wi-Fi Client)

Parameters#

profile-id#

A unique networking profile identifier. Contains a numeric value that corresponds to one of the values of the enum sl_net_profile_id_t.

bssid#

The BSSID of the Access Point to connect to, represented as a 6-byte MAC address with a colon (:) separating every byte. Leave empty or set to 0 if there is no BSSID.

bss-type#

Optional. The type of BSSID that is specified for the Access Point. Contains a numeric value that corresponds to one of the values of the enum sl_wifi_bss_type_t in sl_wifi_constants.h.

Note: When BSSID is 0 (or empty), you should set bss-type to 0 (SL_WIFI_BSS_TYPE_INFRASTRUCTURE).

Response#

  • OK on success

  • ERROR <error code> in case of failure. Possible error codes are the same as those returned by the sl_net_set_profile API.

Notes#

  • When this command or any command beginning with at+net-sta- is sent for the first time for a given profile-id value, the SiWx91x device will:

    1. Initialize an sl_net_wifi_client_profile_t structure instance (from sl_net_wifi_types.h) for the given profile-id value, with the initial values denoted by the macro DEFAULT_WIFI_CLIENT_PROFILE (from sl_net_default_values.h).

    2. Overwrite the specific structure members for the given profile-id value, based on the parameters passed in this command.

    3. Invoke the sl_net_set_profile API to save the profile information under the given profile-id.

  • When any subsequent command beginning with at+net-sta- is sent for the same profile-id, the SiWx91x device will perform the second and third steps given above i.e. just overwrite specific structure members and save the profile.

Examples#

// BSSID of 0 with BSS Type of 'Infrastructure'
at+net-sta-bss=0,0,0

// Set a specific BSSID
at+net-sta-bss=0,54:37:bb:ef:89:dd

net-sta-opt#

Configure the client options (such as scanning before the join) to use when connecting to the Access Point

Command Format#

at+net-sta-opt=<profile-id>,<client-options>,<channel-bitmap-2-4>,<channel-bitmap-5>,<priority>

Related SDK API#

Pre-conditions#

  • oper_mode=0 (Wi-Fi Client)

Parameters#

profile-id#

A unique networking profile identifier. Contains a numeric value that corresponds to one of the values of the enum sl_net_profile_id_t.

client-options#

Reserved

channel-bitmap-2-4#

A bitmap of channel numbers to scan for the given SSID from within the 2.4GHz band. Each channel number is selected by setting the (n - 1)th bit in the bitmap to 1 (channel 1 is selected by setting bit 0, channel 2 by setting bit 1, and so on). If this is left empty or passed as 0, all channels are scanned.

channel-bitmap-5#

Currently not supported. A bitmap of channel numbers to scan for the given SSID from within the 5GHz. Each channel number is selected by setting the (n - 1)th bit in the bitmap to 1 (channel 1 is selected by setting bit 0, channel 2 by setting bit 1, and so on). If this is left empty or passed as 0, all channels are scanned.

priority#

The relative priority of the network profile when Auto Join is invoked.

Note: Auto Join is invoked by issuing the net-up command with a profile-id of 0xFF.

Response#

  • OK on success

  • ERROR <error code> in case of failure. Possible error codes are the same as those returned by the sl_net_set_profile API.

Notes#

  • When this command or any command beginning with at+net-sta- is sent for the first time for a given profile-id value, the SiWx91x device will:

    1. Initialize an sl_net_wifi_client_profile_t structure instance (from sl_net_wifi_types.h) for the given profile-id value, with the initial values denoted by the macro DEFAULT_WIFI_CLIENT_PROFILE (from sl_net_default_values.h).

    2. Overwrite the specific structure members for the given profile-id value, based on the parameters passed in this command.

    3. Invoke the sl_net_set_profile API to save the profile information under the given profile-id.

  • When any subsequent command beginning with at+net-sta- is sent for the same profile-id, the SiWx91x device will perform the second and third steps given above i.e. just overwrite specific structure members and save the profile.

Examples#

// Configure the scanning of the 2.4GHz channel 1 prior to join
at+net-sta-opt=0,,1,0

net-sta-ip#

Configure the IP address allocation to be performed by the IP networking layer after connecting to the Access Point.

Command Format#

at+net-sta-ip=<profile-id>,<ip-mode>,<ip-type>,<host-name>,<station-ip>,<ipv6-global-ip>,<gateway-ip>,<ipv4-netmask>

Related SDK API#

Pre-conditions#

  • oper_mode=0 (Wi-Fi Client)

Parameters#

profile-id#

A unique networking profile identifier. Contains a numeric value that corresponds to one of the values of the enum sl_net_profile_id_t.

ip-mode#

The type of IP address configuration used in the IP networking layer (for example, DHCP). Contains a numeric value that corresponds to one of the values of the enum sl_ip_management_t in sl_ip_types.h.

ip-type#

The type(s) of IP address to be configured (for example, an IPv4 address). Contains a numeric value that corresponds to one of the values of the enum sl_ip_address_type_t in sl_ip_types.h. You can combine multiple values by using a bitwise or (|) operator (for example, (1<<2) | (1<<3) (= 12) specifies both IPv5 and IPv6 address configurations).

host-name#

Optional. A string that defines the network host name for the SiWx91x device. The value may be enclosed in double quotes, and must be enclosed in double quotes (") if it includes commas. If no host name is provided, use an empty string.

station-ip#

Human readable IPv4 address or IPv6 link-local address to be set for the SiWx91x device when ip-mode is 1 (Static).

ipv6-global-ip#

Human readable IPv6 global address whenip-mode is 1 (Static) and ip-version is 6 (IPv6).

gateway-ip#

Human readable Gateway IPv4/IPv6 address.

ipv4-netmask#

Human readable IPv4 subnet mask when ip-version is 4 (IPv4) and ip-mode is 1 (Static).

Note: The parameters station-ip, ipv6-global-ip, gateway-ip, and ipv4-netmask are ignored for DHCP and link-local addressing. They are only applicable when using static IP configuration.

Response#

  • OK on success

  • ERROR <error code> in case of failure. Possible error codes are the same as those returned by the sl_net_set_profile API.

Notes#

  • When this command or any command beginning with at+net-sta- is sent for the first time for a given profile-id value, the SiWx91x device will:

    1. Initialize an sl_net_wifi_client_profile_t structure instance (from sl_net_wifi_types.h) for the given profile-id value, with the initial values denoted by the macro DEFAULT_WIFI_CLIENT_PROFILE (from sl_net_default_values.h).

    2. Overwrite the specific structure members for the given profile-id value, based on the parameters passed in this command.

    3. Invoke the sl_net_set_profile API to save the profile information under the given profile-id.

  • When any subsequent command beginning with at+net-sta- is sent for the same profile-id, the SiWx91x device will perform the second and third steps given above i.e. just overwrite specific structure members and save the profile.

Examples#

// DHCP IP allocation with IPv4 with no specific host name
at+net-sta-ip=0,2,4,,0,,0,0

// Static IP allocation
at+net-sta-ip=1,1,4,,192.168.1.51,,192.168.1.1,255.255.255.0