You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(imu): address PR review issues for BMI220 support
HIGH fixes:
- Revert bmi2.c chip_id hack: remove hardcoded 0x26 from shared library.
The BMI220 driver sets dev->chip_id = 0x26 before calling bmi2_sec_init(),
so the original check (chip_id == dev->chip_id) passes naturally.
- Add tkl_i2c_deinit() on all BMI220 init error paths to prevent I2C leak
- Fix misleading comments about config firmware source
MEDIUM fixes:
- Move bmi260_config_file.c from bmi270/ to bmi220/ directory
- Add CONFIG_ENABLE_IMU_BMI220 section in imu/CMakeLists.txt
- Populate dev->chip_id field after successful init
- Remove production debug logging in sand_update_physics()
- Remove unused board_bmi220_scan_i2c() and board_bmi220_read_gyro()
- Add comments explaining why bmi270_* APIs are valid for BMI220
- Fix inaccurate Kconfig descriptions
LOW fixes:
- Convert migration doc from Chinese to English
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The TUYA_T5AI_PIXEL board ships with a **BMI220** IMU (chip_id = `0x26`), not the BMI270 (chip_id = `0x24`). The original BMI270 driver failed during chip_id validation. Even when that check was bypassed, the BMI270 config firmware is incompatible with BMI220, causing all sensor outputs to read zero.
BMI2xx sensors require an **8192-byte config firmware upload** after power-on for the internal micro-engine to function. Each variant needs its own firmware — they are not interchangeable:
Uploading the wrong firmware results in `INTERNAL_STATUS`register (0x21) returning `0x00` (not initialized), with accelerometer and gyroscope outputs stuck at zero.
17
17
18
-
## 修改清单
18
+
## Changes
19
19
20
-
### 1. 新增文件
20
+
### 1. New Files
21
21
22
-
|文件|说明|
23
-
|------|------|
24
-
|`boards/T5AI/TUYA_T5AI_PIXEL/board_bmi220_api.h`| BMI220 驱动头文件,定义 `bmi220_dev_t`、`bmi220_sensor_data_t`结构体及 API |
The BMI270 driver code is fully preserved. Both drivers initialize independently via separate interfaces. At runtime, `g_imu_type` selects the active driver.
66
+
67
+
### Why bmi270_* API functions appear in the BMI220 driver
68
+
69
+
`bmi270_get_sensor_config()`, `bmi270_set_sensor_config()`, and `bmi270_sensor_enable()` operate on generic BMI2 registers (ACC_CONF, GYR_CONF, POWER_CTRL) that are identical across BMI220/BMI260/BMI270. This is safe and intentional — these are not BMI270-specific functions despite their naming.
0 commit comments