---
title: "SoC Die Temperature"
description: "Prints the SoC die (junction) temperature once per second from a Linux/Yocto user-space app on the V2N Cortex-A55 cluster, through the portable alptemperaturereaddiemilli_c() in ``."
source: https://docs.alplab.ai/sdk/examples/v2n/v2n-soc-temperature
---

# `v2n-soc-temperature`

Prints the SoC **die (junction) temperature** once per second from a Linux/Yocto user-space app on the V2N Cortex-A55 cluster, through the portable `alp_temperature_read_die_milli_c()` in [`<alp/temperature.h>`](https://docs.alplab.ai/sdk/api/temperature).

Source: [`examples/v2n/v2n-soc-temperature/`](https://github.com/alplabai/alp-sdk/tree/main/examples/v2n/v2n-soc-temperature). New in alp-sdk v0.17.0.

This is **not** the on-module ambient sensor. That one is `alp_temperature_read_milli_c()`, a deliberately separate API entry — but on V2N / V2M Linux it has no backend yet and returns `ALP_ERR_NOSUPPORT`. To read the on-module TMP112 on V2N today, use its natural-name chip driver, as [`v2n-temp-sensor`](https://docs.alplab.ai/sdk/examples/v2n/v2n-temp-sensor) does.

:::note[Not yet run on hardware]
The SDK marks this example as not yet run on hardware; no board output has been captured.
:::

## What it shows

- `alp_temperature_read_die_milli_c(&milli_c)` — the hottest die sensor, in signed milli-degrees Celsius.
- `ALP_ERR_NOSUPPORT` handling — returned when the build has no SoC thermal source (Zephyr / bare-metal, or a kernel with no matching thermal zone).
- Sign-safe printing of a milli-degree value.

## How it works

The Yocto backend reads `/sys/class/thermal/thermal_zoneN/temp` for every zone whose `type` starts with `cpu-thermal` — the RZ/V2N's two TSU units. Zones are chosen **by type, never by index**, because the index follows probe order. The kernel keeps ownership of the TSU; the app claims no peripheral.

## `board.yaml`

```yaml
som:
  sku: E1M-V2N101

preset: e1m-x-evk

cores:
  a55_cluster:
    app: ./src
    peripherals: []

diagnostics:
  log_level: info
```

No `meta-alp-sdk` recipe packages this app yet, so `tan build` blocks the A55 slice with a `yocto-recipe-missing` warning rather than guess a bitbake target. Build it with the Yocto SDK.

## Build (Yocto SDK)

```sh
. /opt/poky/<ver>/environment-setup-aarch64-poky-linux

cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE=$OECORE_NATIVE_SYSROOT/usr/share/cmake/OEToolchainConfig.cmake
cmake --build build
```

## Expected output

Copy `build/v2n-soc-temperature` to the target and run it. The output has this shape:

```
[soc-temp] v2n-soc-temperature
[soc-temp] sample 0: <whole>.<milli> degC
...
[soc-temp] done
```

## See also

- [`<alp/temperature.h>` reference](https://docs.alplab.ai/sdk/api/temperature)
- [`v2n-temp-sensor`](https://docs.alplab.ai/sdk/examples/v2n/v2n-temp-sensor) — the on-module TMP112
- [`v2n-ros2-som-temperature`](https://docs.alplab.ai/sdk/examples/v2n/v2n-ros2-som-temperature) — the same reading published as a ROS 2 topic
- [Examples overview](https://docs.alplab.ai/sdk/examples/overview)
