From f4916e4c740e69f9700639b721b37968622ae095 Mon Sep 17 00:00:00 2001 From: Steve Evans Date: Thu, 28 Apr 2022 19:56:32 +0100 Subject: [PATCH 1/2] Fix length of data read from BMI270 --- src/main/drivers/accgyro/accgyro_spi_bmi270.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/drivers/accgyro/accgyro_spi_bmi270.c b/src/main/drivers/accgyro/accgyro_spi_bmi270.c index 4484fbdefd..047c32ab55 100644 --- a/src/main/drivers/accgyro/accgyro_spi_bmi270.c +++ b/src/main/drivers/accgyro/accgyro_spi_bmi270.c @@ -338,7 +338,7 @@ static bool bmi270AccRead(accDev_t *acc) acc->gyro->dev.txBuf[0] = BMI270_REG_ACC_DATA_X_LSB | 0x80; busSegment_t segments[] = { - {.u.buffers = {NULL, NULL}, 8, true, NULL}, + {.u.buffers = {NULL, NULL}, 7, true, NULL}, {.u.link = {NULL, NULL}, 0, true, NULL}, }; segments[0].u.buffers.txData = acc->gyro->dev.txBuf; @@ -381,7 +381,7 @@ static bool bmi270GyroReadRegister(gyroDev_t *gyro) case GYRO_EXTI_INIT: { // Initialise the tx buffer to all 0x00 - memset(gyro->dev.txBuf, 0x00, 14); + memset(gyro->dev.txBuf, 0x00, 13); #ifdef USE_GYRO_EXTI // Check that minimum number of interrupts have been detected @@ -392,7 +392,7 @@ static bool bmi270GyroReadRegister(gyroDev_t *gyro) if (spiUseDMA(&gyro->dev)) { gyro->dev.callbackArg = (uint32_t)gyro; gyro->dev.txBuf[0] = BMI270_REG_ACC_DATA_X_LSB | 0x80; - gyro->segments[0].len = 14; + gyro->segments[0].len = 13; gyro->segments[0].callback = bmi270Intcallback; gyro->segments[0].u.buffers.txData = gyro->dev.txBuf; gyro->segments[0].u.buffers.rxData = gyro->dev.rxBuf; @@ -416,7 +416,7 @@ static bool bmi270GyroReadRegister(gyroDev_t *gyro) gyro->dev.txBuf[0] = BMI270_REG_GYR_DATA_X_LSB | 0x80; busSegment_t segments[] = { - {.u.buffers = {NULL, NULL}, 8, true, NULL}, + {.u.buffers = {NULL, NULL}, 7, true, NULL}, {.u.link = {NULL, NULL}, 0, true, NULL}, }; segments[0].u.buffers.txData = gyro->dev.txBuf; From 4a3bb45a565084d59c36ea997529e5d7f531cfc3 Mon Sep 17 00:00:00 2001 From: Steve Evans Date: Thu, 28 Apr 2022 20:00:47 +0100 Subject: [PATCH 2/2] Fix comment typo --- src/main/drivers/accgyro/accgyro_mpu.c | 2 +- src/main/drivers/accgyro/accgyro_spi_bmi270.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/drivers/accgyro/accgyro_mpu.c b/src/main/drivers/accgyro/accgyro_mpu.c index fced063f38..110a62cd0b 100644 --- a/src/main/drivers/accgyro/accgyro_mpu.c +++ b/src/main/drivers/accgyro/accgyro_mpu.c @@ -131,7 +131,7 @@ static void mpuIntExtiHandler(extiCallbackRec_t *cb) { gyroDev_t *gyro = container_of(cb, gyroDev_t, exti); - // Ideally we'd use a time to capture such information, but unfortunately the port used for EXTI interrupt does + // Ideally we'd use a timer to capture such information, but unfortunately the port used for EXTI interrupt does // not have an associated timer uint32_t nowCycles = getCycleCounter(); int32_t gyroLastPeriod = cmpTimeCycles(nowCycles, gyro->gyroLastEXTI); diff --git a/src/main/drivers/accgyro/accgyro_spi_bmi270.c b/src/main/drivers/accgyro/accgyro_spi_bmi270.c index 047c32ab55..cd311938ed 100644 --- a/src/main/drivers/accgyro/accgyro_spi_bmi270.c +++ b/src/main/drivers/accgyro/accgyro_spi_bmi270.c @@ -294,7 +294,7 @@ busStatus_e bmi270Intcallback(uint32_t arg) void bmi270ExtiHandler(extiCallbackRec_t *cb) { gyroDev_t *gyro = container_of(cb, gyroDev_t, exti); - // Ideally we'd use a time to capture such information, but unfortunately the port used for EXTI interrupt does + // Ideally we'd use a timer to capture such information, but unfortunately the port used for EXTI interrupt does // not have an associated timer uint32_t nowCycles = getCycleCounter(); gyro->gyroSyncEXTI = gyro->gyroLastEXTI + gyro->gyroDmaMaxDuration;