UART Configuration Commands Reference#
UC Requirement: The default UART settings must be made configurable through the Studio UC interface, so that customers may change them as needed.
UART Configuration AT Commands#
This section describes the following AT commands for UART configuration functionality on the SiWx91x device:
uart-baud#
Re-configure the baud rate in the UART driver on the SiWx91x device for its communication with the AT commands external host.
Command Format#
at+uart-baud=<baud-rate>Related SDK API
sl_si91x_usart_set_configuration
Pre-conditions#
None
Parameters#
baud-rate#
Baud rate for USART communication in bits per second (bps).
Response#
OKon successERROR <error-code>in case of failure. Possible error codes are the same as those returned by the sl_si91x_usart_set_configuration API.
Notes#
The external host application must re-configure its UART driver to match the new baud rate configured on the SiWx91x device.
During the boot up of the SiWx91x device, the following steps are performed:
The sl_si91x_usart_control_config_t structure is initialized with default values.
The sl_si91x_usart_set_configuration API is invoked to set the default UART configuration.
Use the uart-conf? command to view the current SiWx91x UART configuration before using this or other UART commands to modify specific settings.
This command updates the baud rate in the sl_si91x_usart_control_config_t structure and applies the new setting by invoking the sl_si91x_usart_set_configuration API.
Examples#
at+uart-baud=230400 # Update baud rate to 230,400 bps
OKuart-databits#
Re-configure the data bits in the UART driver on the SiWx91x device for its communication with the AT commands external host.
Command Format#
at+uart-databits=<data-bits>Related SDK API
sl_si91x_usart_set_configuration
Pre-conditions#
None
Parameters#
data-bits#
Number of data bits. Contains a numeric value that corresponds to one of the values of the enum usart_databits_typedef_t.
Note: The values of the
usart_databits_typedef_tenum are not in strict numerical order. Refer to the sl_si91x_usart.h and Driver_USART.h files for the complete list of valid values and their numerical values.
Response#
OKon successERROR <error-code>in case of failure. Possible error codes are the same as those returned by the sl_si91x_usart_set_configuration API.
Notes#
The external host application must re-configure its UART driver to match the new data bits configured on the SiWx91x device.
During the boot up of the SiWx91x device, the following steps are performed:
The sl_si91x_usart_control_config_t structure is initialized with default values.
The sl_si91x_usart_set_configuration API is invoked to set the default UART configuration.
Use the uart-conf? command to view the current SiWx91x UART configuration before using this or other UART commands to modify specific settings.
This command updates the data bits setting in the sl_si91x_usart_control_config_t structure and applies the new setting by invoking the sl_si91x_usart_set_configuration API.
Examples#
at+uart-databits=1792 # Update data bits to 7
# ARM_USART_DATA_BITS_7 = (7UL << ARM_USART_DATA_BITS_Pos) = (7UL << 8) = 1792
OK uart-stopbits#
Re-configure the stop bits in the UART driver on the SiWx91x device for its communication with the AT commands external host.
Command Format#
at+uart-stopbits=<stop-bits>Related SDK API
sl_si91x_usart_set_configuration
Pre-conditions#
None
Parameters#
stop-bits#
Number of stop bits. Contains a numeric value that corresponds to one of the values of the enum usart_stopbit_typedef_t.
Note: The values of the
usart_stopbit_typedef_tenum are not in strict numerical order. Refer to the sl_si91x_usart.h and Driver_USART.h files for the complete list of valid values and their numerical values.
Response#
OKon successERROR <error-code>in case of failure. Possible error codes are the same as those returned by the sl_si91x_usart_set_configuration API.
Notes#
The external host application must re-configure its UART driver to match the new stop bits configured on the SiWx91x device.
During the boot up of the SiWx91x device, the following steps are performed:
The sl_si91x_usart_control_config_t structure is initialized with default values.
The sl_si91x_usart_set_configuration API is invoked to set the default UART configuration.
Use the uart-conf? command to view the current SiWx91x UART configuration before using this or other UART commands to modify specific settings.
This command updates the stop bits setting in the sl_si91x_usart_control_config_t structure and applies the new setting by invoking the sl_si91x_usart_set_configuration API.
Examples#
at+uart-stopbits=16384 # Update stop bits to 2
# ARM_USART_STOP_BITS_2 = (1UL << ARM_USART_STOP_BITS_Pos) = (1UL << 14) = 16384
OKuart-parity#
Re-configure the parity setting in the UART driver on the SiWx91x device for its communication with the AT commands external host.
Command Format#
at+uart-parity=<parity>Related SDK API
sl_si91x_usart_set_configuration
Pre-conditions#
None
Parameters#
parity#
Parity setting for the UART interface. Contains a numeric value that corresponds to one of the values of the enum usart_parity_typedef_t.
Note: The values of the
usart_parity_typedef_tenum are not in strict numerical order. Refer to the sl_si91x_usart.h and Driver_USART.h files for the complete list of valid values and their numerical values.
Response#
OKon successERROR <error-code>in case of failure. Possible error codes are the same as those returned by the sl_si91x_usart_set_configuration API.
Notes#
The external host application must re-configure its UART driver to match the new parity setting configured on the SiWx91x device.
During the boot up of the SiWx91x device, the following steps are performed:
The sl_si91x_usart_control_config_t structure is initialized with default values.
The sl_si91x_usart_set_configuration API is invoked to set the default UART configuration.
Use the uart-conf? command to view the current SiWx91x UART configuration before using this or other UART commands to modify specific settings.
This command updates the parity setting in the sl_si91x_usart_control_config_t structure and applies the new setting by invoking the sl_si91x_usart_set_configuration API.
Examples#
at+uart-parity=8192 # Update parity to odd
# ARM_USART_PARITY_ODD = (2UL << ARM_USART_PARITY_Pos) = (2UL << 12) = 8192
OKuart-hwflowctrl#
Re-configure the hardware flow control setting in the UART driver on the SiWx91x device for its communication with the AT commands external host.
Command Format#
at+uart-hwflowctrl=<hw-flow-control>Related SDK API
sl_si91x_usart_set_configuration
Pre-conditions#
None
Parameters#
hw-flow-control#
Hardware flow control setting for the UART interface. Contains a numeric value that corresponds to one of the values of the enum usart_hwflowcontol_typedef_t.
Note: The values of the
usart_hwflowcontol_typedef_tenum are not in strict numerical order. Refer to the sl_si91x_usart.h and Driver_USART.h files for the complete list of valid values and their numerical values.
Response#
OKon successERROR <error-code>in case of failure. Possible error codes are the same as those returned by the sl_si91x_usart_set_configuration API.
Notes#
The external host application must re-configure its UART driver to match the new hardware flow control setting configured on the SiWx91x device.
During the boot up of the SiWx91x device, the following steps are performed:
The sl_si91x_usart_control_config_t structure is initialized with default values.
The sl_si91x_usart_set_configuration API is invoked to set the default UART configuration.
Use the uart-conf? command to view the current SiWx91x UART configuration before using this or other UART commands to modify specific settings.
This command updates the hardware flow control setting in the sl_si91x_usart_control_config_t structure and applies the new setting by invoking the sl_si91x_usart_set_configuration API.
Examples#
at+uart-hwflowctrl=196608 # Update hardware flow control to RTS + CTS (receive + transmit)
# ARM_USART_FLOW_CONTROL_RTS_CTS = (3UL << ARM_USART_FLOW_CONTROL_Pos) = (3UL << 16) = 196608
OKuart-conf?#
Query the current configuration settings for the UART driver on the SiWx91x device for its communication with the AT commands external host.
Command Format#
at+uart-conf?Related SDK API
sl_si91x_usart_get_configurations
Pre-conditions#
None
Parameters#
None
Response#
OK <baud-rate> <mode> <parity> <stop-bits> <hw-flow-control> <data-bits> <misc-control> <usart-module> <config-enable> <synch-mode>on success, where:<baud-rate>is the current baud rate for USART communication in bits per second (bps)<mode>is the current USART mode of operation (values from usart_mode_typedef_t)<parity>is the current parity bit configuration (values from usart_parity_typedef_t)<stop-bits>is the current number of stop bits (values from usart_stopbit_typedef_t)<hw-flow-control>is the current hardware flow control configuration (values from usart_hwflowcontol_typedef_t)<data-bits>is the current number of data bits (values from usart_databits_typedef_t)<misc-control>is the number of current miscellaneous control options (values from usart_misc_control_typedef_t)<usart-module>is the current USART module identifier<config-enable>is the current configuration enable setting (0 = disabled, 1 = enabled)<synch-mode>is the current synchronous mode setting (0 = asynchronous, 1 = synchronous)
ERROR <error-code>in case of failure. Possible error codes are the same as those returned by the sl_si91x_usart_get_configurations API.
Notes#
This command is useful for viewing the current UART configuration before making changes with other UART commands.
The enum values are not in strict numerical order. The actual numerical values of all enum parameters can be found in the sl_si91x_usart.h and Driver_USART.h files. For example, parity=odd corresponds to ARM_USART_PARITY_ODD = (2UL << 12) = 8192.
Examples#
at+uart-conf? # Query current UART configuration
OK 115200 1 8192 16384 196608 1792 21 0 1 0
# baud-rate=115,200 bps, mode=asynchronous, parity=odd, stop-bits=2, hw-flow-control=RTS+CTS, data-bits=7, misc-control=TX control, USART module=USART0