Subsys: AT Command Set
Overview
This sample demonstrates a UART-based BLE AT command interface on Atmosic
devices. The device receives AT+<COMMAND> strings over uart0, processes
them in a work-queue thread, and sends responses back over the same port.
On startup the sample initializes Bluetooth, restores persistent identity
settings from NVS, and prints a ready banner on the console (uart1).
A host — serial terminal or automated test script — can then control BLE
advertising, system settings, and (optionally) scanning and connections by
issuing AT commands.
Three AT command types are supported:
Query (
AT+CMD?) — read the current value or state.Exec (
AT+CMD=<params>) — set a value or trigger an action.Test (
AT+CMD=?) — display the command’s parameter format string.
The default configuration (prj.conf) enables the peripheral-role command
bundle (CONFIG_AT_CMD_PERIPHERAL=y), which covers advertising control and
system commands. Central-role commands (scan, connection management) are
available by adding CONFIG_AT_CMD_CENTRAL=y.
See AT Command Set — Subsystem Reference for the full AT command reference.
Requirements
Atmosic EVK <board | serial>
Building and Running
This sample is built from openair/samples/subsys/at_cmd_set.
Build command:
west build -p always -b <BOARD> openair/samples/subsys/at_cmd_set --sysbuild -T samples.subsys.at_cmd_set.atm
Build with MCUBoot:
west build -p always -b <BOARD> openair/samples/subsys/at_cmd_set --sysbuild -T samples.subsys.at_cmd_set.atm.mcuboot
Flash command:
west flash --no-rebuild --device <DEVICE_ID> --jlink --fast_load [--erase_flash]
Configuration
Key Kconfig options:
Option |
Description |
|---|---|
|
Enable the Atmosic AT command library (required). |
|
Enable the built-in advertising and system command set. |
|
Enable peripheral-role (advertising) commands. |
|
Enable central-role (scan and connection) commands. |
|
Enable the |
Hardware Configuration
The sample uses two UARTs:
uart0 — AT command input/output at 115 200 baud (configured in
app.overlay).uart1 — Console/debug output (board default).
When a single serial port is used (e.g. on boards that expose one CDC-ACM port), both channels share the same port.
Testing
The sample ships with a Pytest harness under pytest/. Four test groups
are defined:
Marker |
Twister target |
Description |
|---|---|---|
|
|
Boot-ready check, |
|
|
Advertising enable/disable, TX power, adv data, scan response, adv set ID. |
|
|
BD address query/set, NVS storage save/get, and |
|
|
BLE scanning, RSSI/MAC filter exclusivity, and connection-slot commands. |
Single-port mode (console and AT commands on the same port):
west twister -p <BOARD> -T openair/samples/subsys/at_cmd_set \
-s samples.subsys.at_cmd_set.atm.pytest \
--device-testing --device-serial <PORT> \
--device-flash-timeout=240 \
--west-flash="--device=<DEVICE_ID>,--jlink,--erase_flash,--fast_load" \
-c -v
Two-port mode (separate port for AT commands):
west twister -p <BOARD> -T openair/samples/subsys/at_cmd_set \
-s samples.subsys.at_cmd_set.atm.pytest \
--device-testing --device-serial <CONSOLE_PORT> \
--device-flash-timeout=240 \
--west-flash="--device=<DEVICE_ID>,--jlink,--erase_flash,--fast_load" \
--pytest-args="--at-cmd-serial=<AT_CMD_PORT>" \
-c -v
Pytest command-line options:
Option |
Default |
Description |
|---|---|---|
|
|
Timeout for individual AT command responses. |
|
(none) |
Separate serial port for AT commands (two-port mode). |
|
|
Baud rate for the AT command serial port. |
|
|
Time to wait while advertising before disabling (adv tests). |
On a successful boot the console prints:
BLE AT Command Sample
Bluetooth initialized
Ready for AT commands (use AT+LISTCMDS? to list commands)