Skip to content

Feature/mpu 6886 (BSP-789)#734

Open
rashedtalukder wants to merge 5 commits intoespressif:masterfrom
rashedtalukder:feature/mpu_6886
Open

Feature/mpu 6886 (BSP-789)#734
rashedtalukder wants to merge 5 commits intoespressif:masterfrom
rashedtalukder:feature/mpu_6886

Conversation

@rashedtalukder
Copy link
Copy Markdown

@rashedtalukder rashedtalukder commented Mar 11, 2026

  • [ Y] Version of modified component bumped
  • [ Y] CI passing

Change description

Add MPU-6886 6-axis IMU and Gyro feature for the M5Stack Core 2


Note

Medium Risk
Adds a new hardware driver component and wires it into the m5stack_core_2 BSP (capability flags + dependency graph), which could affect build/integration on that target. Other changes are documentation-only updates across many BSP API.md files.

Overview
Adds MPU-6886 IMU support for m5stack_core_2 by introducing a new components/mpu6886 driver component and declaring it as a public BSP dependency (and bumping the BSP version).

Updates m5stack_core_2 capability metadata (BSP_CAPS_IMU now enabled) and documentation so Core2 is listed as IMU-capable and as supported by the display_rotation example. The remainder of the diff is largely generated-doc touchups (punctuation/formatting) across multiple BSP API.md files.

Written by Cursor Bugbot for commit 67f0622. This will update automatically on new commits. Configure here.

Copilot AI review requested due to automatic review settings March 11, 2026 21:36
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Mar 11, 2026

CLA assistant check
All committers have signed the CLA.

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 4 potential issues.

Bugbot Free Tier Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Comment thread components/mpu6886/mpu6886.c Outdated
Comment thread components/mpu6886/mpu6886.c
Comment thread components/mpu6886/mpu6886.c
Comment thread components/mpu6886/mpu6886.c
@github-actions github-actions bot changed the title Feature/mpu 6886 Feature/mpu 6886 (BSP-789) Mar 11, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds MPU-6886 IMU support for M5Stack Core2 and wires it into the display rotation example, along with related BSP capability and documentation updates.

Changes:

  • Introduces a new mpu6886 ESP-IDF component (driver, build files, docs).
  • Enables BSP_CAPS_IMU on m5stack_core_2 and adds the driver as a BSP dependency.
  • Updates the display_rotation example to use mpu6886 on Core2 (and keeps icm42670 for other IMU-capable boards).

Reviewed changes

Copilot reviewed 33 out of 33 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
examples/display_rotation/sdkconfig.bsp.m5stack_core_2 Adds a Core2-specific minimal sdkconfig for the display_rotation example.
examples/display_rotation/main/main.c Selects MPU6886 vs ICM42670 by board and adds Core2 IMU init/read logic for rotation.
components/mpu6886/mpu6886.c New MPU6886 driver implementation (I2C, data reads, config, interrupts, FIFO, filter).
components/mpu6886/license.txt Adds Apache-2.0 license text for the new component.
components/mpu6886/include/mpu6886.h New public header/API definitions for the MPU6886 driver.
components/mpu6886/idf_component.yml Declares the MPU6886 component metadata and IDF dependency.
components/mpu6886/README.md Documents MPU6886 features and usage examples.
components/mpu6886/CMakeLists.txt Registers the new component and selects driver requirements by IDF version.
bsp/m5stack_tab5/API.md Documentation formatting/punctuation updates.
bsp/m5stack_core_s3/API.md Documentation formatting/punctuation updates.
bsp/m5stack_core_2/include/bsp/m5stack_core_2.h Enables IMU capability and documents MPU6886 on the I2C bus.
bsp/m5stack_core_2/idf_component.yml Bumps BSP version and adds MPU6886 as a public dependency (override_path).
bsp/m5stack_core_2/README.md Marks IMU as supported and adds display_rotation example entry.
bsp/m5stack_core_2/API.md Updates IMU capability macro doc and various doc formatting changes.
bsp/m5stack_core/API.md Documentation formatting/punctuation updates.
bsp/m5dial/API.md Documentation formatting/punctuation updates.
bsp/m5_atom_s3/API.md Documentation formatting/punctuation updates.
bsp/esp_wrover_kit/API.md Documentation formatting/punctuation updates.
bsp/esp32_s3_usb_otg/API.md Documentation formatting/punctuation updates.
bsp/esp32_s3_lcd_ev_board/API.md Documentation formatting/punctuation updates.
bsp/esp32_s3_korvo_2/API.md Documentation formatting/punctuation updates.
bsp/esp32_s3_korvo_1/API.md Documentation formatting/punctuation updates.
bsp/esp32_s3_eye/API.md Documentation formatting/punctuation updates.
bsp/esp32_s2_kaluga_kit/API.md Documentation formatting/punctuation updates.
bsp/esp32_p4_function_ev_board/API.md Documentation formatting/punctuation updates.
bsp/esp32_p4_eye/API.md Documentation formatting/punctuation updates.
bsp/esp32_lyrat/API.md Documentation formatting/punctuation updates.
bsp/esp32_c3_lcdkit/API.md Documentation formatting/punctuation updates.
bsp/esp32_azure_iot_kit/API.md Documentation formatting/punctuation updates.
bsp/esp-box/API.md Documentation formatting/punctuation updates.
bsp/esp-box-lite/API.md Documentation formatting/punctuation updates.
bsp/esp-box-3/API.md Documentation formatting/punctuation updates.
README.md Updates Core2 feature list to include IMU and adds Core2 to the display_rotation supported boards list.
Comments suppressed due to low confidence (6)

