---
title: "Blink"
description: "The canonical first program — toggle one LED pad as a plain digital GPIO"
source: https://docs.alplab.ai/sdk/examples/blink
---

# `blink`

The canonical first program: toggle the RGB-red LED pad as a plain digital GPIO. Upstream's `examples/README.md` describes it as *start here, before anything else* (the README lists `bringup/board-selftest` first, and `hello-world` before `blink` under Peripheral I/O). New in v0.14.0.

It uses the bare GPIO calls — `alp_gpio_open()` / `alp_gpio_configure()` / `alp_gpio_write()` / `alp_gpio_close()` — with **no block helper**, so nothing sits between your code and the pad.

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

## What it does

1. Opens the RGB-red LED pad as a GPIO with `alp_gpio_open()`.
2. Configures it as an output with `alp_gpio_configure()`.
3. Toggles it with `alp_gpio_write()` every 200 ms, in a loop that never ends. The first `ALP_BLINK_SELFTEST_TOGGLES` (10) toggles each print the level and the returned status.
4. Prints `[blink] done` once, after those 10 toggles; the LED then keeps blinking forever. `alp_gpio_close()` runs only on the write-failure path.

It builds **unmodified** for both EVKs — the pad differs, the source does not:

| Board | LED pad instance |
|---|---|
| E1M EVK (alp-sdk v0.17.0 preset, 2626-R2 board) | `ALP_E1M_GPIO_PWM0` |
| E1M-X EVK | `ALP_E1M_X_GPIO_PWM5` |

## `board.yaml`

The load-bearing part — one SoM, one preset, one pin, one core with one peripheral:

```yaml
som:
  sku: E1M-AEN801

preset: e1m-evk

pins:
  - { e1m: E1M_GPIO_PWM0, macro: EVK_PIN_LED_RED, doc: "RGB LED red -- the PWM0 pad as a digital GPIO" }

cores:
  m55_hp:
    peripherals: [gpio]
```

:::note[RGB LED channels: 2626-R2 preset and 2641-R3 board]
The alp-sdk v0.17.0 `e1m-evk` preset follows the earlier **2626-R2** E1M EVK, on which the `PWM0` pad drives the red channel (bench-measured 2026-07-28), so `EVK_PIN_LED_RED` is `E1M_GPIO_PWM0`. On the current **2641-R3** E1M EVK (UG-E1M-001) the RGB LED `D19` is red on pad B5 (`E1M_GPIO_PWM3`), green on A6 (`E1M_GPIO_PWM0`) and blue on B6 (`E1M_GPIO_PWM1`), so on a 2641-R3 board this example lights the green channel.
:::

## Expected output

Real hardware, either EVK:

```
[blink] init led=BOARD_PIN_LED_RED
[blink] led=1 status=0
[blink] led=0 status=0
...
[blink] done
```

The LED visibly toggles about five times a second. Under `native_sim` the output has the same shape, minus photons.

## Status

Report this one honestly — the parts that are bench-measured and the parts that are not:

- **Bench-measured (2026-07-28)** — the RED/GREEN pin choice on the 2626-R2 E1M EVK and the pad swap between the two EVKs.
- **Twister coverage** — `native_sim` / `native_sim/native/64` only, with the harness matching on the regex `\[blink\] done`. A third row, `alp_sdk.example.blink.aen`, is **build-only** (`build_only: true`) for `alp_e1m_aen801_m55_hp/ae822fa0e5597ls0/rtss_hp` and `alp_e1m_aen803_m55_hp/ae822fa0e5597ls0/rtss_hp`; only the `native_sim` rows run.
- **Real silicon** — the overlays exist for a `tan build`, but **no dated silicon PASS capture is published for the full run**. Treat the hardware block above as the expected shape, not as a citation.

## See also

- [`hello-world`](https://docs.alplab.ai/sdk/examples/hello-world) — the boot path + console, before any pad is involved
- [`gpio-button-led`](https://docs.alplab.ai/sdk/examples/gpio-button-led) — the next step: an input as well as an output
- [`<alp/peripheral.h>` reference](https://docs.alplab.ai/sdk/api/peripheral)
- [`board.yaml` reference](https://docs.alplab.ai/sdk/board-yaml)
- [Examples overview](https://docs.alplab.ai/sdk/examples/overview)
