Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/main/target/AETH743Basic/target.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,15 @@
#include "drivers/pinio.h"
#include "drivers/sensor.h"

// V1:two ICM42688
BUSDEV_REGISTER_SPI_TAG(busdev_icm42688_0, DEVHW_ICM42605, ICM42688_0_SPI_BUS, ICM42688_0_CS_PIN, NONE, 0, DEVFLAGS_NONE, IMU_ICM42688_0_ALIGN);
BUSDEV_REGISTER_SPI_TAG(busdev_icm42688_1, DEVHW_ICM42605, ICM42688_1_SPI_BUS, ICM42688_1_CS_PIN, NONE, 2, DEVFLAGS_NONE, IMU_ICM42688_1_ALIGN);

// V2:BMI088 + BMI270
BUSDEV_REGISTER_SPI_TAG(busdev_bmi088_gyro, DEVHW_BMI088_GYRO, BMI088_SPI_BUS, BMI088_GYRO_CS_PIN, BMI088_GYRO_EXTI_PIN, 0, DEVFLAGS_NONE, IMU_BMI088_ALIGN);
BUSDEV_REGISTER_SPI_TAG(busdev_bmi088_acc, DEVHW_BMI088_ACC, BMI088_SPI_BUS, BMI088_ACC_CS_PIN, BMI088_ACC_EXTI_PIN, 0, DEVFLAGS_NONE, IMU_BMI088_ALIGN);
BUSDEV_REGISTER_SPI_TAG(busdev_bmi270, DEVHW_BMI270, BMI270_SPI_BUS, BMI270_CS_PIN, NONE, 3, DEVFLAGS_NONE, IMU_BMI270_ALIGN);
Copy link
Contributor

Choose a reason for hiding this comment

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

Action required

1. Bmi270 tag mismatch 🐞 Bug ✓ Correctness

BMI270 is registered with tag=3 while the SPI4 IMU slot is tag=2 (used by the existing
ICM42688-on-SPI4 descriptor). Since dual-gyro selection uses gyro_to_use as the registry tag,
selecting tag=2 on a BMI270-based board will never match the BMI270 descriptor and can result in no
gyro/acc being detected.
Agent Prompt
### Issue description
`gyro_to_use` is used as the bus device registry tag for both gyro and accelerometer detection. In `AETH743Basic`, the SPI4 IMU slot is currently tag `2` (ICM42688_1), but BMI270 on SPI4 is registered with tag `3`, making BMI270 unselectable when choosing the SPI4 slot.

### Issue Context
- `gyro_to_use` is copied into `imuSensorToUse` and passed into `busDeviceInit()`, which matches on `descriptor->tag`.

### Fix Focus Areas
- src/main/target/AETH743Basic/target.c[29-36]

### Proposed fix
- Change BMI270 registration tag from `3` to `2`:
  - `BUSDEV_REGISTER_SPI_TAG(..., DEVHW_BMI270, ..., /*tag*/ 2, ...)`
- Ensure any documentation/comments for tag mapping (“IMU0/SPI1” vs “IMU1/SPI4”) remain consistent.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


timerHardware_t timerHardware[] = {
DEF_TIM(TIM3, CH3, PB0, TIM_USE_OUTPUT_AUTO, 0, 0), // S1
DEF_TIM(TIM3, CH4, PB1, TIM_USE_OUTPUT_AUTO, 0, 1), // S2
Expand Down
24 changes: 20 additions & 4 deletions src/main/target/AETH743Basic/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,26 +36,41 @@
#define USE_TARGET_IMU_HARDWARE_DESCRIPTORS
#define USE_SPI
#define USE_IMU_ICM42605
#define USE_IMU_BMI088
#define USE_IMU_BMI270

// *************** SPI1 IMU0 ICM42688 ****************
// *************** SPI1 IMU0 ICM42688 or BMI088 ****************
#define USE_SPI_DEVICE_1
#define SPI1_SCK_PIN PA5
#define SPI1_MISO_PIN PA6
#define SPI1_MOSI_PIN PD7
#define SPI1_NSS_PIN PC15

#define IMU_ICM42688_0_ALIGN CW0_DEG_FLIP
#define ICM42688_0_SPI_BUS BUS_SPI1
#define ICM42688_0_CS_PIN PC15
#define ICM42688_0_CS_PIN SPI1_NSS_PIN

// *************** SPI4 IMU1 ICM42688 **************
#define IMU_BMI088_ALIGN CW270_DEG_FLIP
#define BMI088_SPI_BUS BUS_SPI1
#define BMI088_GYRO_CS_PIN PE11
#define BMI088_GYRO_EXTI_PIN PE2
#define BMI088_ACC_CS_PIN SPI1_NSS_PIN
#define BMI088_ACC_EXTI_PIN PD4

// *************** SPI4 IMU1 ICM42688 or BMI270 **************
#define USE_SPI_DEVICE_4
#define SPI4_SCK_PIN PE12
#define SPI4_MISO_PIN PE13
#define SPI4_MOSI_PIN PE14
#define SPI4_NSS_PIN PC13

#define IMU_ICM42688_1_ALIGN CW90_DEG_FLIP
#define ICM42688_1_SPI_BUS BUS_SPI4
#define ICM42688_1_CS_PIN PC13
#define ICM42688_1_CS_PIN SPI4_NSS_PIN

#define IMU_BMI270_ALIGN CW270_DEG_FLIP
#define BMI270_SPI_BUS BUS_SPI4
#define BMI270_CS_PIN SPI4_NSS_PIN

// *************** SPI2 OSD ***********************
#define USE_SPI_DEVICE_2
Expand All @@ -80,6 +95,7 @@
#define USE_BARO
#define BARO_I2C_BUS BUS_I2C2
#define USE_BARO_SPL06
#define USE_BARO_DPS310

#define USE_MAG
#define MAG_I2C_BUS BUS_I2C1
Expand Down