Skip to content

BMP581: Add Streaming and Read-Decode support #93130

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

ubieda
Copy link
Member

@ubieda ubieda commented Jul 14, 2025

Description

This PR introduces the Sensor Model V2 for the existing BMP581 pressure-sensor driver. This is achieved by adding:

  • RTIO bus support.
  • Read/Decode support.
  • Streaming support (DRDY only).
  • DTS default configuration for all existing features (still run-time configurable as before).

Note

As part of a follow-on PR, there will be FIFO WM support for Streaming mode.

Testing

This has been tested with FRDM MCXN947 + BMP581 breakout board over I2C, using the Sensor Shell:

  • Build Command:
west build -b frdm_mcxn947/mcxn947/cpu0 samples/subsys/shell/shell_module -- -DCONFIG_SENSOR=y -DCONFIG_SENSOR_SHELL=y -DCONFIG_I2C_SHELL=y -DCONFIG_SENSOR_SHELL_STREAM=y
  • Overlay:
#include <zephyr/dt-bindings/sensor/bmp581.h>

&flexcomm2_lpi2c2 {
	status = "okay";

	bmp581:bmp581@46 {
		compatible = "bosch,bmp581";
		reg = <0x46>;
		status = "okay";
		odr = <BMP581_DT_ODR_1_HZ>;
		press-osr = <BMP581_DT_OVERSAMPLING_1X>;
		temp-osr = <BMP581_DT_OVERSAMPLING_1X>;
		int-gpios = <&gpio0 29 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>;
	};
};
  • Console output:
uart:~$ sensor get bmp581@46 
channel type=13(ambient_temp) index=0 shift=15 num_samples=1 value=115691149720ns (23.473617)
channel type=14(press) index=0 shift=15 num_samples=1 value=115691149720ns (101.510177)

uart:~$ sensor stream bmp581@46 on data_ready incl
Disabling existing stream
Enabling stream...
Trigger (1 / data_ready) detected
channel type=13(ambient_temp) index=0 shift=15 num_samples=1 value=5350409475ns (23.485336)
channel type=14(press) index=0 shift=15 num_samples=1 value=5350409475ns (101.511444)
Trigger (1 / data_ready) detected
channel type=13(ambient_temp) index=0 shift=15 num_samples=1 value=6346071669ns (23.494262)
channel type=14(press) index=0 shift=15 num_samples=1 value=6346071669ns (101.511428)
Trigger (1 / data_ready) detected
channel type=13(ambient_temp) index=0 shift=15 num_samples=1 value=7341668289ns (23.484176)
channel type=14(press) index=0 shift=15 num_samples=1 value=7341668289ns (101.510253)
Trigger (1 / data_ready) detected
channel type=13(ambient_temp) index=0 shift=15 num_samples=1 value=8337342035ns (23.487548)
channel type=14(press) index=0 shift=15 num_samples=1 value=8337342035ns (101.510848)
uart:~$ sensor stream bmp581@46 off
Disabling existing stream
[00:06:15.403,000] <wrn> BMP581_STREAM: Callback triggered with no streaming submission - Disabling interrupts

@ubieda ubieda added this to the v4.3.0 milestone Jul 14, 2025
@ubieda ubieda force-pushed the bmp581/read-decode-support branch from 0dba8a6 to f448d99 Compare July 14, 2025 23:30
ubieda added 4 commits July 15, 2025 09:13
The existing driver requires setting multiple attributes in order to
work basic fetch/get reads. Simplify this by allowing the user to set
dts node properties based on the use-case.

As a result, basic settings results in the driver being up and running
from the start, one can just get sensor readings out of the box.

These still can be overriden at run-time if need be.

Signed-off-by: Luis Ubieda <[email protected]>
In order to abstract details of the transport itself, improving
portability.

No functional changes at this point. Driver works the same as far
as my local testing goes.

Signed-off-by: Luis Ubieda <[email protected]>
Decoding one-shot reads through submit API.

Signed-off-by: Luis Ubieda <[email protected]>
Working only with DRDY Interrupts. FIFO watermark not added yet.

Signed-off-by: Luis Ubieda <[email protected]>
@ubieda ubieda force-pushed the bmp581/read-decode-support branch from f448d99 to 95ef866 Compare July 15, 2025 13:15
Copy link

@ubieda ubieda requested a review from bperseghetti July 15, 2025 13:41
@ubieda ubieda marked this pull request as ready for review July 15, 2025 13:42
@github-actions github-actions bot added the area: Sensors Sensors label Jul 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants