Skip to content

Port the BME280 from baremetal STM32 to TockOS userland using libtock-c I2C master syscalls#7

Open
Hoi-Tong wants to merge 7 commits intomasterfrom
bme280
Open

Port the BME280 from baremetal STM32 to TockOS userland using libtock-c I2C master syscalls#7
Hoi-Tong wants to merge 7 commits intomasterfrom
bme280

Conversation

@Hoi-Tong
Copy link
Copy Markdown

@Hoi-Tong Hoi-Tong commented Mar 12, 2026

Goal:
Port the BME280 sensor driver from STM32 bare-metal firmware to a TockOS userspace application using libtock-c I2C syscalls, with the goal of getting working sensor readings.

Changes:

  • Replaced STM32 HAL I2C calls (HAL_I2C_Mem_Read/Write) with i2c_master_write_sync and i2c_master_read_sync
  • Replaced HAL_Delay with libtocksync_alarm_delay_ms
  • Removed STM32-specific code and added a simple main to test the sensor
  • Kept the core BME280 driver logic unchanged

What it does:

  • Code compiles and runs
  • Sensor initialization succeeds
  • I2C communication is partially working as it is able to read chip ID and other registers
  • However, all sensor output values are blank

Why sensor data is blank:

  • Sensor is not configured correctly
  • No data is produced

Ref: jlab-sensing/ENTS-node-firmware stm32/lib/bme280/src/bme280.c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants