Skip to content

Conversation

@Concode0
Copy link
Contributor

@Concode0 Concode0 commented Dec 8, 2025

Description

  • Updates Bmi270::configure_interrupts to correctly configure the hardware interrupt pin behavior.
  • Explicitly enables the pin output driver, corrects bit-shift logic for Open-Drain/Active-Level settings, and maps the Data Ready signal to the selected interrupt pin.

Motivation and Context

Previously, the interrupt pin remained in a high-impedance state because the Output Enable bit (Bit 3) in INT1_IO_CTRL was not being set. Additionally, incorrect bit-shifting logic caused Open-Drain and Active-Level settings to be applied to the wrong register bits. Finally, the internal Data Ready signal was not mapped to the physical pin in the INT_MAP_DATA register, preventing the host MCU from receiving interrupts.

How has this been tested?

I tested this on an ESP32-C3 with a BMI270 sensor using I2C.
Hardware: ESP32-C3 (Revision v0.4), BMI270
Environment: ESP-IDF v5.4.3
Test Case:

  • Configured BMI270 INT1 pin as Open-Drain and Active-Low.
  • Configured ESP32 GPIO with internal Pull-up and Falling Edge trigger.
  • Verified that the ISR triggers correctly at the configured ODR and data is read successfully.

Screenshots (if appropriate, e.g. schematic, board, console logs, lab pictures):

Before Fix (Interrupts not firing): The GPIO Output Enable was 0 (disabled), and no data was printed after starting the task.

[BMI270 Example/I][0.283]: BMI270 initialized successfully
I (542) gpio: GPIO[1]| InputEn: 1| OutputEn: 0| OpenDrain: 0| ... 
[BMI270 Example/I][0.290]: Starting task...
( ... No Data Output / Silence ... )

After Fix (Data Streaming): The GPIO Output Enable is 1, and interrupts trigger data reads correctly.

[BMI270 Example/I][0.283]: BMI270 initialized successfully
I (542) gpio: GPIO[1]| InputEn: 1| OutputEn: 1| OpenDrain: 0| ... 
[BMI270 Example/I][0.290]: Starting task...
0.295, 0.021, 0.045, 0.981, 0.122, -0.061, 0.030, 28.5
0.305, 0.020, 0.046, 0.980, 0.125, -0.060, 0.031, 28.5

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update
  • Hardware (schematic, board, system design) change
  • Software change

Software

  • I have added tests to cover my changes. ( Manual Test Performed )
  • I have updated the .github/workflows/build.yml file to add my new test to the automated cloud build github action.
  • All new and existing tests passed.
  • My code follows the code style of this project.

@github-actions
Copy link

github-actions bot commented Dec 8, 2025

✅Static analysis result - no issues found! ✅

@finger563 finger563 self-requested a review December 8, 2025 04:14
Copy link
Contributor

@finger563 finger563 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix! I don't think I'd actually tried the interrupt I. My testing or example yet (and the hardware that I have with bmi270 is slightly broken 😅). I'll do a test on my hardware to make sure it still works as well, but looks good to me!

@finger563 finger563 merged commit 12a8c26 into esp-cpp:main Dec 8, 2025
96 of 97 checks passed
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