# BMV080sensor ；How to drive the BMV080 sensor using Keil for the STM32 microcontroller?

**URL:** <https://community.sparkfun.com/t/bmv080sensor-how-to-drive-the-bmv080-sensor-using-keil-for-the-stm32-microcontroller/68901>\
**Category:** Sensors\
**Created:** [May 28, 2026, 8:02am UTC](https://community.sparkfun.com/t/bmv080sensor-how-to-drive-the-bmv080-sensor-using-keil-for-the-stm32-microcontroller/68901 "2026-05-28T08:02:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sdafgh](https://avatars.discourse-cdn.com/v4/letter/s/3ec8ea/32.png) [@sdafgh](https://community.sparkfun.com/u/sdafgh)\
**Post date:** [May 28, 2026, 8:02am UTC](https://community.sparkfun.com/t/bmv080sensor-how-to-drive-the-bmv080-sensor-using-keil-for-the-stm32-microcontroller/68901/1 "2026-05-28T08:02:51Z")

</div>

Is it necessary to port the BMV080 library? How to port it? What should I do? Seeking guidance from experts

---

<div class="post-metadata">

**Author:** ![TS-Russell](https://yyz1.discourse-cdn.com/sparkfun/user_avatar/community.sparkfun.com/ts-russell/32/6092_2.png) [@TS-Russell](https://community.sparkfun.com/u/TS-Russell)\
**Post date:** [May 28, 2026, 6:48pm UTC](https://community.sparkfun.com/t/bmv080sensor-how-to-drive-the-bmv080-sensor-using-keil-for-the-stm32-microcontroller/68901/2 "2026-05-28T18:48:50Z")

</div>

I’m not an expert at uncommon configs, but here goes! Heh. It a bit complex but doable

For Keil + STM32 you will need to use Bosch’s closed SDK instead of our (SparkFun) library

Make sure your MCU is listed on Bosch’s table of compatible MCUs:

| Core | Example STM32 families |
| --- | --- |
| Cortex-M0+ | STM32G0, STM32L0, STM32C0 |
| Cortex-M4 | STM32F3, STM32L4, STM32WB |
| Cortex-M4F | STM32F4, STM32G4, STM32L4+ |
| Cortex-M33 | STM32U5, STM32H5 |
| Cortex-M7F | STM32F7, STM32H7 |

Note that is you have an M3 you will need to switch to a different MCU

The Bosch libraries are built with **GCC** (`arm-none-eabi-gcc`). Keil MDK defaults to **ARM Compiler 6** (`armclang`). Static libraries (`.a`) compiled with GCC are **not ABI-compatible** with ARM Compiler 6 — you cannot simply drop them into a standard Keil project and link.

You have two options:

**Option A: Configure Keil to use the GNU ARM toolchain (recommended)**

- In Keil, switch the project to use GCC for ARM Embedded (e.g., GNU Tools ARM Embedded 10.3-2021.10).

- Then the Bosch `.a` files link directly without modification.

- You will need to ensure your startup code and scatter file are GCC-compatible.

**Option B: Stay on ARM Compiler 6**

- You would need Bosch to provide libraries rebuilt with `armclang`. As of current SDK versions, this is not publicly available. You can request it through Bosch’s SDK contact form, but there is no guarantee.

### “Porting”

You do not port the algorithm (it’s locked in the binary). You port the **hardware abstraction layer** that Bosch calls `combridge.c`. The SDK includes example projects where `combridge.c` implements:

- `bmv080_combridge_read()` / `write()` — your STM32 HAL I2C or SPI transmit/receive

- System time/tick — typically `HAL_GetTick()` or a FreeRTOS tick

- Hardware interrupt handling — if you use the sensor’s IRQ pin for data-ready instead of polling

The integration guide explicitly states: copy the example code, then “refer to the `combridge.c` code … to implement the callback functions for your platform.” (from bosch integration guide)

### RTOS requirement

The Bosch SDK examples and driver internals expect an RTOS context. The Elektor review and SparkFun docs note that the SDK “refers to the Mbed RTOS,” and most examples assume an RTOS is present.

For an STM32 Keil project, plan to include **FreeRTOS** (or Keil RTX5). If you are trying to run bare-metal, you will likely hit undefined references or timing issues because the library may internally call RTOS primitives (delays, mutexes, etc.).

### Step-by-step checklist

1. **Download the SDK** from Bosch Sensortec (requires a contact form / registration).

2. **Verify your STM32 core** is in the supported list above.

3. **Set Keil to GCC** (Option A) or obtain armclang libraries from Bosch (Option B).

4. **Copy files into your Keil project** :

- `api/inc/bmv080.h` → your include path

- `api/inc/bmv080_defs.h` → your include path

- `api/lib/arm_cortex_mXxx/arm_none_eabi_gcc/release/lib_bmv080.a` → add to linker

- `api/lib/arm_cortex_mXxx/arm_none_eabi_gcc/release/lib_postProcessor.a` → add to linker

1. **Write / adapt `combridge.c`** using STM32 HAL:

- I2C: use `HAL_I2C_Mem_Read/Write` (default address is `0x57` if IAB0 is low)

- SPI: use 4-wire mode 0 or 3 (CPOL/CPHA per datasheet)

- Timebase: provide a millisecond counter

- Optional: wire the sensor’s IRQ pin to an EXTI line for interrupt-driven sampling

1. **Integrate an RTOS** (FreeRTOS recommended) into your Keil project before initializing the BMV080 API.

2. **Call the Bosch API** from `main()` after peripheral init:

- `bmv080_init()`

- `bmv080_set_measurement_mode()`

- `bmv080_get_measurement_data()` etc.

### Hardware wiring

- **Interface select** : Tie the `PS` pin high for I2C, low for SPI (latched at power-up).

- **Power** : separate analog (`VDDA/VDDL`) and digital (`VDDD/VDDIO`) domains, all decoupled with \>1 µF. `VDDIO` can be 1.8 V–3.3 V to match your STM32 I/O level.

- **Thermal** : the sensor dissipates up to ~182 mW and must be heatsunk through the flex-PCB bottom side; keep the sensor internal temperature under 65 °C.

- **Optical** : never touch the lens. The sensor must sit behind a protective optical cover in the final housing.

Hope this gets ya going!
