A complete SPI control tutorial for the youyeetoo K1, including a control example for the BME280 temperature/humidity/barometric pressure sensor module
I.Hardware Interface Description:
The board provides a JSPI interface. The connector pinout is as follows:


| No. | Description | Remark |
|---|---|---|
| 1 | 3.3V | Power supply |
| 2 | SPICLK | SPI clock |
| 3 | SPIMISO | |
| 4 | SPIMOSI | |
| 5 | SPICS | Chip select |
| 6 | GND | Ground |


Module Pin Description:
| Module Pin | Description |
|---|---|
| 5V | Power supply positive |
| GND | Ground |
| SCL | I2C/SPI serial clock line |
| SDA | I2C serial data line |
| 3-wire SPI serial data input/output port | |
| 4-wire SPI serial data input | |
| CSB | Chip select pin. High level (default) selects the I2C interface |
| Low level selects the SPI interface | |
| SDO | I2C address select bit; 4-wire SPI serial output port |
Hardware Connection Example:
Module Pin K1 Development Board
1.25 mm pitch 6-pin connector
VCC ────────────────→ 3.3V
GND ────────────────→ GND
SCL ────────────────→ SPI_SCLK
SDA ────────────────→ SPI_MOSI
SDO ────────────────→ SPI_MISO
CSB ────────────────→ SPI_CS

This tutorial uses the BME280 module (operating voltage 3.3 V). It is a small-package, low-power digital composite sensor based on APSM process technology that can measure ambient temperature, humidity and barometric pressure. The humidity-sensing element features fast wake-up and response time, high accuracy and a wide operating temperature range;
the pressure-sensing element is a piezoresistive, low-noise, high-precision and high-resolution absolute barometric pressure sensing element; and the temperature-sensing element features low noise and high resolution, allowing the temperature value to be used for temperature compensation and self-calibration of the humidity and pressure readings.
The humidity-sensing element and the pressure-sensing element can be enabled/disabled independently via the oversampling configuration registers, so the sampling rate of each sensing element can be configured. This makes the module well suited to space-constrained mobile devices such as smartphones, tablets, smart watches and wearables, as well as weather forecasting, vertical velocity indication, fee-control devices, indoor and outdoor navigation, and smart home devices.
Temperature detection range:0℃~+65℃
Temperature measurement error:±0.5℃ MAX ±1℃;resolution 0.1℃
Relative humidity measurement range:0~100%,humidity response time:greater than 1s
Relative humidity measurement error:±2%; humidity hysteresis:±1%;resolution 0.8%
Pressure measurement range:300~1100hPa
Pressure measurement error:±1hPa resolution 0.18Pa
Digital interface type:IIC(slave mode, 3.4 MHz)or SPI (3-wire or 4-wire slave mode, 10 MHz)

Test environment for this tutorial:
Permission requirements:
Note: Other Linux distributions should work in theory, but have not been tested.
Note: Internet connection required for download and installation
Install necessary compilation tools::
# # Update package list (requires internet)
sudo apt update
# Install compilation toolchain (includes gcc, g++, make, etc.)
sudo apt install build-essential
Verify the installation:
# Check the gcc version
gcc --version
# Check the make version
make --version
# Extract the archive
test@test-K1-SBC:~$ unzip K1-SPI-Package.zip
Archive: K1-SPI-Package.zip
inflating: Makefile
inflating: mkspi.sh
inflating: Installation.txt
inflating: bme280_spi_fhl.c
inflating: fhl-api_1.0.0_amd64.deb
#Grant execute permission to the script
test@test-K1-SBC:~$ chmod +x mkspi.sh
#Run the script that adds the SPI device node
test@test-K1-SBC:~$ sudo ./mkspi.sh
spidev
spi-SPI1001:00
/dev/spidev0.0 ready
#Check the SPI device node
test@test-K1-SBC:~$ ls -l /dev/spidev*
crw-rw-rw- 1 root root 153, 0 Oct 13 10:30 /dev/spidev0.0
# Install the FHLAPI support package
sudo dpkg -i fhl-api_1.0.0_amd64.deb
# Compile the executable
test@test-K1-SBC:~$ make
Building available versions...
make[1]: Entering directory '/home/test'
gcc -Wall -O2 -I. -I/usr/include/fhl_api -o bme280_spi_fhl bme280_spi_fhl.c -lfhl_api -lm
[FHL] Build successful: ./bme280_spi_fhl
=========================================
Recommended: ./bme280_spi_fhl
=========================================
make[1]: Leaving directory '/home/test'
Build complete!
A successful build produces:
bme280_spi_fhl - the Linux program that controls the BME280 over SPItest@test-K1-SBC:~$ sudo ./bme280_spi_fhl /dev/spidev0.0
========================================
BME280 SPI Sensor (FHL API)
========================================
[1] Initializing FHL library...
[2026-10-13 11:15:06.720] [INFO] [Thread: 139686505408320] Extracted parent path (excluding file name): /usr/lib/x86_64-linux-gnu
[2026-10-13 11:15:06.720] [INFO] [Thread: 139686505408320] myLibPath is OK: /usr/lib/x86_64-linux-gnu
[2026-10-13 11:15:06.720] [INFO] [Thread: 139686505408320] Set board type: K1 SBC
[2026-10-13 11:15:06.721] [INFO] [Thread: 139686505408320] boardInfo: K1 BSP info., boardName=K1, boardVer=V1
[2026-10-13 11:15:06.721] [INFO] [Thread: 139686505408320] device node /dev/spidev0.0 exists
[2026-10-13 11:15:06.721] [INFO] [Thread: 139686505408320] FhlAPI Version is: 0x10000
[2026-10-13 11:15:06.721] [INFO] [Thread: 139686505408320] FhlAPI Build_Info is: FhlAPI v1.0.0 b20260930
[2026-10-13 11:15:06.721] [INFO] [Thread: 139686505408320] FhlAPI_Init OK==========> end time=UTC:2026-12-01 23:59:59
OK
[2] Opening SPI device: /dev/spidev0.0
OK: SPI handle = -1
Mode: 0, Bits: 8, Speed: 1000000 Hz
[3] Reading Chip ID...
Chip ID: 0x60 (BME280 detected)
[4] Loading calibration data...
OK: Calibration loaded
[5] Configuring sensor...
OK: Sensor configured
[6] Reading data (Press Ctrl+C to exit):
========================================
[11:15:06] Reading #1
Temperature: 26.70 °C | 80.06 °F
Pressure: 1015.82 hPa | 101581.62 Pa
Humidity: 41.66 %
Calculated:
Altitude: -21.34 m (ref: 1013.25 hPa)
Dew Point: 12.58 °C | 54.65 °F
[11:15:07] Reading #2
Temperature: 26.70 °C | 80.06 °F
Pressure: 1015.85 hPa | 101585.28 Pa
Humidity: 41.66 %
Calculated:
Altitude: -21.65 m (ref: 1013.25 hPa)
Dew Point: 12.58 °C | 54.65 °F
[11:15:09] Reading #3
Temperature: 26.69 °C | 80.04 °F
Pressure: 1015.84 hPa | 101583.66 Pa
Humidity: 41.68 %
Calculated:
Altitude: -21.51 m (ref: 1013.25 hPa)
Dew Point: 12.58 °C | 54.65 °F
[11:15:10] Reading #4
Temperature: 26.69 °C | 80.04 °F
Pressure: 1015.81 hPa | 101580.81 Pa
Humidity: 41.67 %
Calculated:
Altitude: -21.28 m (ref: 1013.25 hPa)
Dew Point: 12.58 °C | 54.64 °F
[11:15:11] Reading #5
Temperature: 26.71 °C | 80.08 °F
Pressure: 1015.78 hPa | 101577.59 Pa
Humidity: 41.71 %
Calculated:
Altitude: -21.01 m (ref: 1013.25 hPa)
Dew Point: 12.61 °C | 54.70 °F
[11:15:12] Reading #6
Temperature: 26.71 °C | 80.08 °F
Pressure: 1015.80 hPa | 101580.44 Pa
Humidity: 41.71 %
Calculated:
Altitude: -21.24 m (ref: 1013.25 hPa)
Dew Point: 12.61 °C | 54.70 °F
[11:15:13] Reading #7
Temperature: 26.71 °C | 80.08 °F
Pressure: 1015.81 hPa | 101581.25 Pa
Humidity: 41.73 %
Calculated:
Altitude: -21.31 m (ref: 1013.25 hPa)
Dew Point: 12.62 °C | 54.71 °F
[11:15:14] Reading #8
Temperature: 26.71 °C | 80.08 °F
Pressure: 1015.87 hPa | 101586.92 Pa
Humidity: 41.74 %
Calculated:
Altitude: -21.78 m (ref: 1013.25 hPa)
Dew Point: 12.62 °C | 54.72 °F
[11:15:15] Reading #9
Temperature: 26.72 °C | 80.10 °F
Pressure: 1015.76 hPa | 101576.42 Pa
Humidity: 41.75 %
Calculated:
Altitude: -20.91 m (ref: 1013.25 hPa)
Dew Point: 12.64 °C | 54.74 °F
[11:15:16] Reading #10
Temperature: 26.71 °C | 80.08 °F
Pressure: 1015.81 hPa | 101581.25 Pa
Humidity: 41.75 %
Calculated:
Altitude: -21.31 m (ref: 1013.25 hPa)
Dew Point: 12.63 °C | 54.73 °F
[11:15:17] Reading #11
Temperature: 26.72 °C | 80.10 °F
Pressure: 1015.77 hPa | 101577.25 Pa
Humidity: 41.74 %
Calculated:
Altitude: -20.98 m (ref: 1013.25 hPa)
Dew Point: 12.63 °C | 54.74 °F
[11:15:18] Reading #12
Temperature: 26.74 °C | 80.13 °F
Pressure: 1015.85 hPa | 101585.37 Pa
Humidity: 41.72 %
Calculated:
Altitude: -21.66 m (ref: 1013.25 hPa)
Dew Point: 12.64 °C | 54.75 °F
[11:15:19] Reading #13
Temperature: 26.75 °C | 80.15 °F
Pressure: 1015.82 hPa | 101582.15 Pa
Humidity: 41.70 %
Calculated:
Altitude: -21.39 m (ref: 1013.25 hPa)
Dew Point: 12.64 °C | 54.76 °F
[11:15:20] Reading #14
Temperature: 26.75 °C | 80.15 °F
Pressure: 1015.82 hPa | 101582.15 Pa
Humidity: 41.69 %
Calculated:
Altitude: -21.39 m (ref: 1013.25 hPa)
Dew Point: 12.64 °C | 54.75 °F
[11:15:21] Reading #15
Temperature: 26.77 °C | 80.19 °F
Pressure: 1015.82 hPa | 101581.80 Pa
Humidity: 41.68 %
Calculated:
Altitude: -21.36 m (ref: 1013.25 hPa)
Dew Point: 12.65 °C | 54.78 °F
[11:15:22] Reading #16
Temperature: 26.77 °C | 80.19 °F
Pressure: 1015.79 hPa | 101578.96 Pa
Humidity: 41.65 %
Calculated:
Altitude: -21.12 m (ref: 1013.25 hPa)
Dew Point: 12.64 °C | 54.76 °F
[11:15:23] Reading #17
Temperature: 26.77 °C | 80.19 °F
Pressure: 1015.80 hPa | 101579.78 Pa
Humidity: 41.63 %
Calculated:
Altitude: -21.19 m (ref: 1013.25 hPa)
Dew Point: 12.64 °C | 54.75 °F
#Press Ctrl + C to stop the program while it is running
Shutting down...
[7] Cleaning up...
[2026-10-13 11:15:23.673] [INFO] [Thread: 139686505408320] FhlAPI_UnInit OK <============ end time=UTC:2026-12-01 23:59:59
FHL library uninitialized
Sensor closed. Goodbye!