examples/display_rotation/main/main.c:1

  • imu can remain NULL when mpu6886_create() fails (init only logs/configures when imu is non-null), but app_imu_read() unconditionally calls mpu6886_get_*() with imu. Add an early return in app_imu_read() when imu == NULL, and consider logging the init failure once in app_imu_init() so the example fails gracefully instead of dereferencing a null handle.
    components/mpu6886/mpu6886.c:1
  • This file uses calloc/free and assert() later, but does not include the standard headers that declare them. This can fail builds under C99/C11 with -Werror=implicit-function-declaration (common in ESP-IDF). Add #include <stdlib.h> and #include <assert.h> near the other libc includes.
    components/mpu6886/mpu6886.c:1
  • sensor->timer allocation is not checked for failure. If calloc() returns NULL, later calls to gettimeofday(sens->timer, ...) will crash. Return NULL (and remove the I2C device / free sensor) when timer allocation fails. The legacy mpu6886_create() path has the same missing allocation checks.
    components/mpu6886/mpu6886.c:1
  • pin_bit_mask is a bitmask of GPIOs and is a 64-bit field in ESP-IDF. Using (BIT0 << gpio_num) performs the shift on a 32-bit value, which is undefined/incorrect for GPIO numbers >= 32 and can silently misconfigure the interrupt pin. Use a 64-bit shift (e.g., 1ULL << interrupt_configuration->interrupt_pin) to correctly support all valid GPIOs.
    components/mpu6886/mpu6886.c:1
  • This uses a variable-length array sized by data_len. VLAs are discouraged in ESP-IDF components because they can increase stack usage unpredictably and may be disabled by toolchain/project warnings. Prefer a small fixed-size stack buffer (if all writes are bounded) or allocate a buffer dynamically when needed (and handle allocation failure), or perform a two-step transmit if the I2C API supports it.
    bsp/m5stack_core_2/API.md:1
  • The docs now contain internal/anonymous-type placeholders like bsp_sdcard_cfg_t::@..., which makes the generated API documentation harder to read and unstable across builds. This looks like a doc generation artifact; consider adjusting the documentation generator settings (or the source comments/types) so anonymous unions/structs are rendered with stable, human-readable names, and re-generate these API.md files.
# API Reference

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread components/mpu6886/include/mpu6886.h Outdated
@cursor
Copy link
Copy Markdown

cursor bot commented Mar 11, 2026

You have run out of free Bugbot PR reviews for this billing cycle. This will reset on March 20.

To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

@cursor
Copy link
Copy Markdown

cursor bot commented Mar 11, 2026

You have run out of free Bugbot PR reviews for this billing cycle. This will reset on March 20.

To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

@PetrESP PetrESP self-requested a review March 12, 2026 13:18
@PetrESP
Copy link
Copy Markdown
Collaborator

PetrESP commented Mar 12, 2026

Hello @rashedtalukder,

Thank you for this IMU driver addition. Could you please also include sensor-hub integration so that it can be directly used with our BSP sensor hub API. (ESP-BOX-3 example

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.

5 participants