From cda370b69d44e72f66746f6fb972ad5f434617c8 Mon Sep 17 00:00:00 2001 From: jhchun Date: Tue, 16 Jun 2026 10:40:44 +0900 Subject: [PATCH] =?UTF-8?q?mtb=3F=20=EC=A0=95=EB=A0=AC=EB=AA=A8=EB=93=9C?= =?UTF-8?q?=20=EC=A4=91=20IMU=20=EC=A3=BC=EA=B8=B0=20=EC=98=A8=EB=8F=84=20?= =?UTF-8?q?=EC=9D=BD=EA=B8=B0=20=EB=B9=84=ED=99=9C=EC=84=B1=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 정렬모드(mtb?)일 때 FIFO가 활성화 상태, FW 내부 60초 주기 온도 점검을 위해 온도 레지스터 접근 시 오류 발생 가능 --- .../measurement/battery/battery_saadc.c | 5 +++++ .../measurement/imu/app_raw/app_raw.c | 15 +++++++++++++-- .../measurement/imu/app_raw/app_raw.h | 5 +++++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/project/ble_peripheral/ble_app_bladder_patch/measurement/battery/battery_saadc.c b/project/ble_peripheral/ble_app_bladder_patch/measurement/battery/battery_saadc.c index 3ee2e73..7985b8c 100644 --- a/project/ble_peripheral/ble_app_bladder_patch/measurement/battery/battery_saadc.c +++ b/project/ble_peripheral/ble_app_bladder_patch/measurement/battery/battery_saadc.c @@ -183,6 +183,11 @@ void battery_event_handler(nrf_drv_saadc_evt_t const * p_event) low_battery_check = false; safety_batt_mv = batt_lvl_in_milli_volt_1; + if (imu_fifo_capture_is_active()) + { + return; + } + if (imu_read_temperature_x100(NULL, &imu_temp_c) != 0) { DBG_PRINTF("[SAFETY] IMU temp read failed\r\n"); diff --git a/project/ble_peripheral/ble_app_bladder_patch/measurement/imu/app_raw/app_raw.c b/project/ble_peripheral/ble_app_bladder_patch/measurement/imu/app_raw/app_raw.c index 79995c9..5c671a8 100644 --- a/project/ble_peripheral/ble_app_bladder_patch/measurement/imu/app_raw/app_raw.c +++ b/project/ble_peripheral/ble_app_bladder_patch/measurement/imu/app_raw/app_raw.c @@ -407,6 +407,7 @@ extern const nrfx_twi_t m_twi_icm42670; #define IMU_TEMP_AVG_SAMPLES 4U static bool s_direct_twi_ready = false; +static bool s_fifo_capture_active = false; static void imu_direct_twi_init_once(void) { @@ -569,6 +570,11 @@ int imu_read_temperature_x100(uint16_t *temp_x100, float *temp_c) return -1; } + if (s_fifo_capture_active) + { + return -4; + } + imu_direct_twi_init_once(); /* Power ON briefly so the temperature register is refreshed before reading. */ @@ -619,6 +625,11 @@ int imu_read_temperature_x100(uint16_t *temp_x100, float *temp_c) return 0; } +bool imu_fifo_capture_is_active(void) +{ + return s_fifo_capture_active; +} + /* -------------------------------------------------------------------------------------- * mtb? FIFO capture support * @@ -642,8 +653,6 @@ int imu_read_temperature_x100(uint16_t *temp_x100, float *temp_c) #define RIM_MAX_SAMPLE_BYTES (BLE_NUS_MAX_DATA_LEN - 2 - RIM_PACKET_HEADER_BYTES) #define RIM_SAMPLES_PER_PACKET (RIM_MAX_SAMPLE_BYTES / RIM_SAMPLE_SIZE_BYTES) -static bool s_fifo_capture_active = false; - static void imu_serif_make(struct inv_imu_serif *serif) { serif->context = 0; @@ -963,9 +972,11 @@ int imu_fifo_capture_stop_and_send_rim(void) { DBG_PRINTF("[IMU FIFO] drain fail %d\r\n", rc); imu_fifo_send_rim_packets(0); + imu_fifo_power_off(); return rc; } imu_fifo_send_rim_packets(packet_count); + imu_fifo_power_off(); return 0; } diff --git a/project/ble_peripheral/ble_app_bladder_patch/measurement/imu/app_raw/app_raw.h b/project/ble_peripheral/ble_app_bladder_patch/measurement/imu/app_raw/app_raw.h index 270139c..bd98a09 100644 --- a/project/ble_peripheral/ble_app_bladder_patch/measurement/imu/app_raw/app_raw.h +++ b/project/ble_peripheral/ble_app_bladder_patch/measurement/imu/app_raw/app_raw.h @@ -105,6 +105,11 @@ int imu_read_direct(void); */ int imu_read_temperature_x100(uint16_t *temp_x100, float *temp_c); +/** + * \brief Return true while IMU FIFO capture is active. + */ +bool imu_fifo_capture_is_active(void); + /** * \brief Start IMU internal FIFO capture for mtb? test flow. * Configures accel/gyro 100 Hz and flushes FIFO before capture.