From 543bb29ad253407416e60d479452ccde2a756f69 Mon Sep 17 00:00:00 2001 From: jhchun Date: Fri, 19 Jun 2026 11:41:59 +0900 Subject: [PATCH] =?UTF-8?q?Echo=20ADC=20fast=20capture=EC=9D=98=20?= =?UTF-8?q?=EC=83=98=ED=94=8C=EB=B3=84=20timeout=20=EC=B9=B4=EC=9A=B4?= =?UTF-8?q?=ED=84=B0=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 수동 CS GPIO 제어 유지 - 샘플 간 CS/SPI 타이밍은 유지하면서 per-samples poling overhead를 줄이기 위함 --- src/drivers/echo_adc/echo_adc.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/drivers/echo_adc/echo_adc.c b/src/drivers/echo_adc/echo_adc.c index 2eda53c..98a97d0 100644 --- a/src/drivers/echo_adc/echo_adc.c +++ b/src/drivers/echo_adc/echo_adc.c @@ -30,7 +30,6 @@ static bool echo_adc_initialized; /* ADC 원본 수신 버퍼 */ static uint8_t raw_capture[ECHO_ADC_MAX_SAMPLES * 2]; -/* GPIO 포트 레지스터 선택 */ static NRF_GPIO_Type *gpio_reg_for_spec(const struct gpio_dt_spec *spec) { return (spec->port == DEVICE_DT_GET(DT_NODELABEL(gpio1))) ? NRF_P1 : NRF_P0; @@ -112,27 +111,17 @@ static int echo_adc_capture_fast(uint16_t *samples, uint16_t num_samples) for (uint16_t i = 0; i < num_samples; i++) { - /* CS 하강 후 2바이트 수신 */ cs_port->OUTCLR = cs_mask; spim->RXD.PTR = (uint32_t)&raw_capture[i * 2U]; spim->EVENTS_END = 0; spim->TASKS_START = 1; /* 전송 완료 대기 */ - uint32_t timeout = 10000U; - while (!spim->EVENTS_END && (timeout > 0U)) + while (!spim->EVENTS_END) { - timeout--; } - /* CS 복귀 */ cs_port->OUTSET = cs_mask; - - if (timeout == 0U) - { - DBG_PRINTF("[ECHO] fast capture timeout\r\n"); - return -ETIMEDOUT; - } } echo_adc_unpack_samples(samples, num_samples); @@ -182,7 +171,7 @@ int echo_adc_init(void) } echo_adc_initialized = true; - DBG_PRINTF("[ECHO] SPIM3 init OK\r\n"); + //DBG_PRINTF("[ECHO] SPIM3 init OK\r\n"); return 0; }