---
title: "Secure-Element Sign"
description: "Talk to the OPTIGA Trust M on V2N's BRD_I2C from a Linux/Yocto user-space app on the Cortex-A55 cluster: probe it, read its Coprocessor UID, and run a raw APDU session. The driver runs Infineon's host library through a PAL on the portable `` I²C and timing calls. Nothing here writes to the chip — despite the directory name, this example does not sign anything."
source: https://docs.alplab.ai/sdk/examples/v2n/v2n-secure-element-sign
---

# `v2n-secure-element-sign`

Talk to the OPTIGA Trust M on V2N's `BRD_I2C` from a **Linux/Yocto user-space app on the Cortex-A55 cluster**: probe it, read its Coprocessor UID, and run a raw APDU session. The driver runs Infineon's host library through a PAL on the portable `<alp/peripheral.h>` I²C and timing calls. **Nothing here writes to the chip** — despite the directory name, this example does not sign anything.

Source: [`examples/v2n/v2n-secure-element-sign/`](https://github.com/alplabai/alp-sdk/tree/main/examples/v2n/v2n-secure-element-sign).

:::info[Moved from the M33 to the A55 in alp-sdk v0.17.0]
`BRD_I2C` is A55/Linux-exclusive — the Cortex-M33 must never master it. Earlier releases ran this example on `m33_sm` and issued a hand-rolled `CalcSign` APDU; the v0.17.0 example runs on the A55 and is read-only.
:::

## What it shows

1. **Open `BRD_I2C`** (`bus_id = 8`, Linux `/dev/i2c-8`) at 400 kHz and initialise [`optiga_trust_m_t`](https://github.com/alplabai/alp-sdk/blob/main/include/alp/chips/optiga_trust_m.h). `optiga_trust_m_init_with_reset` reads the `I2C_STATE` register only.
2. **Reset hook for an idled part.** A Trust M idle for more than about 10 s can stop ACKing until it is hardware-reset. `SE_RST` is driven by the GD32 supervisor, which the kernel's `alplab,gd32-bridge-gpio` driver owns, so the app finds the `se-rst` line on the `gd32-bridge-gpio` gpiochip and passes it to the driver as the reset hook. If the part is silent the driver pulses `SE_RST` once and probes again. An image whose kernel does not export the `se-rst` line gets no hook (plain probe).
3. **`optiga_trust_m_read_product_info`** opens the Trust M application and reads the 27-byte Coprocessor UID (data object `0xE0C2`).
4. **`optiga_trust_m_send_apdu`** runs a raw session: the app sends `OpenApplication` itself, then `GetDataObject(0xE0C2)`, and checks the bytes match step 3.

Failing after the reset retry means the chip is not on the bus, is not strapped to address `0x30`, or is held in reset.

## `board.yaml`

```yaml
som:
  sku: E1M-V2N101

preset: e1m-x-evk

cores:
  a55_cluster:
    app: ./src
    peripherals:
      - i2c

chips:
  - optiga_trust_m

diagnostics:
  log_level: info
```

## Expected output (OPTIGA-populated SoM)

```
[se] I2C_STATE probe -> ALP_OK
[se] UID: cim CD platform 16 model 33 fw 80101071 build 2564
[se] raw APDU UID matches (27 bytes)
[se] RESULT PASS: Trust M probe, Coprocessor UID and raw APDU session work
```

## Expected output (missing or held-in-reset chip)

```
[se] RESULT FAIL: optiga_trust_m_init (Trust M not ACKing) -> -2
```

## Wiring this into a real app

The raw APDU session reaches every Trust M command (key generation, ECDSA, secure NVM) today, with the caller owning the command bytes and the application session. Typed calls for those commands, and a PSA driver registered with `<alp/security.h>`'s MbedTLS wrapper so the chip is used transparently, are still to come.

## See also

- [`<alp/chips/optiga_trust_m.h>`](https://docs.alplab.ai/sdk/chips)
- [`<alp/security.h>` reference](https://docs.alplab.ai/sdk/api/security)
- [AEN Secure-Element Sign](https://docs.alplab.ai/sdk/examples/aen/aen-secure-element-sign) — the AEN-side counterpart
