Skip to content

[bmp388] Try to initialize multiple times#24849

Merged
niklaut merged 2 commits intomainfrom
fix/bmp388_init
Jun 2, 2025
Merged

[bmp388] Try to initialize multiple times#24849
niklaut merged 2 commits intomainfrom
fix/bmp388_init

Conversation

@niklaut
Copy link
Copy Markdown
Contributor

@niklaut niklaut commented May 14, 2025

Solved Problem

The BMP388 sometimes boots slowly on first power-on, so we should try to ping it multiple times.

The issue happens only on first power-on, if you then software reboot, the issue goes away.

Solution

Ping it more often?
The init function is only called once, which is a bit… risky. Unfortunately almost all drivers are implemented like this.

Changelog Entry

For release notes:

Bugfix BMP388: initialize multiple times

Alternatives

Have the workqueue continuously initialize the sensor, this would also guard against communication issues mid-flight. But that requires a rewrite of the driver.

Test coverage

  • Tested in hardware

@dakejahl
Copy link
Copy Markdown
Contributor

Power-on delay is a common problem across all the drivers. The issue here is that init() is being called from the context of the startup script, which could be really early during boot depending on the order of drivers. In the future maybe we consider implementing a startup queue... or rewriting all of the drivers to init() after they've been given the proper ScheduleDelayed(power_on_delay)

@niklaut niklaut force-pushed the fix/bmp388_init branch 4 times, most recently from 3e091b1 to e0028cc Compare May 16, 2025 12:08
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 16, 2025

🔎 FLASH Analysis

px4_fmu-v5x [Total VM Diff: 40 byte (0 %)]
    FILE SIZE        VM SIZE    
--------------  -------------- 
+0.0%     +40  +0.0%     +40    .text
  +127%     +28  +127%     +28    BMP388_I2C::init()
   +17%      +8   +17%      +8    BMP388_I2C::BMP388_I2C()
   +33%      +8   +33%      +8    IIS2MDC_I2C::IIS2MDC_I2C()
  -5.9%      -4  -5.9%      -4    CameraCapture::stop()
+0.0%     +70  [ = ]       0    .debug_abbrev
+0.0%     +12  [ = ]       0    .debug_frame
+0.0%     +71  [ = ]       0    .debug_info
+0.0%     +75  [ = ]       0    .debug_line
 -40.0%      -2  [ = ]       0    [Unmapped]
  +0.0%     +77  [ = ]       0    [section .debug_line]
+0.0%     +38  [ = ]       0    .debug_loclists
+0.0%     +10  [ = ]       0    .debug_rnglists
  [DEL]      -2  [ = ]       0    [Unmapped]
  +0.0%     +12  [ = ]       0    [section .debug_rnglists]
-0.4%     -40  [ = ]       0    [Unmapped]
+0.0%    +276  +0.0%     +40    TOTAL

px4_fmu-v6x [Total VM Diff: 40 byte (0 %)]
    FILE SIZE        VM SIZE    
--------------  -------------- 
+0.0%     +40  +0.0%     +40    .text
  +127%     +28  +127%     +28    BMP388_I2C::init()
   +17%      +8   +17%      +8    BMP388_I2C::BMP388_I2C()
   +33%      +8   +33%      +8    IIS2MDC_I2C::IIS2MDC_I2C()
  -5.9%      -4  -5.9%      -4    CameraCapture::stop()
+0.0%     +70  [ = ]       0    .debug_abbrev
+0.0%     +12  [ = ]       0    .debug_frame
+0.0%     +71  [ = ]       0    .debug_info
+0.0%     +75  [ = ]       0    .debug_line
 -66.7%      -2  [ = ]       0    [Unmapped]
  +0.0%     +77  [ = ]       0    [section .debug_line]
+0.0%     +38  [ = ]       0    .debug_loclists
+0.0%     +14  [ = ]       0    .debug_rnglists
  +200%      +2  [ = ]       0    [Unmapped]
  +0.0%     +12  [ = ]       0    [section .debug_rnglists]
-0.8%     -40  [ = ]       0    [Unmapped]
+0.0%    +280  +0.0%     +40    TOTAL

Updated: 2025-06-02T14:13:51

@niklaut niklaut force-pushed the fix/bmp388_init branch from e0028cc to 46f877a Compare June 2, 2025 13:48
@niklaut
Copy link
Copy Markdown
Contributor Author

niklaut commented Jun 2, 2025

I've tested this on real hardware with wonky wiring and this fixes issues with the on-board BMP390 sensor on the auterion/FMUv6s.

alexcekay
alexcekay previously approved these changes Jun 2, 2025
@niklaut niklaut force-pushed the fix/bmp388_init branch from 46f877a to fb5d07a Compare June 2, 2025 14:08
@niklaut niklaut marked this pull request as ready for review June 2, 2025 14:08
@niklaut niklaut merged commit 3971db3 into main Jun 2, 2025
68 of 73 checks passed
@niklaut niklaut deleted the fix/bmp388_init branch June 2, 2025 14:54
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.

4 participants