---
title: "Alp Console (Example App)"
description: "A single, shippable slot0 application that brings the alp interactive console up on the SoM's UART and — on the E1M-AEN801 — wires it to the on-module TI CC3501E Wi-Fi/BLE coprocessor plus a live RGB status LED. One app, three things to show: a Linux-like shell, on-air connectivity, and a \"board is alive\" indicator."
source: https://docs.alplab.ai/sdk/examples/alp-console
---

# `alp-console`

A single, shippable slot0 application that brings the **`alp` interactive console** up on the SoM's UART and — on the E1M-AEN801 — wires it to the on-module TI CC3501E Wi-Fi/BLE coprocessor plus a live RGB status LED. One app, three things to show: a Linux-like shell, on-air connectivity, and a "board is alive" indicator.

:::tip[This page documents the *example*]
The `alp` command tree itself is SDK infrastructure with its own reference page — see [Console](https://docs.alplab.ai/sdk/tools/console) for the full command surface, flags, and safety tiers. This page covers the example app that hosts it.
:::

Source: [`examples/peripheral-io/alp-console/`](https://github.com/alplabai/alp-sdk/tree/main/examples/peripheral-io/alp-console).

## What it does

Almost nothing — and that's the lesson. Setting `CONFIG_ALP_SDK_CONSOLE=y` registers the whole `alp` command tree on the Zephyr shell **at link time**, so the app gets `board` / `gpio` / `i2c` / `adc` / `pwm` / `mem` / `clk` / `reboot` / `companion` diagnostics for free.

`main()` registers **no commands**. It only:

1. Binds the companion chip (on Alif: opens the CC3501E and hands the handle to the console).
2. Spawns the RGB status-LED thread.

| Surface | Command(s) | Backed by |
|---|---|---|
| Interactive shell | `alp …` (Tab to explore) | `CONFIG_ALP_SDK_CONSOLE` |
| SoM identity | `alp board` | HW_INFO + the on-module EEPROM |
| Companion liveness | `alp companion ver` / `ping` | CC3501E bridge (Alif) / GD32 supervisor (V2N) |
| Wi-Fi scan | `alp companion wifi scan` | CC3501E `Wlan_Scan` |
| Wi-Fi connect | `alp companion wifi connect <ssid> [pass] [wpa3]` | CC3501E STA join |
| BLE enable | `alp companion ble enable` | CC3501E NWP controller + NimBLE host |
| BLE scan | `alp companion ble scan` | NimBLE `ble_gap_disc` |
| Soft-AP | `alp companion wifi ap <ssid> [pass]` | CC3501E AP role + its DHCP server |
| Serve HTTP | `alp companion sock serve <port> [seconds]` | CC3501E listening socket (wire protocol v9) |
| RGB status LED | (automatic background thread) | Alif UTIMER PWM (`pwm-leds`) |

### Serving over the soft-AP

New in alp-sdk v0.17.0. `sock serve` is the counterpart to `sock tcp-get`: instead of connecting out, it binds a listening socket and answers inbound HTTP — an embedded web console on a product with no Ethernet PHY. Start the AP first; `serve` prints the AP-side address a client should aim at:

```
uart:~$ alp companion wifi ap alp-serve alpserve123
ap "alp-serve" up (wpa2)
uart:~$ alp companion sock serve 80 60
ap ip: 10.0.0.3
listen handle 1 (epoch 0)
listening on :80 for 60 s (the shell is blocked until then)
[event] opcode 0x2c (len 12)
accepted handle 2 (epoch 0)
  request: GET /s1 HTTP/1.1
  replied 154 bytes
```

The inbound connection arrives as an asynchronous `EVT_SOCK_ACCEPTED` event (`opcode 0x2c`) — there is no accept opcode on the wire, because the bridge is strict request/reply lockstep. The shell is blocked for the whole window; ctrl-c does not cut it short.

:::warning[AP-mode socket operations are unreliable on current bridge firmware]
Measured on an E1M-AEN801: back-to-back **client** operations (`sock tcp-get`) succeed once and then fail, and a third can leave the link needing a cold boot — reproduced with no listening socket in play, so it is not caused by the serving path; and `bind` / `listen` issued **while a client is still associating** timed out and wedged the link (the same command after the client had a lease worked 5/5). Until the bridge firmware fix lands: bring the AP up, let clients associate, *then* start serving, and do not mix serving with `tcp-get` in one session.
:::

### Wi-Fi

`wifi scan` lists nearby APs with channel, RSSI, and decoded security (`open` / `wpa2` / `wpa3`). The security decode is worth knowing: it comes from the raw 16-bit TI `SecurityInfo`, whose sec-type bitmap lives in the **high** byte — `(info >> 8) & 0x3f`.

```
uart:~$ alp companion wifi scan
5 AP(s):
  MyNetwork                        ch5    -43 dBm  wpa3
  Guest-2.4GHz                     ch3    -59 dBm  wpa2
  IoT-Hub                          ch6    -84 dBm  open
uart:~$ alp companion wifi connect "MyNetwork" hunter2 wpa3
connecting to "MyNetwork" (wpa3)...
connected  rssi=-44 dBm
ip 192.0.2.74
```

No passphrase means open; a trailing `wpa3` token forces WPA3-SAE.

As of alp-sdk v0.16.0 the 4th token is **validated**, not ignored: a mistyped token is refused rather than silently downgrading WPA3-SAE to WPA2-PSK, an unquoted SSID containing a space is refused rather than silently swallowing the real passphrase, and `wpa3` with an empty passphrase is refused (SAE has no open mode). The printed `rssi=` value is now a **separate live read** — it prints `rssi=unavailable (<err>)` when that read fails, instead of rendering a discarded failure as a plausible `rssi=0 dBm`. As of alp-sdk v0.17.0, `alp companion wifi ap` **confirms** the soft-AP (it waits for the firmware to report the AP role, and prints `ap "<ssid>" up (...)` only then), but `ap-stop` is still inconclusive whenever an AP was actually running, and an `ap start` followed by `ap-stop` can wedge the transport. See the [console reference](https://docs.alplab.ai/sdk/tools/console#the-soft-ap-start-is-now-confirmed-stop-still-is-not) before you rely on any of it.

### BLE

```
uart:~$ alp companion ble enable
BLE controller + NimBLE host up
uart:~$ alp companion ble scan
10 device(s):
  66:c6:d2:91:31:26   -91 dBm  ET-2870 Series
  26:2a:8d:21:9d:4d   -50 dBm  (no name)
```

### RGB status LED

A low-priority background thread breathes the on-board RGB LED through a rainbow on the Alif UTIMER PWM (the board overlay's `pwm-leds` children). The shell stays fully responsive while it runs. The thread is devicetree-guarded on `led_red`, so on a board without those PWM nodes (`native_sim`, V2N) it compiles out and nothing is spawned.

## `board.yaml`

```yaml
som:
  sku: E1M-AEN801

preset: e1m-evk

cores:
  a32_cluster:
    os: "off"
  m55_hp:
    os: "off"        # single-core HE app
  m55_he:
    app: ./src
    peripherals:
      - gpio        # `alp gpio`
      - i2c         # `alp i2c`
      - adc         # `alp adc`
      - spi         # required by the CC3501E companion bridge

chips:
  - cc3501e

diagnostics:
  log_level: info
```

The console rides the board's existing `chosen { zephyr,shell-uart }` — no custom pins needed. The `alp` commands discover the peripheral buses through the EVK preset aliases.

`prj.conf` carries the console's own knobs:

```
CONFIG_ALP_SDK=y
CONFIG_ALP_SDK_CONSOLE=y
CONFIG_ALP_SDK_CONSOLE_UNSAFE=y
CONFIG_ALP_SDK_HW_INFO=y
CONFIG_SHELL=y
CONFIG_REBOOT=y
CONFIG_HWINFO=y
CONFIG_MAIN_STACK_SIZE=4096
```

:::warning[`CONFIG_ALP_SDK_CONSOLE_UNSAFE`]
This unlocks the write-capable verbs (`mem wr`, `gpio write`, `companion gpio write`). The example sets it because it's a bench build. Leave it **off** in field builds.
:::

## Portability

`main()` is identical across targets; only the companion bind differs.

| Target | Companion bind |
|---|---|
| **Alif (AEN801)** | No companion singleton, so `main()` opens the CC3501E via `cc3501e_bridge_bringup()` and hands the handle to the console. `alp companion …` then reaches Wi-Fi/BLE. Guarded by `CONFIG_ALP_SDK_CHIP_CC3501E`. |
| **V2N** | The GD32 supervisor is a managed singleton inside the SDK — the bind is a no-op and `alp companion` reaches the GD32 automatically. Its `gpio` sub-commands replace the CC3501E `wifi`/`ble` ones. |
| **`native_sim`** | No companion at all. The console plus every non-companion command still works, so the example builds and runs everywhere. |

## Portability-lint allowlist

This example is on the SDK's example-portability lint **allowlist**. It reaches for Zephyr driver headers directly in two places:

- `zephyr/drivers/pwm.h` for the RGB status LED;
- `gpio.h` / `pinctrl.h` in the CC3501E bridge's own control-transport HAL.

Both are pre-existing gaps that predate the portable-surface migration; moving the LED path onto `<alp/pwm.h>` is tracked as separate follow-up work.

## Status

`build_only: true` on `native_sim/native/64`. CI proves it compiles and links; the shell, Wi-Fi, BLE, and LED behaviour are **bench** signals on real AEN silicon.

The app is slot0-linked (`CONFIG_FLASH_LOAD_OFFSET=0x10000`), so it flashes via the MRAM path: `app-gen-toc` builds a signed ATOC, then J-Link loads the image and the ATOC to their addresses. The companion CC3501E must already be running its bridge firmware.

## See also

- [Console reference](https://docs.alplab.ai/sdk/tools/console) — the full `alp` command tree
- [`aen-cc3501e-bringup`](https://docs.alplab.ai/sdk/examples/aen/aen-cc3501e-bringup) — the minimal CC3501E power + PING soak
- [`aen-cc3501e-companion-tour`](https://docs.alplab.ai/sdk/examples/aen/aen-cc3501e-companion-tour) — the full-surface companion walkthrough
- [`<alp/hw_info.h>` reference](https://docs.alplab.ai/sdk/api/hw-info) — what backs `alp board`
- [Examples overview](https://docs.alplab.ai/sdk/examples/overview)
