v2n-temp-sensor
TMP112 temperature-sensor read loop on V2N's BRD_I2C, run as a Linux/Yocto user-space app on the Cortex-A55 cluster. Reads the chip once a second for ten samples and prints each in degrees Celsius with 0.001 °C resolution.
Source: examples/v2n/v2n-temp-sensor/.
BRD_I2C is A55/Linux-exclusive — the Cortex-M33 must never master it — so this example no longer runs on m33_sm. It follows the same pattern as v2n-power-monitor: the portable <alp/i2c.h> surface plus a natural-name chip driver, on the Linux /dev/i2c-N backend.
This is the on-module ambient sensor. For the SoC's own die (junction) temperature, see v2n-soc-temperature.
What it shows
alp_i2c_open(.bus_id = 8)— theBRD_I2Chandle (Linux/dev/i2c-8).tmp112_init()— ACK-probe at 7-bit address0x40(TMP112_I2C_ADDR_ADDRVAR_GND; ADD0 strapped to GND on the fitted package). Earlier releases of this example probed0x48, which is the wrong address for the fitted part.tmp112_read_temp_milli_c()in a ten-sample loop, printed sign-safely.- Clean shutdown with
tmp112_deinit()+alp_i2c_close().
board.yaml
som:
sku: E1M-V2N101
preset: e1m-x-evk
cores:
a55_cluster:
app: ./src
peripherals:
- i2c
chips:
- tmp112
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 instead.
Build (Yocto SDK)
# Source the SDK that includes meta-alp-sdk (libalp_sdk.so + libalp_chips.a):
. /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-temp-sensor to the target and run it:
[temp] v2n-temp-sensor
[temp] sample 0: 24.625 degC
[temp] sample 1: 24.687 degC
...
[temp] sample 9: 25.125 degC
[temp] done
See also
- SoC Die Temperature — the portable die-temperature read
<alp/chips/tmp112.h>- Examples overview