Skip to content

Commit ff94d24

Browse files
committed
BMI160 SPI fixes
1 parent 0a5fe73 commit ff94d24

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

imu/bmi160_wrapper.c

+2
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,9 @@ static bool reset_init_bmi(BMI_STATE *s) {
8585
s->sensor.gyro_cfg.odr = BMI160_GYRO_ODR_1600HZ;
8686
}
8787

88+
chThdSleepMilliseconds(50);
8889
int8_t res = bmi160_set_sens_conf(&(s->sensor));
90+
chThdSleepMilliseconds(50);
8991

9092
return res == BMI160_OK;
9193
}

imu/imu.c

-2
Original file line numberDiff line numberDiff line change
@@ -559,8 +559,6 @@ int8_t user_spi_read(uint8_t dev_id, uint8_t reg_addr, uint8_t *data, uint16_t l
559559

560560
reg_addr = (reg_addr | BMI160_SPI_RD_MASK);
561561

562-
chThdSleepMicroseconds(200); // #FIXME Wont work without this- Why?
563-
564562
chMtxLock(&m_spi_bb.mutex);
565563
spi_bb_begin(&m_spi_bb);
566564
spi_bb_exchange_8(&m_spi_bb, reg_addr);

spi_bb.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ void spi_bb_end(spi_bb_state *s) {
9696
}
9797

9898
void spi_bb_delay(void) {
99-
for (volatile int i = 0; i < 40; i++) {
99+
for (volatile int i = 0; i < 6; i++) {
100100
__NOP();
101101
}
102102
}

0 commit comments

Comments
 (0)